I need your assistance with an exit strategy. I am looking to exit a short position after the 2nd green bar closes above a moving average. If a bar a red bar closes below the moving average after the first green bar closes above it, I want it to start counting again.
ie:
scenario 1:
green bar closes above MA - that's 1
next bar is also green and closes above the MA -that's 2
exit position
scenario 2:
green bar closes above MA - that's 1
next bar is red and closes below the MA - reset count
green bar closes above MA - that's 1
next bar is red but closes above the MA - count is still at 1
next bar is green and closes above the MA -that's 2
exit position
I know arrays and possibly the intseries class are involved but I am not sure how to apply them and reset the count. Any thoughts?
Thanks,
Casey
Comment