Library Coding
Kumpulan contoh script dan logika penulisan coding C++
Monday, September 28, 2015
Kumpulan Contoh Logic
Hedging Mode
Keterangan
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+ int init() { if(Digits==3 || Digits==5) pt=10*Point; else pt=Point; return(0); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ int start() { static datetime w; label(); if(j(0,0)>1 && j(0,1)==0)md(0); if(j(0,0)==0 && j(0,1)>1){md(1);} //+---------- if(Close_Panic ){ if(AccountBalance()*Risk_Persen/100<=(-1)* (j(2,0)+j(2,1))){ c(0); c(1);c(4); c(5); } } //+---------- if(Tp_in_Money ){ if((j(0,0)==1 && j(0,1)==0) ||(j(0,0)==0 && j(0,1)==1)) if(AccountBalance()*TP_in_money/100<= (j(2,0)+j(2,1))){ c(0); c(1);c(4); c(5); } } if(j(0,0)+ j(0,1)==0){ if(j(0,4)==1 ||j(0,5)==1){c(4);c(5); }} //+---------- if(j(0,0)==1 ||j(0,1)==1){ if(ma(0)+Level_atas*pt
up_level){c(0);} // Ini sudah ada filter MA Level && Stockholastik Boss if(ma(0)+Level_bawah*pt>Ask && st()
0),0,Nama_EA,Magic,0,Blue); OrderSend(Symbol(),5,NR(tx),bi,3,(bi+SL*pt)*(SL>0),0,Nama_EA,Magic,0,Red);} if(si()==2 ) {OrderSend(Symbol(),1,NR(tx),Bid,3,(Bid+SL*pt)*(SL>0),0,Nama_EA,Magic,0,Red); OrderSend(Symbol(),4,NR(tx),as,3,(as-SL*pt)*(SL>0),0,Nama_EA,Magic,0,Blue);} } //+---------- if( hr()==1 && j(0,0)+ j(0,1)+j(0,2)+j(0,3)+j(0,4)+j(0,5)==1){ if(Ask
0),(Ask+TP*pt)*(TP>0),Nama_EA,Magic,0,Blue);} if(Bid>ma(0)+Level_atas*pt && j(0,1)==1) { OrderSend(Symbol(),1,NR(tx),Bid,3,(Bid+SL*pt)*(SL>0),(Bid-TP*pt)*(TP>0),Nama_EA,Magic,0,Red); }} //+---------- if(w!=Time[0]){ if(tl()==0 && j(0,2)==0 && j(0,0)
1 && j(0,1)==0 && Ask
=Ask) { OrderSend(Symbol(),0,xlot(),Ask,3,(Ask-SL*pt)*(SL>0),(Ask+TP*pt)*(TP>0),Nama_EA,Magic,0,Blue);} if(tl()==1 && j(0,3)==0 && j(0,1)
1 && j(0,0)==0 && Bid>ma(0)+Level_atas*pt && bit<=Bid) { OrderSend(Symbol(),1,xlot(),Bid,3,(Bid+SL*pt)*(SL>0),(Bid-TP*pt)*(TP>0),Nama_EA,Magic,0,Red); }w=Time[0];} return(0);}//> //+---------- double ma(int s){ return(iMA(NULL,0,Pereode,Method,MODE_SMA,PRICE_CLOSE,s));} //+---------- int si(){int a; if(Close[1]>ma(1)&& Open[1]
ma(1)&& Close[1]>ma(0)+Level_bawah*pt && Bid>ma(0)+Level_bawah*pt)a=2; return(a);}// //+---------- int tl(){ 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=j(0,0)+j(0,1); double ylot=NR(Lots*MathPow(Multiflier,m)); return(ylot);} //+---------- int hr(){ 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);} //+---------- void c(int m){ for (int i = OrdersTotal() - 1; i >= 0; i--) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber()!=Magic || OrderType()!=m) continue; if (OrderType() > 1) OrderDelete(OrderTicket()); if (OrderType() == 0) OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE); if (OrderType() == 1)OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE); }} //+---------- double j( int n,int tipe){ double t =0; for(int i=0; i
=0; i--) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic || OrderType()!=t) continue; if( OrderType()==0 ){ if( OrderTakeProfit()!=tpb && !Is(tpb, OrderTakeProfit())) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tpb,0,CLR_NONE); }} if( OrderType()==1 ){ if( OrderTakeProfit()!=tps && !Is(tps, OrderTakeProfit())) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tps,0,CLR_NONE); }}}} double pe( int tipe){ double price = 0, lot = 0; for (int ord_pos = OrdersTotal() - 1; ord_pos >= 0; ord_pos--) {Sleep(1); if (!OrderSelect(ord_pos, SELECT_BY_POS, MODE_TRADES)) continue; if (OrderSymbol() != Symbol() ) continue;if (tipe != OrderType()) continue; if (Magic == OrderMagicNumber()) { price += OrderOpenPrice() * OrderLots(); lot += OrderLots();}} if (lot > 0 ) { {price = NormalizeDouble(price / lot, Digits);} } return (price);} //fungsi stohastik double st(){ return(iStochastic(NULL,0,k_period,d_period,slowing,MODE_SMA,0,MODE_SIGNAL,0));}
Catatan
0 comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
"Join Us on Facebook!
"Join Us on Facebook!
"Join Us on Facebook!
Contact
DAFTAR ISI :
Powered by
Blogger
.
Latest Tweets
;
0 comments:
Post a Comment