//+------------------------------------------------------------------+ //| Aki0307_OrderTest004.mq4 | //| Copyright ゥ 2008, Aki0307 | //| http://aki0307.blog.shinobi.jp/ | //+------------------------------------------------------------------+ #property copyright "Copyright ゥ 2008, Aki0307" #property link "http://aki0307.blog.shinobi.jp/" // 時間足用 datetime dtTimeFrame = 0; // 処理フラグ bool flg1 = false; bool flg2 = false; bool flg3 = false; //チケット番号保存用 int ticket1 = 0; int ticket2 = 0; int ticket3 = 0; int ticket4 = 0; int ticket5 = 0; int ticket6 = 0; int ticket11 = 0; int ticket12 = 0; int ticket13 = 0; int ticket14 = 0; int ticket15 = 0; int ticket16 = 0; int ticket21 = 0; int ticket22 = 0; int ticket23 = 0; int ticket24 = 0; int ticket25 = 0; int ticket26 = 0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- // 今の時間を取得時間足に変化があると中に入る if(dtTimeFrame 0){ for(int i = total -1; i >= 0; i-- ){ bool selected = OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(selected){ int type = OrderType(); switch(type){ case OP_BUY: OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE); break; case OP_SELL: OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE); break; case OP_BUYLIMIT: case OP_BUYSTOP: case OP_SELLLIMIT: case OP_SELLSTOP: OrderDelete(OrderTicket()); break; } OrderPrint(); } } } } // 12月19日になったら、一度だけ入る if(TimeMonth(TimeCurrent()) == 12 && TimeDay(TimeCurrent()) == 19 && flg3 == false){ flg3 = true; total = OrdersTotal(); if(total > 0){ for(i = total -1; i >= 0; i-- ){ selected = OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(selected){ type = OrderType(); switch(type){ case OP_BUY: OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE); break; case OP_SELL: OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE); break; case OP_BUYLIMIT: case OP_BUYSTOP: case OP_SELLLIMIT: case OP_SELLSTOP: OrderDelete(OrderTicket()); break; } OrderPrint(); } } } } //---- return(0); } //+------------------------------------------------------------------+