Hi,
I have written this piece of code to add a delay between buystop orders when a buystop has just been deleted. It complies without error but it doesn't work. Any ideas?
I have written this piece of code to add a delay between buystop orders when a buystop has just been deleted. It complies without error but it doesn't work. Any ideas?
Inserted Code
// Time Delay for the next "Buy Stop" Order after buystop is deleted.
if ((type == _OP_BUY) && (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
}
}
}