WIchimokuKUMO

Author: Copyright 2010.11.29 M.Sasaki
WIchimokuKUMO

This tool is designed to visualize the Ichimoku Cloud, a popular technical analysis indicator used by traders to identify market trends, support/resistance levels, and momentum.

The core logic of this script functions through three primary mechanisms:

Dual-Layer Analysis

Unlike a standard Ichimoku indicator that provides one set of data, this script is built to handle two distinct sets of calculations simultaneously. It allows you to view two different "time horizons" or sensitivities on your chart at once. By using different calculation periods (parameters), you can overlay a fast-moving trend analysis with a slower, broader market trend to get a more comprehensive view of price action.

Dynamic Visibility Options

The script includes a "View Type" selection system. This allows the user to toggle which specific components of the Ichimoku Cloud are visible on the screen:

  • Standard Components: These include the Tenkan-sen and Kijun-sen (the lines that represent short-term and medium-term averages) along with the Senkou Span A and B (which form the "Cloud" or Kumo).
  • Filtered Views: Depending on your selection, the script can hide the individual lines and only show the Cloud (the shaded area), or it can switch between displaying the primary data set, the secondary data set, or a combination of both.

Real-Time Data & Environment Tracking

To provide a complete trading environment, the script automatically calculates and displays essential live information directly on the chart:

  • Market Spread: It constantly monitors the difference between the asking price and the bidding price (the "spread") in pips, helping you understand the current cost of entering a trade.
  • Local Time: It provides a synchronized clock so you can track the exact time of your analysis relative to your local timezone.

Summary of Functionality

In simple terms, this script acts as an advanced visual overlay. It takes complex mathematical averages and organizes them into two different "layers." You can choose whether to see the full detail of every line and cloud or simply a simplified view of the trend, all while keeping an eye on real-time market costs and time.

Indicators Used
Ichimoku Kinko Hyo
Miscellaneous
Implements a curve of type %1
19 Views
0 Downloads
0 Favorites
WIchimokuKUMO
//+------------------------------------------------------------------+
//|                                                WIchimokuKUMO.mq4 |
//|                                    Copyright 2010.11.25 M.Sasaki |
//|                                      http://youtarou.blogzine.jp |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010.11.29 M.Sasaki"
#property link      "http://youtarou.blogzine.jp"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 SandyBrown
#property indicator_color4 MediumSlateBlue
#property indicator_color5 DeepPink
#property indicator_color6 Cyan
#property indicator_color7 Violet
#property indicator_color8 Yellow

// buffers ichimoku
double buffTenkan[];
double buffKijun[];
double buffSenkouA[];
double buffSenkouB[];
double buffTenkan_2[];
double buffKijun_2[];
double buffSenkouA_2[];
double buffSenkouB_2[];

// parameters ichimoku
extern int tenkan_k = 9;
extern int kijun_k = 26;
extern int senkou_k = 52;
extern int tenkan_k2 = 51;
extern int kijun_k2 = 101;
extern int senkou_k2 = 151;

