Compiler errors Tradingview和Pine脚本:代码问题

Compiler errors Tradingview和Pine脚本:代码问题,compiler-errors,comments,pine-script,Compiler Errors,Comments,Pine Script,我没有编码的经验。我正在TradingView上使用一种公开可用的策略(Pine脚本v2),我想使用TradingView的自定义信号将其连接到我的3Commas机器人 我需要做的是在调用多头或空头头寸的代码行中添加注释,以便在触发警报时,它与我的bot通信 我遵循了一个在线教程和3Commas的文档。下面的注释参数是我陷入困境的地方:我一直收到“字符“{”处没有可行的替代方案”错误。它们将出现在下面的第7行和第11行: //============ signal Generator =====

我没有编码的经验。我正在TradingView上使用一种公开可用的策略(Pine脚本v2),我想使用TradingView的自定义信号将其连接到我的3Commas机器人

我需要做的是在调用多头或空头头寸的代码行中添加注释,以便在触发警报时,它与我的bot通信

我遵循了一个在线教程和3Commas的文档。下面的注释参数是我陷入困境的地方:我一直收到“字符“{”处没有可行的替代方案”错误。它们将出现在下面的第7行和第11行:

//============ signal Generator ==================================//
period = input('720')
ch1 = security(tickerid, period, open)
ch2 = security(tickerid, period, close)
longCondition = crossover(security(tickerid, period, close),security(tickerid, period, open))
if (longCondition)
    strategy.entry("BUY", strategy.long, comment="{\n\"message_type\": \"bot\",\n\"bot_id\": xxxxxxx,\n\"email_token\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n\"delay_seconds\": 0\n}")
    
shortCondition = crossunder(security(tickerid, period, close),security(tickerid, period, open))
if (shortCondition)
    strategy.entry("SELL", strategy.short, comment="{\n\"message_type\": \"bot\",\n\"bot_id\": xxxxxxx,\n\"email_token\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n\"delay_seconds\": 0,\n\"action\": \"close_at_market_price\"\n}")

如果您能帮助我修复代码,我将不胜感激。请提前感谢。

使用
Pine v4
alert\u message
参数,而不是
comment

//@version=4
strategy("My Strategy", overlay=true, margin_long=100, margin_short=100)

period = input('720')
ch1 = security(syminfo.tickerid, period, open)
ch2 = security(syminfo.tickerid, period, close)

longCondition = crossover(security(syminfo.tickerid, period, close),security(syminfo.tickerid, period, open))
shortCondition = crossunder(security(syminfo.tickerid, period, close),security(syminfo.tickerid, period, open))

if (longCondition)
    strategy.entry("BUY", strategy.long, alert_message = "{\n\"message_type\": \"bot\",\n\"bot_id\": xxxxxxx,\n\"email_token\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n\"delay_seconds\": 0\n}")
if (shortCondition)
    strategy.entry("SELL", strategy.short, alert_message = "{\n\"message_type\": \"bot\",\n\"bot_id\": xxxxxxx,\n\"email_token\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n\"delay_seconds\": 0,\n\"action\": \"close_at_market_price\"\n}")