本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=3
strategy("bt_heikinashi", overlay=true)
h_a = heikinashi(tickerid)
vp = input(3, "Validation Period")
c = security(h_a, period, close)
o = security(h_a, period, open)
lt = true
st = true
for i = 0 to vp-1
lt:= lt and c[i] > o[i]
st:= st and c[i] < o[i]
l = lt and c[vp] < o[vp]
s = st and c[vp] > o[vp]
strategy.entry("long", strategy.long, when=l)
strategy.entry("short", strategy.short, when=s)