如何解决止损单不会触发 Pine Script
我正在调试我的松树脚本,所以我在每根蜡烛上贴上标签来跟踪目标和停止报价,但由于某种原因止损不会触发
float targetLTick = na
float stopLTick = na
if(longCondition)
strategy.entry("Long Buy",true,1,comment ="Long Buy \n" + "Target is " + tostring(targetLR) + "\n" + "StopLoss is " + tostring(stopLR))
//label.new(bar_index,high,color = color.white)
if(longCondition and strategy.position_size == 0)
//average_long = close
targetLTick := (targetLR - close) / syminfo.mintick
stopLTick := (close - stopLR) / syminfo.mintick
label.new(x= bar_index,y= high,text = "Target ticks = " + tostring(targetLTick) +"\n"+" Stoploss ticks = " + tostring(stopLTick),textcolor = color.white)
if(strategy.position_size > 0)
targetLTick := targetLTick[1]
stopLTick := stopLTick[1]
label.new(x= bar_index,text =tostring(targetLTick) +"\n"+ tostring(stopLTick),textcolor = color.white)
strategy.exit("Long Buy",profit = targetLTick,comment = "Take Profit")
strategy.exit("Long Buy",stop = stopLTick,comment = "Book Loss")
strategy.close_all(when = closing_Bell,comment = "Closing Bell")
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。