My problematic code is shown. The trade is triggered when an inside bar gets it's high taken out by the following bar. This causes the issue because I have to enter when the previous high breaks meaning I am checking if there is a new high in the code but with no way of knowing if the order has been made it does it in an infinite loop on every tick until the strategy is terminated.
Is there any simple way of keeping track of orders that have hit target / stop loss or do I need to re-logic my strategy to work around this?
EDIT : Solution
Create a variable called "tradedBar" when you make a trade on a bar and want to restrict any further trades from ocurring set the tradedBar variable to CurrentBar then do a simple
if(tradedBar != CurrentBar)
and voila
Comment