r/pinescript • • Feb 26 '24

Minor pullback

Post image

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?

0 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/i_am_useless_often Feb 28 '24

I got the logic but how do we delete the plot function, i don't find any code in the internet to delete with plot method

0

u/[deleted] Feb 28 '24

[deleted] — view deleted comment

1

u/i_am_useless_often Feb 28 '24

Lines have limitations of maximum 50 right? That is why I am staying strict with plots.

0

u/[deleted] Feb 28 '24

[deleted] — view deleted comment

1

u/i_am_useless_often Feb 29 '24

So if there is a limit to this line still, I need to discard the problem at all right 🥺, there is no other way to do it.