Tuesday 15 October 2013

Belajar Membuat EA Sederhana 37 (terapan indikator IFX_Keltner_Channel II)

Kita lanjutin deh setelah di part 36    , Kita sudah sedikit membahas tentang indikator IFX_Keltner_Channel.
dari gambaran di part sebelumnya indi ini mempunyai 3 mode yaitu 0,1,2
terus bagimana untuk membaca indikator tersebut supaya bisa dipanggil di dalam Ea .

Pada pembahasan yang dulu kita sudah pernah membahas membuat ea dengan indikator diluar mt4 (custom indikator)
kita coba:
di pembahasan sebelumnya sudah diketahui bahwa indikator ini mempunyai 3 mode dan 3 input parameter , Nah dari situ bisa kita buat custom indikatornya begini

Nah dengan dibuat custom indi IFX_Keltner ini maka akan mudah diimplementasikan kedalam EA

Rule Ea yang akan kita bikin adalah  (untuk mode market trending)
1. Buy ketika harga menembus garis upper
2. sell ketika harga menembus garis lower
3. op dibuat stiap candel ada signal

apalagi ya

itu aja deh
silahkan yang mau bikin bisa dibuat kan EAnya

Nah ini salah satu Ea yang di bikin oleh master "Anie Budi Raharjo " yang udah ngirimkan melalui FB
SLnya dibuat otomatis digaris indinya:


//+------------------------------------------------------------------+
//|                                          IFX_Keltner_Channel.mq4 |
//|                                           Copyright 2013, Annura |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Annura"
#property link      ""

extern string Nama_EA               = "IFX Keltner Channel";
extern int    TP                    = 11;
extern int    SL                    = 20;
extern double Lot                   = 0.01;
extern int    Magic                 = 69;
extern int    Mode_Ma               = 0;
extern int    Ma_Pareode            = 10;
extern int    Price_tip             = 5;
extern int    Max_order             = 2;


int signalBuy,signalSell;
double pt,SLb,TPb,SLs,TPs;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   if(Digits==3 || Digits==5) pt=10*Point;   else   pt=Point;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
      double kfa  = iCustom(Symbol(),0,"IFX_Keltner_Channel",Ma_Pareode,Mode_Ma,Price_tip,0,0);
      double kfm  = iCustom(Symbol(),0,"IFX_Keltner_Channel",Ma_Pareode,Mode_Ma,Price_tip,1,0);
      double kfb  = iCustom(Symbol(),0,"IFX_Keltner_Channel",Ma_Pareode,Mode_Ma,Price_tip,2,0);

      if(Open[1]<kfa && Close[1]>kfa && Open[0]>kfa)
      {
         signalBuy=1;
      }
      if(Open[1]>kfb && Close[1]<kfb && Open[0]<kfb)
      {
         signalSell=1;
      }
     
      SLb=kfb;
      SLs=kfa;
      if(TP==0)TPb=0;else TPb=Ask+TP*pt;
      if(TP==0)TPs=0;else TPs=Bid-TP*pt;
     
      if(signalBuy==1 && JumlahOrder(0)<Max_order)
      {
         OrderSend(Symbol(),OP_BUY,Lot,Ask,3,SLb,TPb,Nama_EA,Magic,0,Blue); 
      }
      if(signalSell==1 && JumlahOrder(1)<Max_order)
      {
         OrderSend(Symbol(),OP_SELL,Lot,Bid,3,SLs,TPs,Nama_EA,Magic,0,Red);       
      }

//----
   return(0);
  }
//+------------------------------------------------------------------+
int JumlahOrder(int Tipe)
{
   int Total = 0;
   for(int i=0; i<OrdersTotal(); i++)
   {
       OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
       if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic || OrderType()!=Tipe)
       {
         continue;
       }
     Total++;
   }
   return(Total);
}





Trims mbak Anie  atas kirimannya.

3 comments:

  1. The foreign exchange, and additionally called "the foreign exchange" market exists anywhere one currency is traded for another. It's the biggest monetary marketplace inside the international. Virtually if we examine the ny stock change trades vs changing hands in forex, we are able to discover forex marketplace is a lot of instances larger than both equity and treasury markets mixed.
    Forex or "foreign exchange" is in which the cash of one state is traded with another. The most important and popular pairs of exchange within the foreign exchange market are "euro dollar", and you may see this pairs in all forex show screens as "eur/usd". There also are a number of others pairs but positive no longer important and not well-known as "eur/usd" pairs, like:-
    1-the british pound, and you may see this pairs in all foreign exchange show displays as "gbp/usd".
    2- the japanese yen, and you'll see this pairs in all forex show displays as "usd/jpy".
    3- the swiss franc, and you'll see this pairs in all forex show screens as "usd/chf".
    Automated Forex Trading
    Forex signals

    ReplyDelete
  2. ** Exmo is an online exchange that supports InstantSend, meaning your deposits and withdrawals from Exmo can be confirmed instantaneously. IT HAS NEVER BEEN SO EASY TO USE BITCOIN ...
    Traded Pairs:
    BTC/USD
    BTC/EUR
    BTC/RUB
    DASH/BTC
    DASH/USD
    ETH/BTC
    ETH/USD
    ETH/RUB
    DOGE/BTC
    DOGE/RUB
    LTC/BTC
    LTC/RUB
    USD/RUB
    1,116,613 people in more than 200 countries trust EXMO .
    Learn more https://goo.gl/a2Mkz7

    ReplyDelete
  3. Strange "water hack" burns 2lbs overnight

    Well over 160 000 men and women are utilizing a easy and SECRET "liquid hack" to drop 1-2lbs each and every night as they sleep.

    It's very simple and works with everybody.

    Here's how to do it yourself:

    1) Grab a drinking glass and fill it up half the way

    2) And now do this proven HACK

    and you'll become 1-2lbs thinner as soon as tomorrow!

    ReplyDelete