EA ปิดตามเวลาได้แล้ว แต่อยากเปลี่ยนเป็นปิดออเดอร์ทุกๆ 1 ชั่วโมงครับ ต้องแก้ยังไงครับ
//+------------------------------------------------------------------+
extern string ClosehourConfig = "Close Order ALL Time";
extern int CloseHour = 02;
extern int CloseMinute = 01;
extern bool UseCurrSymbol = False;
int Slippage = 3;
extern color clCloseBuy = Blue;
extern color clCloseSell = Red;
//+------------------------------------------------------------------+
int start() {
//+------------------------------------------------------------------+
double pBid, pAsk;
if (Hour()==CloseHour && Minute()==CloseMinute) {
for (int k=OrdersTotal()-1; k>=0; k--) {
if (OrderSelect(k, SELECT_BY_POS, MODE_TRADES)) {
if (!UseCurrSymbol || OrderSymbol()==Symbol()) {
if (OrderType()==OP_BUY) {
pBid=MarketInfo(OrderSymbol(), MODE_BID);
OrderClose(OrderTicket(), OrderLots(), pBid, Slippage, clCloseBuy);
}
if (OrderType()==OP_SELL) {
pAsk=MarketInfo(OrderSymbol(), MODE_ASK);
OrderClose(OrderTicket(), OrderLots(), pAsk, Slippage, clCloseSell);
}
}
}
}
return(60);
}
}
//+------------------------------------------------------------------+