Code untuk membuat EA memiliki masa aktif
- Dapatkan gratis robot forex TraderSharing Di sini
Baca pelan-pelan agar mudah di pahami,karena ketiga code di bawah berbeda penempatanya:
code pertama :
int wt,tiket, ape,accnt;
kemudian code kedua masukan perintah ini di atas triger perintah OP
datetime expirydate = D'2019.04.19 00:00';
(2019 adalah tahun,04 adalah bulan,19 adalah tanggal,00:00 adalah jam)
perhatikan saat copy paste,jangan sampai ketinggalan code penutupnya yaitu ';
kemudian code ketigamasukan code ini setelah perintah buy/sell
TimeCurrent()< expirydate &&
CONTOH
.//+------------------------------------------------------------------+
//| tradersharing.com.mq4 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright Tradersharing comunity."
#property link "https://www.tradersharing.com"
#property version "1.00"
#property strict
input string Masukan Nama EA ="";
input string Website = "www.tradersharing.com";
input string Contact = "admin@tradersharing.com";
input string blog ="boronglagi.blogspot.com";
int wt,tiket, ape,accnt; //---code pertama masukan di sini
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//---code kedua di sini sebelum triger perintah OP
datetime expirydate = D'2019.04.19 00:00';
if(jumlahorder(0)==0 && jumlahorder(1)==0 && TimeCurrent()< expirydate && //---code ketiga di sini sebelum triger perintah OP buy
{tiket=OrderSend(Symbol(),OP_BUY,TSC_Open,Ask,3,slbx,tpbx,"TraderSharing"777,0,Green);}
if(jumlahorder(1)==0 && jumlahorder(0)==0 && TimeCurrent()< expirydate && //---code ketiga di sini sebelum triger perintah OP sell
{tiket=OrderSend(Symbol(),OP_SELL,TSC_Open,Bid,3,slsx,tpsx,"TraderSharing",777,0,Red);}}
}
//+------------------------------------------------------------------+
Atau bisa menggunakan code ://| tradersharing.com.mq4 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright Tradersharing comunity."
#property link "https://www.tradersharing.com"
#property version "1.00"
#property strict
input string Masukan Nama EA ="";
input string Website = "www.tradersharing.com";
input string Contact = "admin@tradersharing.com";
input string blog ="boronglagi.blogspot.com";
int wt,tiket, ape,accnt; //---code pertama masukan di sini
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//---code kedua di sini sebelum triger perintah OP
datetime expirydate = D'2019.04.19 00:00';
if(jumlahorder(0)==0 && jumlahorder(1)==0 && TimeCurrent()< expirydate && //---code ketiga di sini sebelum triger perintah OP buy
{tiket=OrderSend(Symbol(),OP_BUY,TSC_Open,Ask,3,slbx,tpbx,"TraderSharing"777,0,Green);}
if(jumlahorder(1)==0 && jumlahorder(0)==0 && TimeCurrent()< expirydate && //---code ketiga di sini sebelum triger perintah OP sell
{tiket=OrderSend(Symbol(),OP_SELL,TSC_Open,Bid,3,slsx,tpsx,"TraderSharing",777,0,Red);}}
}
//+------------------------------------------------------------------+
string batas = "2013.4.3 00:00";
int tt = StrToTime(batas);
if (TimeCurrent() > tt) {
Alert(" Maaf EA habis kontrak bro");
return(0);
}
& Home Trader