// View option
extern int ViewType = 4;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   // Set Buffers
   SetIndexBuffer(0, buffTenkan);
   SetIndexBuffer(1, buffKijun);
   SetIndexBuffer(2, buffSenkouA);
   SetIndexBuffer(3, buffSenkouB);
   
   SetIndexBuffer(4, buffTenkan_2);   
   SetIndexBuffer(5, buffKijun_2);
   SetIndexBuffer(6, buffSenkouA_2);
   SetIndexBuffer(7, buffSenkouB_2);
   
   // Set Style
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_DOT);
   SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_DOT);
   
   SetIndexStyle(4, DRAW_LINE, STYLE_SOLID);
   SetIndexStyle(5, DRAW_LINE, STYLE_SOLID);
   SetIndexStyle(6, DRAW_HISTOGRAM, STYLE_DOT);
   SetIndexStyle(7, DRAW_HISTOGRAM, STYLE_DOT);
   
   // Set Label
   SetIndexLabel(0, "Tenkan");
   SetIndexLabel(1, "Kijun");
   SetIndexLabel(2, "Senkou A");
   SetIndexLabel(3, "Senkou B");
   SetIndexLabel(4, "Tenkan 2");
   SetIndexLabel(5, "Kijun 2");
   SetIndexLabel(6, "Senkou A 2");
   SetIndexLabel(7, "Senkou B 2");

   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars;
   double spread = (Ask-Bid)/Point;
   Comment("\n\n",Symbol(),"\n\n\n","Local Time : ", TimeToStr(TimeLocal(), TIME_DATE|TIME_MINUTES), "\n\n\n","SPREAD : ",spread," pips");
   
   for(int i=limit-1; i>=0; i--)
   {
      // Ichimoku
      if( ViewType == 1 || ViewType == 3 || ViewType == 5 )
      {
         buffTenkan[i] = iIchimoku(NULL, 0, tenkan_k, kijun_k, senkou_k, MODE_TENKANSEN, i);
         buffKijun[i] = iIchimoku(NULL, 0, tenkan_k, kijun_k, senkou_k, MODE_KIJUNSEN, i);
         buffSenkouA[i] = iIchimoku(NULL, 0, tenkan_k, kijun_k, senkou_k, MODE_SENKOUSPANA, i);
         buffSenkouB[i] = iIchimoku(NULL, 0, tenkan_k, kijun_k, senkou_k, MODE_SENKOUSPANB, i);
      }
      else if( ViewType == 4 )
      {
         buffTenkan[i] = EMPTY_VALUE;
         buffKijun[i] = EMPTY_VALUE;
         buffSenkouA[i] = iIchimoku(NULL, 0, tenkan_k, kijun_k, senkou_k, MODE_SENKOUSPANA, i);
         buffSenkouB[i] = iIchimoku(NULL, 0, tenkan_k, kijun_k, senkou_k, MODE_SENKOUSPANB, i);
      }
      else
      {
         buffTenkan[i] = EMPTY_VALUE;
         buffKijun[i] = EMPTY_VALUE;
         buffSenkouA[i] = EMPTY_VALUE;
         buffSenkouB[i] = EMPTY_VALUE;
      
      }

   }
   
   for(i = limit-1; i>=0; i--)
   {
      // Ichimoku 2
      if( ViewType == 2 || ViewType == 3 || ViewType == 4 )
      {
         buffTenkan_2[i] = iIchimoku(NULL, 0, tenkan_k2, kijun_k2, senkou_k2, MODE_TENKANSEN, i);
         buffKijun_2[i] = iIchimoku(NULL, 0, tenkan_k2, kijun_k2, senkou_k2, MODE_KIJUNSEN, i);
         buffSenkouA_2[i] = iIchimoku(NULL, 0, tenkan_k2, kijun_k2, senkou_k2, MODE_SENKOUSPANA, i);
         buffSenkouB_2[i] = iIchimoku(NULL, 0, tenkan_k2, kijun_k2, senkou_k2, MODE_SENKOUSPANB, i);
      }
      else if( ViewType == 5 )
      {
         buffTenkan_2[i] = EMPTY_VALUE;
         buffKijun_2[i] = EMPTY_VALUE;
         buffSenkouA_2[i] = iIchimoku(NULL, 0, tenkan_k2, kijun_k2, senkou_k2, MODE_SENKOUSPANA, i);
         buffSenkouB_2[i] = iIchimoku(NULL, 0, tenkan_k2, kijun_k2, senkou_k2, MODE_SENKOUSPANB, i);
      }
      else
      {
         buffTenkan_2[i] = EMPTY_VALUE;
         buffKijun_2[i] = EMPTY_VALUE;
         buffSenkouA_2[i] = EMPTY_VALUE;
         buffSenkouB_2[i] = EMPTY_VALUE;
      }
   }      
      
   return(0);
  }
//+------------------------------------------------------------------+

Comments