Hi,
I am trying to add a delay after a buystop order has been deleted. I have writen the code below and although it compiles ok, it doesn't work.
Can anyone see what I am doing wrong or give me the line of code that will work for this.
thanks
Code:
// Time Delay for the next "Buy Stop" Order after buystop is deleted.
if (MayOpenDeferOrder && NextBuyStop_Order_Minutes !=0)//Time Delay for the next Buy Stop Order
{
int ordersHistoryTotal = OrdersHistoryTotal();
for (int o=ordersHistoryTotal;o<=0;o--) //Count down until it hits the total trades in history
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) //Getting all historical trades
if ((Symbol() == OrderSymbol()) && (OrderComment() == "Buy Stop Deleted.")) continue;
// "Buy Stop Deleted." is the user comment
//added when a buystop order is deleted.
{
if(((TimeCurrent() - OrderOpenTime())/60) < NextBuyStop_Order_Minutes) MayOpenDeferOrder = false;
break; //MayOpenDeferOrder==BuyStop Order
}
}
}