[英]Pine Script Beginner - Cannot use 'plotshape' in local scope
[英]Pine Script variable scope
我正在使用內欄編寫一個簡單的策略。 我遇到的問題是,如果進入蠟燭后任何柱的高點高於內柱高點,我想取消交易。
下面的代碼片段應該希望能更好地解釋它
var short_Stop_Loss_Level = 0
if (high[0] > short_Stop_Loss_Level)
label.new(bar_index, high, style=label.style_none, text="C=" + tostring(short_Stop_Loss_Level), yloc=yloc.abovebar)
strategy.cancel_all()
Short_Condition = t and Inside_Bar
if Short_Condition
short_Stop_Loss_Level = high[0] + 0.03
label.new(bar_index, low, style=label.style_none,
text="s=" + tostring(short_Stop_Loss_Level), yloc=yloc.belowbar)
strategy.cancel_all()
// strategy.close_all()
strategy.entry("Enter", strategy.short, stop=Short_Stop_Buy_Level, qty=100)
從圖片中您可以看到停止值沒有在 if scope 之外維護,即使我已經聲明了一個全局停止變量。 我對此很陌生,也許我犯了一個我無法發現的簡單錯誤
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.