[英]Is there a way to detect the price of a candle +/- a certain % from the open or close?
I'm trying to detect bullish/bearish engulfing candles with a bit of wiggle room on either side, as there are sometimes small discrepancies in the price(s).我试图检测看涨/看跌吞没蜡烛,两边都有一点摆动空间,因为价格有时会出现小的差异。 I'd like to detect an engulfing even if the candle open/close is say +/-.01% from the previous open/close.
即使蜡烛打开/关闭与之前的打开/关闭相比 +/-.01%,我也想检测到吞没。
//identify bullish/bearish engulfing candles
bullishEC = close > open[1] and open <= close[1] and close[1] < open[1]
bearishEC = close < open[1] and open >= close[1] and close[1] > open[1]
You can multiply the open[1] and close[1] with required price percentage and then compare.您可以将 open[1] 和 close[1] 乘以所需的价格百分比,然后进行比较。 Example
例子
bullishEC = close > open[1]*(1-0.01/100) and open <= close[1]*(1+0.01/100) and close[1] < open[1]
bearishEC = close < open[1]*(1+0.01/100) and open >= close[1]*(1-0.01/100) and close[1] > open[1]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.