Ichimoku Kinko Hyo2 – indicator for MetaTrader 4

Greetings to all. This is my rendition of what version 2 of the Ichimoku Kinko Hyo indicator should be.
Primarily, it was rebuilt to suit mostly expert advisors trading multiple currencies at the same time but it can still be used by manual
traders or single currency expert advisors just as the original version.


double tenkan,kijun,chikou,spa,spb;//these are created empty but they will contain the request data at the specified shift.
int kiv;
string kshape,ksentiment;
iIchimoku2("",0,3,tenkan,kijun,chikou,spa,spb,kiv,kshape,ksentiment,1);//tenkan variable now contains the indicator value at the specified shift which is 1.
                                                     //kijun variable now contains the indicator value at shift which is 1.
                                                     //chikou variable now contains the indicator value at shift which is 1.
                                                     //spa variable now contains the indicator value at shift which is 1.
                                                     //spb variable now contains the indicator value at shift which is 1.
                                                     //kiv variable now contains the kumo implied volatility at shift which is 1.  
                                                     //kshape variable now contains the description of the kumo's shape: flatop/flatbottom.
                                                     //ksentiment variable now contains a description of the kumo's sentiment: bullish/bearish.                                                                                                        

The variables such as kijun,chikou… also contain their respective values at the specified shift as well. Remember to put ”  #include
” at the top of your EA before using this function.


The original mql4 ichimoku indicator worked correctly and it will continue to do so for most us. I think it was built primarily with the manual
trader in mind. Another situation I faced while rebuilding this was that any problem or inefficiency will be amplified when used on multiple
currencies simultaneously. To remedy this, I modified the indicator to only run when it is necessary i.e. run only when a new bar is
completed. The original version would run on every tick, which i think would consume unnecessary cpu cycles.

When one reads ichimoku literature, frequently one will encounter a reference to the Kumo as “fat”, “thick” or “thin”. To an experienced
ichimoku practioner, it is easy to describe a kumo as “fat” or “thin” because she knows what the usual kumo thickness is for a pair. For
beginners, like myself, it is very difficult to describe a kumo because we don’t know what to objectively compare it to. I think a solution for
this problem would be to compare the kumo to itself over a specific period. This is the approach taken when writing the ”

GetKumoRelativeSize()” function. Ideally, we want to use a long period
of time in comparison to the current kumo thickness, like say 100 or 200 candlesticks. For a manual trader who is trading the daily charts,
this is simply keeping your computer running this indicator on over several months. For me, I like the freedom of turning off the VPS running
my EA, at least once a week. If I do this and I am trading the daily charts then the ”

GetKumoRelativeSize()” function will never get 100 bars to analyze. At
most, the function would receive just 6 bars over the course of a week, if I turn off my VPS once a week, because it will calculate the implied
volatility based only on what has been actively observed kumo depth values. Fortunately for me, while backtesting this indicator, I
discovered that I can use as little as 3 bars for the ichiKumoPeriod and still get respectable results. Setting the function to use less than 3
bars is not recommended because the results will be unreliable. 30 is the default setting.

Ichimoku Kinko Hyo2

Get E-Book Worth $100 for Free!!!

Here is another example usage, a complete EA:

//|                                                   example_EA.mq4 |
//|                                                                  |
//|                                                                  |
#property copyright "Copyright 2019, Peoples' software corp."
#property link      "https://www.everywhere.com"
#property version   "1.00"
#property strict
#include <Ichimoku2_Kinko_Hyo_Indicator.mqh>

double tk=0,kj=0,ch=0,spa=0,spb=0;
int Ticket1=0,i=0,kiv=0;
string kshape1,ksentiment1;
//| Expert initialization function                                   |
int OnInit()
//| Expert deinitialization function                                 |
void OnDeinit(const int reason)
//| Expert tick function                                             |
void OnTick()
   Comment("tk=",DoubleToStr(tk)," kj=",DoubleToStr(kj)," ch=",DoubleToStr(ch)," spa=",DoubleToStr(spa),"          spb=",DoubleToStr(spb)," kiv=",IntegerToString(kiv)," kshape1=",kshape1," ksentiment1=",ksentiment1);

And the output to screen using Comment():

ichimoku2 output to screen


  • Recommended broker: icmarketsXM,  FXTM,  tickmill
  • 0/5 (0 Reviews)