I’m struggling to understand how to use the CancelOrder() command, I’ve looked at your other threads but I’m no further on…
I want to write a very simple breakout strategy which places a buy or sell limit order at the breakout point, but I want the limit orders to be cancelled if it is not filled within 3 bars. This is what I have so far which unfortunately doesn’t work… could you shed some light on this? Thanks
Regards
John
#region Variables
private IOrder myEntryOrder = null;
private int barNumberOfOrder = 0;
#endregion
CalculateOnBarClose = false;
}
protected override void OnBarUpdate()
{
if Rising(DonchianChannel(14).Upper) == true
&& (myEntryOrder == null)
{
myEntryOrder = EnterLongLimit(1, DonchianChannel(14).Upper[0], "");
barNumberOfOrder = CurrentBar;
}
if (CurrentBar > barNumberOfOrder + 3)
CancelOrder(myEntryOrder);
{

Comment