I am new to PRT as well as coding, I am trying to create an indicator with the below logic but the value seems to be not continuous. I feel like I am missing an obvious point, appreciate your help.
The logic behind the indicator is
Positive signal – when EMA9 crossover EMA20 while both the line being under VWMA50
Negative signal – when EMA9 crossover EMA20 while both the line being under VWMA50
The above signals are getting created accurately but I want the value to continue even when EMA9 and EMA20 crosses above VWMA50. So essentially what I am trying to do is if a positive signal occurred then show me the signal until a negative signal appears. At the moment the signal disappears when EMA9 and EMA20 crosses above VWMA50 I want the system to ignore that event and lookback the value what it was previously.
Values would look like 0000011111111111-1-1-1-1-1-1
I am not sure whether I should be using “for loop ” to get this which I’ve tried and failed.