I would expect the following code to never allow for trades lasting more than 3 bars. That is not the case. I realize this could be done with an nbar ApplyStop but I need to do it this way to get to my final objective.
Thank you for the replies. I did try CUM unsuccessfully. I'm trying to understand why the loop never triggers the BarsInTrade > 3 Sell logic. I've debugged it to the point of finding that it's not simultaneous signals that are making this behave unexpectedly. It's when Sell1==TRUE.
My final objective with this is to add a Sell trigger when the breakout fails. In other words, I'm buying when it closes above yesterday's high. For an example, lets assume yesterday's high was 100. Once I'm in the trade, I want to sell if it closes below 100. Is this possible to code without a loop?
Thanks TrendSurfer. When I run the same Exploration there is not a single instance where Sell triggered and Sell1 did not. The fact that it worked for you makes me think it must be something in my settings. I'll keep testing.