Tuesday 18 September 2012

EA Generator Online - sufx.core.t3-ism.net

http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/



Strategy

  •  
This 'Template' is used to export MQL file. Expert Advisor Builder replaces Template Tags({foo}) with MQL codes.
Templage Tags
{EachTickMode}: SignalMode('True' or 'False')
{Lots}: Lots(ex. '1.0')
{Slippage}: Pip(s) of Slippage(ex. '3')
{UseStopLoss}: Enable/Disable StopLoss('True' or 'False')
{StopLoss}: Pip(s) of StopLoss(ex. '30')
{UseTakeProfit}: Enable/Disable TakeProfit('True' or 'False')
{TakeProfit}: Pip(s) of TakeProfit(ex. '60')
{UseTrailingStop}: Enable/Disable TrailingStop('True' or 'False')
{TrailingStop}: Pip(s) of TrailingStop(ex. '30')
{Var}: Definion of 'Variables'
{VarBuy}: Definition of Variables for 'Buy logics'
{VarSell}: Definition of Variables for 'Sell logics'
{VarCloseBuy}: Definition of Variables for 'Close(Buy) logics'
{VarCloseSell}: Definition of Variables for 'Close(Sell) logics'
{SignalBuy}: Conditional operator for 'Buy logics'
{SignalSell}: Conditional operator for 'Sell logics'
{SignalCloseBuy}: Conditional operator for 'Close(Buy) logics'
{SignalCloseSell}: Conditional operator for 'Close(Sell) logics'

EA Generator Online - forexeadvisor.com

http://www.forexeadvisor.com/expert_generator.aspx


Welcome to the Expert Advisor Generator

Forex marketThe forex market is one of the most dynamic markets on the planet. Unfortuatelly 95% of the traders loose their money. This is mainly because they don't have good tested trading strategy.
On the other hand having a strategy, means that you have clear rules about every market situation. And when the rules are clear this trading system can be automated. There are many advantages for the automated systems like - 24 hours trading, reaction speed,monitoring huge numbers of financial instruments in different timeframes, the ability to backtest the system and many others.
Automating a trading system is difficult because it requires program skills which most of the traders don't have. With this Expert Advisor builder such skills are no longer needed.
In our big experience creating automated trading systems, we have found that usually simple things work. With every rule you add , you optimize your results in the past, but this will give you worst results in the future.So our advice is - keep things simple.
Now lets create simple trading system for example.To begin we need four basic things :
  1. When to open long position?
  2. When to close long position?
  3. When to open short position?
  4. When to close short position?
Lets say we have this basic strategy:
  1. We open long position when Rsi (Relative Strength Index) crosses 30.
  2. We open short position when Rsi (Relative Strength Index) crosses 70.
  3. We don't have exit rules , we have 50 points of StopLoss and 50 points of Takeprofit.
Now we need to open the first tab Open Buy and we choose this :
Open Buy Order
This basically means this if the pre previous value of RSI is less than 30 and previous bar is closed with value for RSI over 30 , we have our open long condition.
The same we do for sell:
Open Sell Order
We skip Close buy and Close Sell and go directly to Settings tab.
Settings
We set StopLoss 50 points and TakeProfit 50 points. We want advanced MM so we check that option. Now we go to the last tab and press the Generate button. Now all we need is to copy the code and paste it in the MQL Editor, compile it and start using it.


