I am trying to add to my code such that when a condition changes from false to true, this condition is maintained until some later event causes the condition to change back to false. This is to stop potential trades opening in the opposite direction to my definition of the main trend.
I have tried one menthod that changes when the event occurs, but changes back on the next bar. I cannot get it to stay 'true" for the next unknown number of bars. I think that the "while" idea may be useful, but I cannot find any snippets to help me.
Any information to point me in the productive direction would be most appreciated.
Comment