Script di bawah ini dapat kalian gunakan untuk memunculkan stop loss dan take profit secara instan pada semua order yang ada di terminal trading.
Secara default, akan muncul stop loss dan take profit berjarak 200 pips. Kalian bisa mengubah jaraknya dengan cara mengedit scriptnya.
Berikut script mq4 yang saya beri nama: SetSLTP.mq4
/*
Script Forex dari jagovalas.blogspot.com
*/
void OnStart()
{
int sltp = 200;
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
switch(type)
{
case OP_BUY :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()-sltp*Point, OrderOpenPrice()+sltp*Point,0, Red);
break;
case OP_SELL :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()+sltp*Point, OrderOpenPrice()-sltp*Point,0, Blue);
break;
case OP_BUYSTOP :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()-sltp*Point, OrderOpenPrice()+sltp*Point,0, Red);
break;
case OP_SELLSTOP :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()+sltp*Point, OrderOpenPrice()-sltp*Point,0, Blue);
break;
}
}
}
Script Forex dari jagovalas.blogspot.com
*/
void OnStart()
{
int sltp = 200;
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
switch(type)
{
case OP_BUY :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()-sltp*Point, OrderOpenPrice()+sltp*Point,0, Red);
break;
case OP_SELL :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()+sltp*Point, OrderOpenPrice()-sltp*Point,0, Blue);
break;
case OP_BUYSTOP :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()-sltp*Point, OrderOpenPrice()+sltp*Point,0, Red);
break;
case OP_SELLSTOP :
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice()+sltp*Point, OrderOpenPrice()-sltp*Point,0, Blue);
break;
}
}
}
Cara penggunaannya bisa lihat video ini:
Komentar
Posting Komentar