Script MQL4 EA OP Pada Jam Tertentu

Belajar Program MQL4, Script MQL4 EA Supaya Dapat OP Buy Sell Pada Jam Tertentu.
//
//+------------------------------------------------------------------+
//|                                EA BUY SELL PADA JAM TERTENTU.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright @ Sonny"
#property link      ""
#property version   "1.00"
#property strict

extern double Lot = 0.1;
extern int SL     = 200;
extern int TP     = 300;

double NilaiPip, SLBUY,TPBUY,SLSELL,TPSELL;

string TeksBuy = "Robot Buy";
string TeksSell = "Robot Sell";

int Magic_Number = 777;

datetime JamCandle;
 
//
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   if(Digits==3 || Digits==5) NilaiPip = 1*Point; else  NilaiPip = Point;
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  
  }
//+------------------------------------------------------------------+
 
//
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(SL==0)SLBUY=0; else SLBUY=Ask-SL*NilaiPip;
   if(TP==0)TPBUY=0; else TPBUY=Ask+TP*NilaiPip;
   
   if(SL==0)SLSELL=0; else SLSELL=Bid+SL*NilaiPip;
   if(TP==0)TPSELL=0; else TPSELL=Bid-TP*NilaiPip;
   
   if(Hour()==2 && Minute()==15)
   {
   datetime JamCandleShift0 = iTime(Symbol(),NULL,0);
   if(JamCandle!=JamCandleShift0)
    {
      if(jumlahbuysell(0)==0)
     {
    int ticket = OrderSend(Symbol(),OP_BUY,Lot,Ask,4,SLBUY,TPBUY,TeksBuy,0,Magic_Number,Blue);
     }
   if(jumlahbuysell(1)==0)
     {
  int ticket = OrderSend(Symbol(),OP_SELL,Lot,Bid,4,SLSELL,TPSELL,TeksSell,0,Magic_Number,Red);
     }
    JamCandle=JamCandleShift0;
    }
   } 
  }
//+------------------------------------------------------------------+
 
//
//+------------------------------------------------------------------+
int jumlahbuysell(int type)
  {
   int hasilnya = 0;
for(int jumlahorderawal=0; jumlahorderawal<OrdersTotal(); jumlahorderawal++)
     {
      if(!OrderSelect(jumlahorderawal,SELECT_BY_POS,MODE_TRADES))
         continue;
      if(OrderSymbol()!=Symbol()
         || OrderMagicNumber()!=Magic_Number
         || OrderType()!=type)
         continue;
      hasilnya++;
     }
   return(hasilnya);
  }
//+------------------------------------------------------------------+

Demikian Share Belajar Program MQL4 Script MQL4 Supaya EA Dapat Transaksi Buy dan Sell Pada Jam Tertentu, Semoga Bermanfaat.
Bagikan:

0 komentar:


CIMB Niaga, 7603 6767 7300, Arsis W | axxxxske-stsuxxxxxxxxx*#*$
OCBC NISP, 634130601924, C G Widi | suxxkamb_mnG0#M4sF40zY(35 kab & kota di JaTeng
BRI, 6440-01-001908-53-8, St S | 94jy0CWep1
Hosting PompaSubmersible.com (IdWeb) Masih Tersedia Fasilitas 4 AddOn Domain
Submersible-submersi-Solo-mnG0#M4sF40zY(


Products Overseas

Hosting Luar Negeri: BlueHost
MAU DAFTAR FOREX?
Buka Formulirnya Klik Disini!
Baca Panduannya Klik Disini!