MultiCCI-Indicator3

MultiCCI-Indicator3
Indicators Used
Commodity channel index
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
MultiCCI-Indicator3
//+------------------------------------------------------------------+
//|                                                  FXVolatility.com / Mark Whistler
//|                                                           with ECTrader.net
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Orange
#property indicator_color3 Gold
#property indicator_color4 Lime
#property indicator_color5 Aqua
#property indicator_color6 DodgerBlue
#property indicator_color7 MediumPurple
#property indicator_color8 Silver
#property indicator_level1 0
#property indicator_levelcolor LightSlateGray
//---- input parameters
extern int CCIPeriod1 = 5;
extern int CCIPeriod2 = 7;
extern int CCIPeriod3 = 9;
extern int CCIPeriod4 = 11;
extern int CCIPeriod5 = 14;
extern int CCIPeriod6 = 17;
extern int CCIPeriod7 = 20;
extern int CCIPeriod8 = 23;
//---- buffers
double CCIBuffer1[];
double CCIBuffer2[];
double CCIBuffer3[];
double CCIBuffer4[];
double CCIBuffer5[];
double CCIBuffer6[];
double CCIBuffer7[];
double CCIBuffer8[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexStyle(5, DRAW_LINE);
   SetIndexStyle(6, DRAW_LINE);
   SetIndexStyle(7, DRAW_LINE);
   SetIndexBuffer(0, CCIBuffer1);
   SetIndexBuffer(1, CCIBuffer2);
   SetIndexBuffer(2, CCIBuffer3);
   SetIndexBuffer(3, CCIBuffer4);
   SetIndexBuffer(4, CCIBuffer5);
   SetIndexBuffer(5, CCIBuffer6);
   SetIndexBuffer(6, CCIBuffer7);
   SetIndexBuffer(7, CCIBuffer8);
//---- name for DataWindow and indicator subwindow label
   short_name = "Multi CCI on " + " (" + CCIPeriod1 + ", " + CCIPeriod2 + ", " + CCIPeriod3 + " , " + CCIPeriod4 + " , " + CCIPeriod5 + " , " + CCIPeriod6 + " , " + CCIPeriod7 + " , " + CCIPeriod8 + " )";
   IndicatorShortName(short_name);
   SetIndexLabel(0, "Multi CCI(" + CCIPeriod1 + ")");
   SetIndexLabel(1, "Multi CCI(" + CCIPeriod2 + ")");   
   SetIndexLabel(2, "Multi CCI(" + CCIPeriod3 + ")");   
   SetIndexLabel(3, "Multi CCI(" + CCIPeriod4 + ")");   
   SetIndexLabel(4, "Multi CCI(" + CCIPeriod5 + ")");   
   SetIndexLabel(5, "Multi CCI(" + CCIPeriod6 + ")");   
   SetIndexLabel(6, "Multi CCI(" + CCIPeriod7 + ")");   
   SetIndexLabel(7, "Multi CCI(" + CCIPeriod8 + ")");   
//----
   SetIndexDrawBegin(0, CCIPeriod1);
   SetIndexDrawBegin(1, CCIPeriod2);
   SetIndexDrawBegin(2, CCIPeriod3);

   SetIndexDrawBegin(3, CCIPeriod4);

   SetIndexDrawBegin(4, CCIPeriod5);

   SetIndexDrawBegin(5, CCIPeriod6);

   SetIndexDrawBegin(6, CCIPeriod7);

   SetIndexDrawBegin(7, CCIPeriod8);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| CCI_Periods                                             |
//+------------------------------------------------------------------+
int start()
  {
   int i, counted_bars = IndicatorCounted();
//----
   if(Bars <= CCIPeriod1) 
       return(0);
//---- initial zero
   if(counted_bars < 1)
       for(i = 1; i <= CCIPeriod1; i++) 
           CCIBuffer1[Bars-i] = 0.0;
//----
   i = Bars - CCIPeriod1 - 1;
   if(counted_bars >= CCIPeriod1) 
       i = Bars - counted_bars - 1;
   while(i >= 0)
     {
       CCIBuffer1[i] = iCCI(NULL, 0, CCIPeriod1, PRICE_TYPICAL, i);
       CCIBuffer2[i] = iCCI(NULL, 0, CCIPeriod2, PRICE_TYPICAL, i);
       CCIBuffer3[i] = iCCI(NULL, 0, CCIPeriod3, PRICE_TYPICAL, i);
       CCIBuffer4[i] = iCCI(NULL, 0, CCIPeriod4, PRICE_TYPICAL, i);
       CCIBuffer5[i] = iCCI(NULL, 0, CCIPeriod5, PRICE_TYPICAL, i);
       CCIBuffer6[i] = iCCI(NULL, 0, CCIPeriod6, PRICE_TYPICAL, i);
       CCIBuffer7[i] = iCCI(NULL, 0, CCIPeriod7, PRICE_TYPICAL, i);
       CCIBuffer8[i] = iCCI(NULL, 0, CCIPeriod8, PRICE_TYPICAL, i);
       i--;
     }
   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 ---