如何更改止损值?
How can I change the stop loss value?
如何更改止损值?
有止损代码如下图:
longStopPrice = strategy.position_avg_price * (1-slLen/100)
strategy.exit("SL", "BUY", stop=longStopPrice)
如果买入后涨幅超过1%,我想把止损改成进场价
尝试这样做
if strategy.position_avg_price * 1.01 < close
longStopPrice = strategy.position_avg_price
else
longStopPrice = strategy.position_avg_price * (1-slLen/100)
strategy.exit("SL", "BUY", stop=longStopPrice)
如何更改止损值?
有止损代码如下图:
longStopPrice = strategy.position_avg_price * (1-slLen/100)
strategy.exit("SL", "BUY", stop=longStopPrice)
如果买入后涨幅超过1%,我想把止损改成进场价
尝试这样做
if strategy.position_avg_price * 1.01 < close
longStopPrice = strategy.position_avg_price
else
longStopPrice = strategy.position_avg_price * (1-slLen/100)
strategy.exit("SL", "BUY", stop=longStopPrice)