Bagi Teman-Teman Yang Mencari Script atau Coding MQL4 Buat EA Martingale Silahkan Klik dan Baca Tutorial Belajar Program MQL4 diBawah Ini!
//Coding MQL4 variable EA martingale:extern double Lotsbuy1 = 0.1;
extern int SLbuy1 = 0;
extern int TPbuy1 = 100;
extern double Jarak_Buy2dariBuy1 = -25; //=-250 pips
extern double Lotsbuy2 = 0.2;
extern int SLbuy2 = 0;
extern int TPbuy2 = 200;
extern double Jarak_Buy3dariBuy1 = -50; //=-500 pips
extern double Lotsbuy3 = 0.4;
extern int SLbuy3 = 0;
extern int TPbuy3 = 400;
void OnTick()
{
LabelInfoAkun();
//coding untuk memanggil fungsi untuk menampilkan teks digrafik
CekOpenOrderProfit();
CekOpenOrderProfit3();
if(OrdersTotal()==0) //logic EA buy jika jumlah order nol
{
BuyOrder(); //coding untuk memanggil fungsi transaksi buy
}
}
//+------------------------------------------------------------------+
//Coding MQL4 Fungsi Cek Open Order Profit EA Martingale:void CekOpenOrderProfit()
{
double profit = 0;
for(int i=OrdersTotal()-1; i >= 0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if(OrderType() == OP_BUY
&& OrderSymbol() == Symbol()
&& OrderMagicNumber() == 1)
{
profit += OrderProfit();
}
}
}
if(profit < Jarak_Buy2dariBuy1)
{
BuyOrderMartingale();
}
}
//+------------------------------------------------------------------+
void BuyOrderMartingale()
{
bool exists = false;
for(int i=OrdersTotal()-1; i >= 0; i--)
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if(OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 2)
{
exists = true;
}
}
if(exists == false)
{
int ticket = OrderSend(Symbol(),OP_BUY,Lotsbuy2,Ask,4,0,Ask+TPbuy2*Point,"beli2",2,0,Blue);
}
}
//+------------------------------------------------------------------+
{
double profit = 0;
for(int i=OrdersTotal()-1; i >= 0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if(OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
profit += OrderProfit();
}
}
}
if(profit < Jarak_Buy3dariBuy1)
{
BuyOrderMartingale3();
}
}
//+------------------------------------------------------------------+
void BuyOrderMartingale3() {
bool exists = false;
for(int i=OrdersTotal()-1; i >= 0; i--)
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if(OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 3)
{
exists = true;
}
}
if(exists == false)
{
int ticket = OrderSend(Symbol(),OP_BUY,Lotsbuy3,Ask,4,0,Ask+TPbuy3*Point,"beli3",3,0,Blue);
}
}
//+------------------------------------------------------------------+/
//void LabelInfoAkun()
{
Comment("\n"
"\nBalance: ", DoubleToStr(AccountBalance(),2),
"\nEquity: ", DoubleToStr(AccountEquity(),2),
"\nProfit: ", DoubleToStr(AccountProfit(),2));
}
Semoga Bermanfaat dan Kalau Ada Pertanyaan Terkait Dengan Coding MQL4 Buat EA Martingale, Tulis diKolom Komentar atau Hubungi ke Kontak Kami!
0 comments:
Posting Komentar