【发布时间】:2020-05-16 22:51:35
【问题描述】:
当 percentR 超过 -20 和交叉 -80 但我的“何时”条件不起作用时,我想做多和做空
strategy("Williams %R", shorttitle="%R", format=format.price, precision=2)
length = input(title="Length", type=input.integer, defval=14)
_pr(length) =>
max = highest(length)
min = lowest(length)
100 * (close - max) / (max - min)
percentR = _pr(length)
strategy.entry("buy", strategy.long, comment="buy", when=crossover(percentR, -20))
strategy.entry("sell", strategy.short, comment="sell", when=crossunder(percentR, -80))
【问题讨论】:
标签: pine-script