- Buka MT4.
- Tekan Tombol F4 diPapan Keyboard.
- Tekan Tombol Ctrl + Huruf N diPapan Keyboard.
- Checklist Lingkaran Script dan Klik Next.
- Kolom Name ketik dengan Script\Script Delete Pending Order.
- Kolom Author ketik dengan Nama Kalian.
- Kolom Link ketik dengan URL website kalian terus klik Next.
- Klik Next Lagi.
- Klik Finish.
#property version "1.00"
#property strict
#property show_inputs
enum ENUM_ORDER_TYPES
{
SEMUA_ORDERS=1,
HANYA_BUY_STOP=2,
HANYA_BUY_LIMIT=3,
HANYA_SELL_STOP=4,
HANYA_SELL_LIMIT=5
};
input bool OnlyCurrentSymbol=false; //HAPUS PO DI'CHART
input ENUM_ORDER_TYPES OrderTypeFilter=SEMUA_ORDERS; //HAPUS PO
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnStart()
{
DeletePendingOrders(); //coding untuk memanggil fungsi delete pending order
}
//+------------------------------------------------------------------+
//|fungsi delete pending order |
//+------------------------------------------------------------------+
void DeletePendingOrders()
{
for(int i=(OrdersTotal()-1); i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
{
Print("Pending Order Gagal diPilih - Error ",GetLastError());
break;
}
if(OrderTypeFilter==HANYA_SELL_LIMIT && OrderType()!=OP_SELLLIMIT)
continue;
if(OrderTypeFilter==HANYA_SELL_STOP && OrderType()!=OP_SELLSTOP)
continue;
if(OrderTypeFilter==HANYA_BUY_LIMIT && OrderType()!=OP_BUYLIMIT)
continue;
if(OrderTypeFilter==HANYA_BUY_STOP && OrderType()!=OP_BUYSTOP)
continue;
if(OnlyCurrentSymbol && OrderSymbol()!=Symbol())
continue;
bool result=false;
if(OrderType()==OP_BUYLIMIT || OrderType()==OP_BUYSTOP || OrderType()==OP_SELLLIMIT || OrderType()==OP_SELLSTOP)
{
result=OrderDelete(OrderTicket());
}
if(result==false)
Print("ERROR - Pending Order Yang Gagal diHapus - ",OrderTicket()," - ",GetLastError());
Sleep(0);
}
}
//+------------------------------------------------------------------+
0 comments:
Posting Komentar