【发布时间】:2018-09-29 10:59:37
【问题描述】:
谁能帮我将妈妈策略松树脚本代码转换为警报? 代码如下:
//@version=3
strategy("Momentum Strategy", overlay=true)
length = input(12)
price = close
momentum(seria, length) =>
mom = seria - seria[length]
mom
mom0 = momentum(price, length)
mom1 = momentum(mom0, 1)
if (mom0 > 0 and mom1 > 0)
stop_price = high+syminfo.mintick
strategy.entry("MomLE", strategy.long, stop=stop_price, comment="MomLE", qty=2)
else
strategy.cancel("MomLE")
if (mom0 < 0 and mom1 < 0)
stop_price = low - syminfo.mintick
strategy.entry("MomSE", strategy.short, stop=stop_price, comment="MomSE", qty=2)
else
strategy.cancel("MomSE")
【问题讨论】:
-
看看
alertcondition()函数。 -
我写了一篇关于the
alertcondition()function的深入文章。它可能有助于更好地理解如何编写警报条件。
标签: finance pine-script