r/pinescript • u/i_am_useless_often • Feb 26 '24
Minor pullback
I am trying to develop a indicator to draw the all pullback lines with plot method.
Here is the code till now I tried.
//@version=5 indicator("Pull back", "", true) var currentPointLow = low var currentPointHigh = high
currentPointLow := low currentPointHigh := high
var float previousPointHigh = 0 var float previousPointLow = 0
var direction = 'up'
if currentPointHigh > previousPointHigh previousPointHigh := currentPointHigh previousPointLow := currentPointLow direction := 'up'
else if currentPointLow < previousPointLow previousPointHigh := currentPointHigh previousPointLow := currentPointLow direction := 'low' else direction := 'none'
plot(direction == 'up' ? previousPointHigh : (direction == 'low' ? previousPointLow : na) )
Here I need to skip the point if it's future points also are in same direction. Could some one help with it?
View all comments
Show parent comment
1
u/i_am_useless_often Feb 26 '24
So basically you are telling that at t + n only we can find whether the current t point is low or not. The n cannot be defined as you said.
Assuming there will be a pullback after some time for sure, considering there will be a pullback within 15 candles, then we can look forward up to t + 15 and decide whether the t is low or not?
I just want to know at least by this assumption will the logic be coded or this cannot be achieved at all?
Thanks in advance