Reputation: 133
I am new in pine script and trying to write a script. I want to check
So far I have written the below script but I am stuck in it.
//@version=4
study("Momentum Candle",shorttitle="Momentum_Candles_80_Percent", overlay=true)
body = abs(close-open)
rng=high-low
strongRed = body/rng>=0.80 and open > close and
plotchar(strongRed,location=location.belowbar,color=color.blue)
Upvotes: 1
Views: 560
Reputation: 122
you have to use [] brackets
to select the specific candle, provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical. Floats will be rounded down. expr1\[expr2\]
//@version=4
study("Momentum Candle",shorttitle="Momentum_Candles_80_Percent", overlay=true)
body = abs(close-open)
rng=high-low
strongRed = body/rng>=0.80 and open > close[1] and
open > close[2] and
open > open[1] and
open > open[2] and
close < close[1] and
close < close[2] and
close < open[1] and
close < open[2] or
open < close[1] and
open < close[2] and
open < open[1] and
open < open[2] and
close > close[1] and
close > close[2] and
close > open[1] and
close > open[2]
plotchar(strongRed,location=location.belowbar,color=color.blue)
Upvotes: 0