Declare global variable bool initTrade = true;
and:
int OnInit()
{
if(OrdersTotal() > 0){
if(OrderSelect(OrdersTotal()-1, SELECT_BY_POS)){
if(Minute() == TimeMinute(OrderOpenTime()) && Hour() == TimeHour(OrderOpenTime()) && Day() == TimeDay(OrderOpenTime())){
initTrade = false;
}
if(initTrade){
//Open init order logic...
}
}
}
return(INIT_SUCCEEDED);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…