大家!设置strategy(close_entries_rule= "ANY")
并尝试使用strategy.close(id= "EL 2")
平仓时,我遇到错误“内部服务器学习错误” 。
以下来自 kodify.net 的代码似乎对文章作者有效,但是当我复制并保存在TradingView Pine编辑器中时,它给我“内部服务器学习错误”
strategy(title="Exit from specific entries", overlay=true,
pyramiding=2, close_entries_rule="ANY")
// Determine trading conditions
newDay = (dayofmonth != dayofmonth[1])
firstEntry = newDay and (dayofweek == dayofweek.monday)
secondEntry = newDay and (dayofweek == dayofweek.tuesday)
firstExit = newDay and (dayofweek == dayofweek.thursday)
secondExit = newDay and (dayofweek == dayofweek.friday)
// Submit entry orders
if (firstEntry)
strategy.entry(id="EL 1", long=true)
if (secondEntry)
strategy.entry(id="EL 2", long=true)
// Generate exit orders
if (firstExit)
strategy.close(id="EL 2")
if (secondExit)
strategy.close(id="EL 1")
在此先感谢您的帮助!