//+------------------------------------------------------------------+
//                        DO NOT DELETE THIS HEADER
//             DELETING THIS HEADER IS COPYRIGHT INFRIGMENT 
//
//                   Copyright ©2011, ForexEAdvisor.com
//                 ForexEAdvisor Strategy Builder version 0.2
//                        http://www.ForexEAdvisor.com 
//
// THIS EA CODE HAS BEEN GENERATED USING FOREXEADVISOR STRATEGY BUILDER 0.2 
// on: 10/22/2011 10:34:03 PM
// Disclaimer: This EA is provided to you "AS-IS", and ForexEAdvisor disclaims any warranty
// or liability obligations to you of any kind. 
// UNDER NO CIRCUMSTANCES WILL FOREXEADVISOR BE LIABLE TO YOU, OR ANY OTHER PERSON OR ENTITY,
// FOR ANY LOSS OF USE, REVENUE OR PROFIT, LOST OR DAMAGED DATA, OR OTHER COMMERCIAL OR
// ECONOMIC LOSS OR FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, STATUTORY, PUNITIVE,
// EXEMPLARY OR CONSEQUENTIAL DAMAGES WHATSOEVER RELATED TO YOUR USE OF THIS EA OR 
// FOREXEADVISOR STRATEGY BUILDER     
// Because software is inherently complex and may not be completely free of errors, you are 
// advised to verify this EA. Before using this EA, please read the ForexEAdvisor Strategy Builder
// license for a complete understanding of ForexEAdvisor' disclaimers.  
// USE THIS EA AT YOUR OWN RISK. 
//  
// Before adding this expert advisor to a chart, make sure there are NO
// open positions.
//                      DO NOT DELETE THIS HEADER
//             DELETING THIS HEADER IS COPYRIGHT INFRIGMENT 
//+------------------------------------------------------------------+


extern int MagicNumber=10001;
extern double Lots =0.1;
extern double StopLoss=50;
extern double TakeProfit=50;
extern int TrailingStop=50;
extern int Slippage=3;
//+------------------------------------------------------------------+
//    expert start function
//+------------------------------------------------------------------+
int start()
{
  double MyPoint=Point;
  if(Digits==3 || Digits==5) MyPoint=Point*10;
  
  double TheStopLoss=0;
  double TheTakeProfit=0;
  if( TotalOrdersCount()==0 ) 
  {
     int result=0;
     if((Close[1]>Open[0])) // Here is your open buy rule
     {
        result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Blue);
        if(result>0)
        {
         TheStopLoss=0;
         TheTakeProfit=0;
         if(TakeProfit>0) TheTakeProfit=Ask+TakeProfit*MyPoint;
         if(StopLoss>0) TheStopLoss=Ask-StopLoss*MyPoint;
         OrderSelect(result,SELECT_BY_TICKET);
         OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
        }
        return(0);
     }
  }
  
  for(int cnt=0;cnt<OrdersTotal();cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   
         OrderSymbol()==Symbol() &&
         OrderMagicNumber()==MagicNumber 
         )  
        {
         if(OrderType()==OP_BUY)  
           {
            if(TrailingStop>0)  
              {                 
               if(Bid-OrderOpenPrice()>MyPoint*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-MyPoint*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
                     return(0);
                    }
                 }
              }
           }
         else 
           {
            if(TrailingStop>0)  
              {                 
               if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyPoint*TrailingStop,OrderTakeProfit(),0,Red);
                     return(0);
                    }
                 }
              }
           }
        }
     }
   return(0);
}

int TotalOrdersCount()
{
  int result=0;
  for(int i=0;i<OrdersTotal();i++)
  {
     OrderSelect(i,SELECT_BY_POS ,MODE_TRADES);
     if (OrderMagicNumber()==MagicNumber) result++;

   }
  return (result);
}

logic EA 2 SMA

//+------------------------------------------------------------------+
//| EA 2sma.mq4 |
//| Dwi M ea@dwim.web.id |
//| http://ea.dwim.web.id |
//+------------------------------------------------------------------+
#property copyright "Dwi M ea@dwim.web.id"
#property link "http://ea.dwim.web.id"



extern int TakeProfit = 30;
extern int StopLoss = 30;
extern int Slippage = 3;
extern double Lots = 1.0;

extern int SMA1Periode = 4;
extern int SMA2Periode = 8;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----

double dSMA1, dSMA2, dSMA1before, dSMA2before;

dSMA1=iMA(NULL,0,SMA1Periode,0,MODE_EMA,PRICE_CLOS E,0);
dSMA2=iMA(NULL,0,SMA2Periode,0,MODE_EMA,PRICE_CLOS E,0);

dSMA1before=iMA(NULL,0,SMA1Periode,0,MODE_EMA,PRIC E_CLOSE,1);
dSMA2before=iMA(NULL,0,SMA2Periode,0,MODE_EMA,PRIC E_CLOSE,1);


