Mik*_*ann 3 trading stock pine-script
我似乎无法弄清楚从交易进入的特定时间间隔退出交易的语法。任何帮助将不胜感激。
if (crossover(delta, 0))
strategy.entry("Long", strategy.long, comment="Long")
strategy.exit("Exit", "Long", when = 15)
Run Code Online (Sandbox Code Playgroud)
上面的代码我想exit在15天后建立多头头寸。但这似乎不起作用。
尝试吧自从
// Example - Buy when the price closes below 22
myEntry = close < 22
strategy.entry(id= "sample", long = strategy.long, when= myEntry)
// Close 10 bar periods after the condition that triggered the entry
strategy.close(id = "sample", when = barssince(myEntry) >= 10)
Run Code Online (Sandbox Code Playgroud)