exit_price = Open[0] - TickSize;
exit_order_id = generate_tag(0) + "_exit";
exit_order = ExitLongLimit(exit_price, entry_order_id);
As you can see, this code should pretty much always get the fill since it is exiting at a one tick premium to the market. However, the trade sometimes does not execute on the chart for the back-test until about 3 bars after it should. Any reason for this or have I just made a coding error? I would use market orders but that significantly throws off the back-test results. If it makes any difference, all of the variables used above have been declared earlier in the strategy which is why i don't have it written as "string exit_order_id = " and so forth.

Comment