if (OrdersTotal()<1)
{
if (AccountFreeMargin()<1000*Lots)
{ Comment("EA tidak bekerja, dana kurang :", AccountFreeMargin()); return(0);}

if ((dSMA1>dSMA2) && (dSMA1before<dSMA2before)) 

OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Bid-StopLoss*Point,Ask+TakeProfit*Point,0);



if ((dSMA1<dSMA2) && (dSMA1before>dSMA2before))
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Ask+S topLoss*Point,Bid-TakeProfit*Point,0);
}

}



//----
return(0);
}
//+------------------------------------------------------------------+

Pelajaran Coding no 3 - Indi WPR


//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder |
//| http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//| |
//| In no event will author be liable for any damages whatsoever. |
//| Use at your own risk. |
//| |
//+------------------- DO NOT REMOVE THIS HEADER --------------------+

#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL 2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

#property copyright "Expert Advisor Builder"
#property link "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"

extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = True;
extern double Lots = 0.01;
extern int Slippage = 3;
extern bool UseStopLoss = True;
extern int StopLoss = 30;
extern bool UseTakeProfit = True;
extern int TakeProfit = 60;
extern bool UseTrailingStop = True;
extern int TrailingStop = 0;

int BarCount;
int Current;
bool TickCheck = False;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init() {
BarCount = Bars;

if (EachTickMode) Current = 0; else Current = 1;

return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() {
int Order = SIGNAL_NONE;
int Total, Ticket;
double StopLossLevel, TakeProfitLevel;



if (EachTickMode && Bars != BarCount) TickCheck = False;
Total = OrdersTotal();
Order = SIGNAL_NONE;

//+------------------------------------------------------------------+
//| Variable Begin |
//+------------------------------------------------------------------+


double Buy1_1 = iWPR(NULL, 0, 14, Current + 0);
double Buy1_2 = iWPR(NULL, 0, 64, Current + 0);
double Buy2_1 = iWPR(NULL, 0, 128, Current + 0);

double Sell1_1 = iWPR(NULL, PERIOD_M15, 14, Current + 0);
double Sell1_2 = iWPR(NULL, PERIOD_M15, 64, Current + 0);
double Sell2_1 = iWPR(NULL, PERIOD_M15, 128, Current + 0);




//+------------------------------------------------------------------+
//| Variable End |
//+------------------------------------------------------------------+

//Check position
bool IsTrade = False;

for (int i = 0; i < Total; i ++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
IsTrade = True;
if(OrderType() == OP_BUY) {
//Close

//+------------------------------------------------------------------+
//| Signal Begin(Exit Buy) |
//+------------------------------------------------------------------+



//+------------------------------------------------------------------+
//| Signal End(Exit Buy) |
//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(UseTrailingStop && TrailingStop > 0) {
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
if(OrderStopLoss() < Bid - Point * TrailingStop) {
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
} else {
//Close

//+------------------------------------------------------------------+
//| Signal Begin(Exit Sell) |
//+------------------------------------------------------------------+



//+------------------------------------------------------------------+
//| Signal End(Exit Sell) |
//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(UseTrailingStop && TrailingStop > 0) {
if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {
if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {
OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
}
}
}

//+------------------------------------------------------------------+
//| Signal Begin(Entry) |
//+------------------------------------------------------------------+

if (Buy1_1 == Buy1_2 && False) Order = SIGNAL_BUY;

if (Sell1_1 == Sell1_2 && False) Order = SIGNAL_SELL;


//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+

//Buy
if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}

if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;

Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
if(Ticket > 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("BUY order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
} else {
Print("Error opening BUY order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}

//Sell
if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}

if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;

Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink);
if(Ticket > 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("SELL order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
} else {
Print("Error opening SELL order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}

if (!EachTickMode) BarCount = Bars;

return(0);
}
//+------------------------------------------------------------------+

Pelajaran Coding no. 2

[CODE][///+------------------------------------------------------------------+
//| EA GP_Arrow.mq4 |
//| Dwi M ea@dwim.web.id |
//| http://ea.dwim.web.id |
//+------------------------------------------------------------------+
#property copyright "Dwi M ea@dwim.web.id"
#property link "http://ea.dwim.web.id"

extern int TakeProfit = 20;
extern int StopLoss = 20;
extern double Lot = 1.0;
extern int Slippage = 3;

double dPoint = 0;


//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
CekDigitBroker(); // Periksa Jumlah Digit Broker
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double dArrowUp=0, dArrowDown=0;
int iTrade=0;

dArrowUp = iCustom(Symbol(),0,"IINWMARROWS",0,0);
dArrowDown = iCustom(Symbol(),0,"IINWMARROWS",1,0);

Comment("EA GP Arrow \nDwi M ea@dwim.web.id \nhttp://ea.dwim.web.id"); 

if(OrdersTotal()<1)
{
if((dArrowUp>0) && (dArrowDown==0))
{
Buy();
}
}
else
{
if((dArrowDown>0) && (dArrowUp==0))
{
Sell();
}
}

for(iTrade=0;iTrade<OrdersTotal();iTrade++)
{
OrderSelect(iTrade,SELECT_BY_POS,MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
{
if((dArrowDown>0) && (dArrowUp==0))
{
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage, Violet);
}
}
else
{
if((dArrowUp>0) && (dArrowDown==0))
{
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage, Violet);

}
}

}

//----
return(0);
}
//+------------------------------------------------------------------+

/* Kumpulan Library */

//Memeriksa jumlah digit broker
void CekDigitBroker()
{
if(Digits==3 || Digits==5)
{
dPoint = Point*10;
}
else if(Digits==2 || Digits==4)
{
dPoint = Point;
}
}

/* Melakukan OP Buy */
void Buy()
{
OrderSend(Symbol(),OP_BUY,Lot,Ask,Slippage,Bid-StopLoss*dPoint,Ask+TakeProfit*dPoint,0); 

}

/* Melakukan OP Sell */
void Sell()
{
OrderSend(Symbol(),OP_SELL,Lot,Bid,Slippage,Ask+St opLoss*dPoint,Bid-TakeProfit*dPoint,0);
}]

yang ini custom indicatornya
[CODE][///+------------------------------------------------------------------+
//| IINWMARROWS.mq4 |
//| Based on EMA_CROSS.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//| Last little modified by Iin Zulkarnain |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1
//----
double CrossUp[];
double CrossDown[];
extern int FasterMode=3; //0=sma, 1=ema, 2=smma, 3=lwma
extern int FasterMA= 3;
extern int SlowerMode=3; //0=sma, 1=ema, 2=smma, 3=lwma
extern int SlowerMA= 3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- 
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() 
{
int limit, i, counter;
double fasterMAnow, slowerMAnow, fasterMAprevious, slowerMAprevious, fasterMAafter, slowerMAafter;
double Range, AvgRange;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
//----
limit=Bars-counted_bars;
for(i=0; i<=limit; i++) 
{
counter=i;
Range=0;
AvgRange=0;
for(counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;
fasterMAnow=iMA(NULL, 0, FasterMA, 0, FasterMode, PRICE_CLOSE, i);
fasterMAprevious=iMA(NULL, 0, FasterMA, 0, FasterMode, PRICE_CLOSE, i+1);
fasterMAafter=iMA(NULL, 0, FasterMA, 0, FasterMode, PRICE_CLOSE, i-1);
//----
slowerMAnow=iMA(NULL, 0, SlowerMA, 0, SlowerMode, PRICE_OPEN, i);
slowerMAprevious=iMA(NULL, 0, SlowerMA, 0, SlowerMode, PRICE_OPEN, i+1);
slowerMAafter=iMA(NULL, 0, SlowerMA, 0, SlowerMode, PRICE_OPEN, i-1);
if ((fasterMAnow > slowerMAnow) && (fasterMAprevious < slowerMAprevious) && (fasterMAafter > slowerMAafter)) 
{
CrossUp[i]=Low[i] - Range*0.3;
CrossUp[i]=Low[i] - Range*0.3;
}
else if ((fasterMAnow < slowerMAnow) && (fasterMAprevious > slowerMAprevious) && (fasterMAafter < slowerMAafter)) 
{
CrossDown[i]=High[i] + Range*0.3;
CrossDown[i]=High[i] + Range*0.3;
}
}
return(0);
}
//+------------------------------------------------------------------+]



============================================



Perunahan dengan indi IINWMARROW.mq4

Dari melihat jumlah extern variabel indikator IINWMARROWS.mq4 ada 4 variabel yang harus dimasukkan ke iCustom.



Code:
extern int FasterMode=3; //0=sma, 1=ema, 2=smma, 3=lwma
extern int FasterMA= 3;
extern int SlowerMode=3; //0=sma, 1=ema, 2=smma, 3=lwma
extern int SlowerMA= 3;


Jadi bentuk iCustomnya kira-kira menjadi sbb :

Code:
dArrowUp = iCustom(Symbol(),0,"IINWMARROWS",3,3,3,3,0,0);
dArrowDown = iCustom(Symbol(),0,"IINWMARROWS",3,3,3,3,1,0);


Pelajaran Coding no 1


//+------------------------------------------------------------------+
//|                                                EA BykovTrend.mq4 |
//|                                             Dwi M ea@dwim.web.id |
//|                                            http://ea.dwim.web.id |
//+------------------------------------------------------------------+
#property copyright "Dwi M ea@dwim.web.id"
#property link      "http://ea.dwim.web.id"

extern   double   Lot            = 1.0;
extern   int      Slippage       = 3;
extern   bool     UseTrailing    = true;
extern   int      TrailingStop   = 15;

double            dPoint         = 0;


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----

   CekDigitBroker(); // Periksa Jumlah Digit Broker
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   int      iTrade=0;
   double   dUptrend=0, dDowntrend=0;

   dUptrend    =  iCustom(Symbol(),0,"BykovTrend",3,9,500,0,0);
   dDowntrend  =  iCustom(Symbol(),0,"BykovTrend",3,9,500,1,0);
   
   Comment("EA BykovTrend\nDwi M ea@dwim.web.id\nhttp://ea.dwim.web.id","\ndUptrend :",dUptrend,"\ndDowntrend :",dDowntrend,"\nHour :",Hour());

   if(OrdersTotal()<1)
   {
      if((Hour()==1) && (dUptrend==1 && dDowntrend==0))
      {
         Buy();      
      }
      else if((Hour()==1) && (dUptrend==0 && dDowntrend==1))
      {
         Sell();
      }
   }
   
   for(iTrade=0;iTrade<OrdersTotal();iTrade++)
   {
      OrderSelect(iTrade,SELECT_BY_POS,MODE_TRADES);
      if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
      {
         if(Hour()==23)
         {
            OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);  
         }
         
         BuyTrailing();
      }
      else if(OrderType()==OP_SELL && OrderSymbol()==Symbol())  
      {
         if(Hour()==23)
         {
            OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);  
         }
         
         SellTrailing();
      }
   }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+


/* Kumpulan Library */

//Memeriksa jumlah digit broker
void CekDigitBroker()
{
   if(Digits==3 || Digits==5)
   {
      dPoint = Point*10;
   }
   else if(Digits==2 || Digits==4)
   {
      dPoint = Point;
   }
}

/* Melakukan OP Buy */
void Buy()
{
    OrderSend(Symbol(),OP_BUY,Lot,Ask,Slippage,0,0,0);        

}

/* Melakukan OP Sell */
void Sell()
{
    OrderSend(Symbol(),OP_SELL,Lot,Bid,Slippage,0,0,0);
}

/* Melakukan Trailing untuk Open Order Buy */
void BuyTrailing()
{

   if(UseTrailing==true)
   {
      if(Bid-OrderOpenPrice()>dPoint*TrailingStop)
      {
        if(OrderStopLoss()<Bid-dPoint*TrailingStop)
        {
             OrderModify(OrderTicket(),OrderOpenPrice(),Bid-dPoint*TrailingStop,OrderTakeProfit(),0,Green);
             return(0);
        }
      }
   }

}

/* Melakukan Trailing untuk Open Order Sell */
void SellTrailing()
{

   if(UseTrailing==true)
   {
     if((OrderOpenPrice()-Ask)>(dPoint*TrailingStop))
     {
         if((OrderStopLoss()>(Ask+dPoint*TrailingStop)) || (OrderStopLoss()==0))
         {
              OrderModify(OrderTicket(),OrderOpenPrice(),Ask+dPoint*TrailingStop,OrderTakeProfit(),0,Red);
              return(0);
         }
     }
   }
}