繁体   English   中英

Tradingview Pinescript strategy.close() strategy.exit() 合并问题

[英]Tradingview Pinescript strategy.close() strategy.exit() coemment problem

我打算调整 Tradingview 上的策略,以使用警报 (tradingview) 与机器人一起工作。

我的问题是 strategy.close 和 strategy.exit 中的注释必须相同

当strategy.close的条件满足时,脚本是否有可能自动从strategy.exit中获取评论?

非常感谢您的帮助,祝您一切顺利!

/ === STRATEGY - LONG POSITION EXECUTION ===
strategy.entry(id = "Buy", long = true, when = buy[shunt]==1, comment = "ENTER-LONG_BINANCE-FUTURES_ETHBUSD_ETH_30M_9c621" )

strategy.close(id = "Buy", when = direction[shunt]!=direction[shunt+1], comment = "EXIT-LONG_BINANCE-FUTURES_ETHBUSD_ETH_30M_9c21")

// === STRATEGY - SHORT POSITION EXECUTION ===
strategy.entry(id = "Sell", long = false, when = sell[shunt]==1, comment = "ENTER-SHORT_BINANCE-FUTURES_ETHBUSD_ETH_30M_9c621")

strategy.close(id = "Sell", when = direction[shunt]!=direction[shunt+1], comment = "EXIT-SHORT_BINANCE-FUTURES_ETHBUSD_ETH_30M_9c621")

// === STRATEGY RISK MANAGEMENT EXECUTION ===
strategy.exit("Exit Buy", from_entry = "Buy", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset, comment = "EXIT-LONG_BINANCE-FUTURES_ETHBUSD_ETH_30M_9c6c021")

strategy.exit("Exit Sell", from_entry = "Sell", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset, comment = "EXIT-SHORT_BINANCE-FUTURES_ETHBUSD_ETH_30M_9c6c021")

错误

9:23:54 AM — Compilation error. Line 194: Cannot call `strategy.close` with arguments (literal__string, fun_call__operator !=, literal__string); available overloads: strategy.close(literal__string, series__bool) => void;
line 198: Cannot call `strategy.close` with arguments (literal__string, fun_call__operator !=, literal__string); available overloads: strategy.close(literal__string, series__bool) => void

当strategy.close的条件满足时,脚本是否有可能自动从strategy.exit中获取评论?

非常感谢您的帮助,祝您一切顺利!

你的问题不是来自评论。
您可以使用相同的注释,没问题。
您的错误来自:

 when = direction[shunt]!=direction[shunt+1]

在您的 strategy.close 订单中。 请更新到 pinescript v5,不要在你的 strategy.close 中使用“when”,而是将你的 strategy.close 放在“if”块中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM