In my onbarupdate() I create the entry order when it is needed.
This updates and fires without trouble. When OnExecution() is called with the entry order it changes the variables to allow my stop and target to be placed. In the past I have had the stop and target created within the OnExecution() but because this system updates intrabar this shouldn't be an issue.
The stop and target get placed and I am now correctly sitting in the trade. As it moves my direction it will update the stop and keep the wide target in the same location. If the stop gets hit it correctly sends to the OnOrderupdate() and onexecution() and resets the system so that it can keep trading.
However for some reason unknown to me when the target is hit it will take profit as it should but then never reset. I've traced orders and added print statements to both onorderupdate() and onexecution and the targetOrder never gets sent to either.
the syntax of my orders:
targetOrder1 = ExitShortLimit(0, true, amountFilled, priceFilledAt-4, "Limit Short Exit 1", "Counter Short Entry 1"); stopOrder1 = ExitShortStop(0, true, amountFilled, shortStopLocation, "Stop Market Short Exit 1", "Counter Short Entry 1"); ------------------------------ protected override void OnExecution(IExecution execution) { if(targetOrder1 != null && targetOrder1 == execution.Order) Print("THIS IS NEVER HIT"); if(stopOrder1!= null && stopOrder1== execution.Order) Print("THIS IS HIT"); }
Comment