Belajar Membuat EA Sederhana 24 (Martingel trending)
Okey bro semuanya pada kesempatan kali ini saya akan coba mengoprek ea pada part 22
Tipenya Ea martingel tapi ini sedikit berbeda dengan tipe martingel yang sudah ada yaitu martingel yang cocok untuk kondisi trending , biasanya martingel yang umumnya adalah takut terhadap kondisi trending .
Ini sebenarnya ada sedikit memenuhi permintaan dari rekan2 yang sudah 2 orang menhubungi ym dan email saya tentang ea ini.
Pada ea part 22 ini merupakan ea jebakan dimana order pertamanya mengunakan pending stop dan bila pending stop sudah tersentuh maka akan dilanjutkan dengan martingel bila ternyata mengalami floting pada jarak tertentu dan martingel nya adalah satu arah
Nah pada part 24 ini kita akan gunakan martingelnya adalah 2 arah (hedge ) dengan mengunakan pending stop.
Ordernya saya akan mengacu pada jam trending dan indikator yang sederhan yaitu candel
Karena ini ea untuk trending saya tambahkan filter untuk hari senin = notrade (DayOfWeek()!=1)
Rulenya sederhana aja
bila candel bullis maka buy dan bila floting minus pada jarak tertentu pasang sellstop
bila ternyata sellstop tersentuh maka akan pasang buystop .
Take profit mengacu pada tp in money alias pada $.
Simpel deh....!
Ini Hasilnya :
//+------------------------------------------------------------------+
//| EA Jum+SmaRt |
//| gifaesa@yahoo.com |
//| http://JumForex.blogspot.com |
//+------------------------------------------------------------------+
#property copyright "JumForex.blogspot.com"
#property link "Gifaesa@yahoo.com"
extern string SmaRt_Marti = "Trending EA";
extern string Jam_server = "Set sesuai selera";
extern int Mulai_Jam = 6;
extern int Akhir_Jam = 20;
extern bool Tp_in_Money = true;
extern double TP_in_money = 10;
extern int Max_order = 10;
extern int Jarak_stop = 15;
extern double DiMarti = 1.5;
extern int TP = 0;
extern int SL = 0;
extern double Lots = 0.1;
extern int Magic = 69;
double slb,tpb,sls,tps,pt,lslb,ltpb,slbx,tpbx,slsx,tpsx;
string Nama_EA = "Jum+SmaRt";
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
if(Digits==3 || Digits==5) pt=10*Point; else pt=Point;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
label();
if(Tp_in_Money ){
if(TP_in_money<= money(0)+money(1)){
closeall(0);
closeall(1);
closeall(4);
closeall(5);
}
}
if(jumlahorder(0)+ jumlahorder(1)==0){
if(jumlahorder(4)==1 ||jumlahorder(5)==1){
closeall(4);
closeall(5);
}
}
if(SL==0)slbx=0;else slbx=Ask-SL*pt;
if(SL==0)slsx=0;else slsx=Bid+SL*pt;
if(TP==0)tpbx=0;else tpbx=Ask+TP*pt;
if(TP==0)tpsx=0;else tpsx=Bid-TP*pt;
if(DayOfWeek()!=1 && Jam_trade()==1 && jumlahorder(0)==0 && jumlahorder(1)==0){
if(Open[1]<Close[1] ) {OrderSend(Symbol(),0,NR(Lots),Ask,3,slbx, tpbx,Nama_EA,Magic,0,Blue);}
if(Open[1]>Close[1] ) {OrderSend(Symbol(),1,NR(Lots),Bid,3,slsx, tpsx,Nama_EA,Magic,0,Red);}
}
double as=oppric()+Jarak_stop*pt;
double bi=oppric()-Jarak_stop*pt;
if(SL==0)slb=0;else slb=as-SL*pt;
if(SL==0)sls=0;else sls=bi+SL*pt;
if(TP==0)tpb=0;else tpb=as+TP*pt;
if(TP==0)tps=0;else tps=bi-TP*pt;
if(jumlahorder(0)+jumlahorder(1)>0 && jumlahorder(0)+jumlahorder(1)<Max_order){
if(opakhir()==1 && jumlahorder(4)==0 ) {OrderSend(Symbol(),OP_BUYSTOP,xlot(),as,3,slb, tpb,Nama_EA,Magic,0,Blue);}
if(opakhir()==0 && jumlahorder(5)==0 ) {OrderSend(Symbol(),OP_SELLSTOP,xlot(),bi,3,sls, tps,Nama_EA,Magic,0,Red);}
}
return(0);
}
//+------------------------------------------------------------------+
int jumlahorder( int tipe)
{
int total=0;
for(int i=0; i<OrdersTotal(); i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic || OrderType()!=tipe) continue;
total++;
}
return(total);
}
double NR(double thelot)
{
double maxlots = MarketInfo(Symbol(), MODE_MAXLOT),
minilot = MarketInfo(Symbol(), MODE_MINLOT),
lstep = MarketInfo(Symbol(), MODE_LOTSTEP);
double lots = lstep * NormalizeDouble(thelot / lstep, 0);
lots = MathMax(MathMin(maxlots, lots), minilot);
return (lots);
}
void closeall(int m)
{
for (int i = OrdersTotal() - 1; i >= 0; i--) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber()!=Magic /*|| m!= OrderType()*/) continue;
if (OrderType() == m) OrderDelete(OrderTicket());
if (OrderType() == m) OrderDelete(OrderTicket());
if (OrderType() == m) OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE);
if (OrderType() == m)OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE);
}
}
double money(int m)
{
double dp = 0;
for (int i = 0; i < OrdersTotal(); i++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber()!=Magic || m!=OrderType()) continue;
dp += OrderProfit();
}
return(dp);
}
void label()
{
Comment("\n ",
"\n ",
"\n ------------------------------------------------",
"\n :: =>+Jum+SmaRt<=",
"\n :: =>JumForex.blogspot.com<=",
"\n ------------------------------------------------",
"\n :: Spread : ", MarketInfo(Symbol(), MODE_SPREAD),
"\n :: Leverage : 1 : ", AccountLeverage(),
"\n :: Equity : ", AccountEquity(),
"\n :: Jam Server :", Hour(), ":", Minute(),
"\n ------------------------------------------------",
"\n :: Floting : ",money(0)+money(1),
"\n :: Level : ",jumlahorder(0)+jumlahorder(1),
"\n ------------------------------------------------",
"\n :: >>By: Jum69<<",
"\n ------------------------------------------------");
}
double oppric()
{
int type; double op;
for (int i = 0; i < OrdersTotal(); i++) {
if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue;
type=OrderType();
if(type==0 || type==1)op = OrderOpenPrice();
}
return(op);
}
int opakhir()
{
int type; int a;
for (int i = 0; i < OrdersTotal(); i++) {
if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue;
type=OrderType();
if(type==0 )a = 0;
if(type==1 )a = 1;
}
return(a);
}
double xlot()
{
int m=jumlahorder(0)+jumlahorder(1);
double ylot=NR(Lots*MathPow(DiMarti,m));
return(ylot);
}
int Jam_trade()
{
bool trade = false;
if(Mulai_Jam > Akhir_Jam){
if (Hour() >= Mulai_Jam || Hour() < Akhir_Jam) trade = true;
} else
if (Hour() >= Mulai_Jam && Hour() < Akhir_Jam) trade = true;
return (trade);
}
Disini tidak saya uraikan secara rinci
GPS robot tripled the $100k deposit [live proof authenticated]
ReplyDeleteI just got done with a webinar with Mark and his partner, Antony, two days ago and it was GREAT.
During the webinar MARK and ANTONY shared their secrets to success and answered questions about their new release of the GPS Forex Robot that CAME OUT TODAY!