将尾部止动器与止动器限位器或类似物结合使用



我试图做到以下几点:我希望在我的策略.exit((中使用trail_offset,但也不希望价格低于最初的入门价格。假设我有2%的拖尾止损。如果我使用:

ts = input(2, title="TrailingStop%", type=input.float)
ts_calc = close * (1/tick) * ts * 0.01
strategy.exit("ExitLong", "RSILong", trail_points=0, trail_offset=ts_calc)

价格也可以从我的进入方向下降2%(在这种情况下,是多头,低于2%(,我不想要这样。我希望该策略至少从我开始的地方退出,或者,比方说,低于0.5%。

我怎样才能做到这一点?

尝试这个(例如做多头寸(,不确定它是否有效:

stop_limit= close
if ConditionEntryL
strategy.entry('RSILong', strategy.long)
stop_limit := close
if close >= stop_limit
strategy.exit('ExitLong', 'RSILong', trail_points=0, trail_offset=ts_calc)
else
strategy.close('RSILong')

它会在低于入门价时立即平仓吗?

最新更新