WIchimokuChikou

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

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Yellow

// buffers ichimoku
double buffChikou[];
double buffChikou2[];

// 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 = 1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   // Set Buffers
   SetIndexBuffer(0, buffChikou);
   SetIndexBuffer(1, buffChikou2);
   
   // Set Style
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);

   // Set Label
   SetIndexLabel(0, "Chikou");
   SetIndexLabel(1, "Chikou 2");

   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars;
   
   for(int i=limit-1; i>=0; i--)
   {
      // Ichimoku
      if( ViewType == 1 || ViewType == 3 )
      {
         if( i >= kijun_k ){
            buffChikou[i] = iIchimoku(NULL, 0, tenkan_k, kijun_k, senkou_k, MODE_CHINKOUSPAN, i);
         }else
            buffChikou[i] = EMPTY_VALUE;
      }
      else
         buffChikou[i] = EMPTY_VALUE;
   }
   
   for(i = limit-1; i>=0; i--)
   {
      // Ichimoku 2
      if( ViewType == 2 || ViewType == 3 )
      {
         if( i >= kijun_k2 ){
            buffChikou2[i] = iIchimoku(NULL, 0, tenkan_k2, kijun_k2, senkou_k2, MODE_CHINKOUSPAN, i);
         }else
            buffChikou2[i] = EMPTY_VALUE;
      }
      else
         buffChikou2[i] = EMPTY_VALUE;
   }      
      
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---