I am trying to save previous signals as pivots for positioning cues. I would like to save the previous 3 down arrows and previous 3 up arrows as variables for reference in a strategy.
When I save the most recent signal as the close price
> H0 = Default input[0]
I then want to save the most recent H0 as H1, but when I enter
> H1 = H0
It creates a feedback loop equivalent of
> Default input[0] = H0 = H1 = Default input[0]
How can I save the recent price of a signal without creating this infinite loop that saves all the signals as the previous close?
The picture above is supposed to show the end goal. The logic being
> H0 = Close of new sell signal
> H1 = Close of previous sell signal (This is where I am stuck because of the feedback loop of changing H0 to the close price of Default input[0])
> H2 = Close of 2nd to last sell signal
If H0 < H1, it's assigned a 2.
If H0 < H1 < H2, it's assigned a 3.
If H0 > H1, it's assigned a 1.
Comment