0

I am using ta.supertrend() indicator in my script which is being calculated and drawn from the start of max bars back.

Once an order is opened, I would like to reset the indicator so that it starts the calculation at the bar of order entry.

Is there a way to reset the indicator so that it starts from scratch with every order entry signal?

I've tried almost everything I could but couldn't achieve this behaviour whatsoever. I've used all sorts of conditionals, bar index, time, etc. in order to conditionally restart the indicator calculation when specific conditions are met but no luck, the script either gives a compiling error or draws weird lines on the chart.

Does anyone know how to achieve this in Pinescript?

Whatever solutions I used to reset the indicator either returned an compiling error or the supertrend drawing wasn't as it should.

  • What exactly do you mean by reset? – vitruvius Dec 11 '22 at 21:45
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 12 '22 at 18:07

0 Answers0