首页 > 解决方案 > Pine 脚本 - “内部服务器研究错误” - TradingView

问题描述

每个人!设置时遇到“内部服务器研究错误”错误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")

提前感谢您的帮助!

标签: pine-script

解决方案


这一定是因为您在美国市场上运行策略,不允许对冲。应该适用于非美元外汇或加密货币。从refmanstrategy()看到这个:

在此处输入图像描述 在此处输入图像描述


推荐阅读