我想根据 high
来自 EMA 的点数设置条件 - 如果在 0-10 点内,我想绘制一个形状。
我用我在这里找到的东西 Number of pips between high and low of First Candle in Pine Script 创造了一些有用的东西(是的!)。即:
pip() => syminfo.mintick * (syminfo.type == "forex" ? 10 : 1)
closeCall = (ema - high) / pip() < 10 and (ema - high) / pip() >= 0
plotshape(closeCall)
但是,我认为让内容读起来更好一些以便它可以表示为一个函数会很有趣,也许像这样?
closeCall = ema - high < pips(10) and ema - high >= pips(0)
这是我迄今为止最接近的:
pip() => syminfo.mintick * (syminfo.type == "forex" ? 10 : 1)
pips(x,y) => (x-y) / pip()
closeCallBearish = pips(ema,high) < 10 and pips(ema,high) >= 0
这实际上并没有那么有用,哈哈。
是否有可能“改进”这一点来实现:
closeCall = ema - high < pips(10) and ema - high >= pips(0)
?