CONTOH SCRIPT
Scrip_EA_MACD&CCI
Scrip_EA_MACD dengan Modifikasi harga
Scrip EA MACD Simple
Tunggu untuk scrip
yang lain
masih dalam
penulisan
MA'AF UNTUK ROBOT INI BAYAR,
KARENA SUDAH TERUJI ! !! ! !
ROBOT FOREX MERAPI
1.0
FREE UP DATE
dan
ROBOT FOREX
MERAPI MULTI PAIR
TEMPLATE SCRIP EA "MACD & CCI"
EA MACD & CCI
Cara kerja EA ini sebenarnya sederhana, EA akan membuka
sebuah harga dengan menggunakan filer 2 indikator yaitu MACD dan CCI.
Pada EA ini semakin tinggi Time Frame nya semakin tinggi
pula akurasi dari kedua filter indikator tersebut.
Kelemahan dari EA ini adalah belum ada modifikasi
harganya, anda bisa menambahkan scrip modifikasi harga untuk menyempurkan EA
ini.
anda juga bisa ber explorasi dengan mencoba untuk
menentukan besaran indikatornya agar anda dapat mendapatkan profit yang
maksimal versi anda sendiri
ini kami sajikan scrip template nya.
//+------------------------------------------------------------------+
//| MACD & CCI .mq4 |
//| Copyright © 2011-2012, baguswidyantoro |
//| http://baguswidyantoro.t35.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, isikan nama anda disni"
#property link "http://isikan website anda disini"
#include <stdlib.mqh>
#include <stderror.mqh>
#define MAGICMA 20050610
//---- input parameters
extern int FMa=4; // Fast MA
extern int SMa=8; // Slow MA
extern int PCCi=4; // CCI Period
extern int pATR=4; // ATR Period for S/L
extern double Lots=0.1; // Lot
extern bool SndMl=true; // E-mail Sending Parameter
extern double DcF = 3; // Optimization Factor
extern double MaxR = 0.02; // Maximum Risk
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int CalculateCurrentOrders(string symbol)
{
int buys=0,sells=0;
//----
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
break;
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
{
if(OrderType()==OP_BUY)
buys++;
if(OrderType()==OP_SELL)
sells++;
}
}
//---- return orders volume
if(buys>0)
return(buys);
else
return(-sells);
}
void CheckForOpen()
{
double mas;
double maf;
double mas_p;
double maf_p;
double Atr;
double icc;
double icc_p;
int res;
string sHeaderLetter;
string sBodyLetter;
//---- trading will be started with first tick of new bar only
if(Volume[0]>1) return;
//---- define Moving Average
mas=iMA(NULL,0,SMa,0,MODE_SMA,PRICE_CLOSE,1); // Slow MA shifted on 1 Period
maf=iMA(NULL,0,FMa,0,MODE_SMA,PRICE_CLOSE,1); // Fast MA shifted on 1 Period
mas_p=iMA(NULL,0,SMa,0,MODE_SMA,PRICE_CLOSE,2); // Slow MA shifted on 2 Period
maf_p=iMA(NULL,0,FMa,0,MODE_SMA,PRICE_CLOSE,2); // Fast MA shifted on 2 Period
Atr = iATR(NULL,0,pATR,0);
icc = iCCI(NULL,0,PCCi,PRICE_CLOSE,1); // CCI shifted on 1 Period
icc_p = iCCI(NULL,0,PCCi,PRICE_CLOSE,2); // CCI shifted on 2 Period
//---- check for open sell order
if ( (maf<mas && maf_p>=mas_p)&&(icc<0 && icc_p >=0 ))
{
res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,Ask+Atr,0,"",MAGICMA,0,Red);
if (SndMl == True && res != -1)
{
sHeaderLetter = "Operation SELL by " + Symbol()+"";
sBodyLetter = "Order Sell by "+ Symbol() + " at " + DoubleToStr(Bid,4)+ ", and set stop/loss at " + DoubleToStr(Ask+Atr,4)+"";
sndMessage(sHeaderLetter, sBodyLetter);
}
return;
}
//---- check for open buy order
if ((maf>mas && maf_p<=mas_p)&& (icc > 0 && icc_p <=0 ))
{
res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,Bid-Atr,0,"",MAGICMA,0,Blue);
if ( SndMl == True && res != -1)
{
sHeaderLetter = "Operation BUY at " + Symbol()+"";
sBodyLetter = "Order Buy at "+ Symbol() + " for " + DoubleToStr(Ask,4)+ ", and set stop/loss at " + DoubleToStr(Bid-Atr,4)+"";
sndMessage(sHeaderLetter, sBodyLetter);
}
return;
}
}
void CheckForClose()
{
double mas;
double maf;
double mas_p;
double maf_p;
string sHeaderLetter;
string sBodyLetter;
bool CloseOrd;
//----
if(Volume[0]>1) return;
//----
mas=iMA(NULL,0,SMa,0,MODE_SMA,PRICE_CLOSE,1); // Slow MA shifted on 1 Period
maf=iMA(NULL,0,FMa,0,MODE_SMA,PRICE_CLOSE,1); // Fast MA shifted on 1 Period
mas_p=iMA(NULL,0,SMa,0,MODE_SMA,PRICE_CLOSE,2); // Slow MA shifted on 2 Period
maf_p=iMA(NULL,0,FMa,0,MODE_SMA,PRICE_CLOSE,2); // Fast MA shifted on 2 Period
//----
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=MAGICMA || OrderSymbol()!=Symbol()) continue;
//----
if(OrderType()==OP_BUY)
{
if(maf<mas && maf_p>=mas_p) CloseOrd=OrderClose(OrderTicket(),OrderLots(),Bid,3,Lime);
if ( SndMl == True && CloseOrd == True)
{
sHeaderLetter = "Operation CLOSE BUY at" + Symbol()+"";
sBodyLetter = "Close order Buy at "+ Symbol() + " for " + DoubleToStr(Bid,4)+ ", and finish this Trade";
sndMessage(sHeaderLetter, sBodyLetter);
}
break;
}
if(OrderType()==OP_SELL)
{
if(maf>mas && maf_p<=mas_p) OrderClose(OrderTicket(),OrderLots(),Ask,3,Lime);
if ( SndMl == True && CloseOrd == True)
{
sHeaderLetter = "Operation CLOSE SELL at" + Symbol()+"";
sBodyLetter = "Close order Sell at "+ Symbol() + " for " + DoubleToStr(Ask,4)+ ", and finish this Trade";
sndMessage(sHeaderLetter, sBodyLetter);
}
break;
}
}
}
//+------------------------------------------------------------------+
//| Optimized Lot Value Calculation |
//+------------------------------------------------------------------+
double LotsOptimized()
{
double lot=Lots;
int orders=HistoryTotal(); // history orders total
int losses=0; // number of losses orders without a break
//---- select lot size
lot=NormalizeDouble(AccountFreeMargin()*MaxR/1000.0,1);
//---- calcuulate number of losses orders without a break
if(DcF>0)
{
for(int i=orders-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Ошибка в истории!"); break; }
if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
//----
if(OrderProfit()>0) break;
if(OrderProfit()<0) losses++;
}
if(losses>1) lot=NormalizeDouble(lot-lot*losses/DcF,1);
}
//---- return lot size
if(lot<0.1) lot=0.1;
return(lot);
}
//-------------------------------------------------------------------+
// Send e-mail message function |
//-------------------------------------------------------------------+
void sndMessage(string HeaderLetter, string BodyLetter)
{
int RetVal;
SendMail( HeaderLetter, BodyLetter );
RetVal = GetLastError();
if (RetVal!= ERR_NO_MQLERROR) Print ("Ошибка, сообщение не отправлено: ", ErrorDescription(RetVal));
}
//+------------------------------------------------------------------+
//| Expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(Bars<25 || IsTradeAllowed()==false) return;
//---- calculate open orders by current symbol
if(CalculateCurrentOrders(Symbol())==0) CheckForOpen();
else CheckForClose();
//----
return(0);
}
//+------------------------------------------------------------------+
Simpan scrip yang telah anda buat tersebut, coba / tes dahulu robot yang
telah anda buat dan gunakan pada Demo acaunt.
Selamat Mencoba ...............
Solusi bagi anda yang memiliki kesibukan :
Apabila anda tidak punya waktu untuk
membuat Robot Forex sendiri, jangan khawatir sudah kami buatkan
robot yang sudah teruji, anda cukup mengganti biaya pembuatan robot
hanya sebesar $ 20,-
ROBOT MERAPI 1.0
Free Up Date DAN
ROBOT MERAPI MULTI PAIR