【发布时间】:2019-07-30 23:04:48
【问题描述】:
我尝试将脚本从 v2 迁移到 v3 PineScript。然而,事实证明,在 v3 中,相同的代码返回不同的值。这怎么可能,我做错了什么?您可以在下面找到此脚本的代码。
这就是图表上的样子 https://www.tradingview.com/x/itg3HS0T/?
Test1 - v2,绿色、灰色线条 Test2 - v3,粉色、蓝色线条
提前感谢您的帮助!:)
//@version=2
study("Test2",overlay=true)
long_timeframe = input(title="Long timeframe", type=resolution, defval="180")
short_timeframe = input(title="Long timeframe", type=resolution, defval="60")
step_shift = input(0,"Step Shift")
ha_symbol = heikinashi(tickerid)
long_ha_close = security(ha_symbol, long_timeframe, hlc3)
short_ha_close = security(ha_symbol, short_timeframe, hlc3)
long_step = ema(long_ha_close[step_shift],1)
short_step = ema(short_ha_close[step_shift],1)
plot(long_step,title="LongStep",color=white,linewidth=2,style=line)
plot(short_step,title="ShortStep",color=silver,linewidth=2,style=line)
【问题讨论】:
标签: pine-script