Selamat datang dibelajar program mql4 berbagi coding mql4 orderbuy ordersell closebuy dan closesell.
MQL4 ORDER BUY & ORDER SELL.
Scriptnya:.
////+------------------------------------------------------------------+
void BuyOrder()
{
double SL = Ask - SLbuy*Point;
if(SLbuy == 0) SL = 0;
double TP = Ask + TPbuy*Point;
if(TPbuy == 0) TP = 0;
int ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, SL, TP, "beli15", 15, 0, Blue);
}
//+------------------------------------------------------------------+
void SellOrder()
{
double SL = Bid + SLsell*Point;
if(SLsell == 0) SL = 0;
double TP = Bid - TPsell*Point;
if(TPsell == 0) TP = 0;
int ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, SL, TP, "jual30", 30, 0, Red);
}
//+------------------------------------------------------------------+
MQL4 CLOSE ORDER BUY & CLOSE ORDER SELL BERDASAR MAGIC NUMBER.
Scriptnya:.
////+------------------------------------------------------------------+
void CloseBuy()
{
for(int i = 0; i < OrdersTotal(); i++)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 15)
{
int ticket = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Blue);
}
}
}
//+------------------------------------------------------------------+
void CloseSell()
{
for(int i = 0; i < OrdersTotal(); i++)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 30)
{
int ticket = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red);
}
}
}
//+------------------------------------------------------------------+
Demikian penjelasan seputar belajar program mql4 berbagi coding mql4 orderbuy ordersell closebuy dan closesell, semoga bermanfaat.
0 comments:
Posting Komentar