MA Chanels FiboEnv Mid





//+------------------------------------------------------------------+
//|                           MA Chanels FiboEnv Mid.mq4             |
//|                                                           °njel° |
//|                                           iamnotlinked   mod. ik |
//+------------------------------------------------------------------+
#property copyright "°njel°"
#property link      "iamnotlinked"

#property indicator_chart_window
#property indicator_buffers 7

#property indicator_color1 MediumOrchid
#property indicator_color2 Violet
#property indicator_color3 MediumOrchid
#property indicator_color4 Violet
#property indicator_color5 MediumOrchid
#property indicator_color6 Violet
#property indicator_color7 MediumOrchid
//---- input parameters
extern int BarsCount = 1000;
extern int MAPeriod=55;
extern int MAMethod=MODE_SMA;
extern int MAPrice=4;
extern int MAShift=0;
double  max =0;
double  min =0;
double    Inc1 = 0.0000;
double    Inc2 = 0.0000;
double    Inc3 = 0.0000;
double    Inc4 = 0.0000;
//
/***
PRICE_CLOSE    0 Close price. 
PRICE_OPEN     1 Open price. 
PRICE_HIGH     2 High price. 
PRICE_LOW      3 Low price. 
PRICE_MEDIAN   4 Median price, (high+low)/2. 
PRICE_TYPICAL  5 Typical price, (high+low+close)/3. 
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4
MAMethod
MODE_SMA    0 Simple moving average, 
MODE_EMA    1 Exponential moving average, 
MODE_SMMA   2 Smoothed moving average, 
MODE_LWMA   3 Linear weighted moving average. 

***/

extern int ____;
extern int Note;
extern int ______;
extern int priceClose_0__priceOpen_1; 
extern int priceHigh_2__priceLow_3;
extern int priceMedian_4__priceTypical_5; 
extern int priceWeightedclose_6; 
extern int _______;
extern int MA_Method;
extern int SMA_0_EMA1_SMMA2_LWMA3;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexShift(0,MAShift); 
   SetIndexLabel(0,"FibMA"+MAPeriod+"Up100%");

   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexShift(1,MAShift); 
   SetIndexLabel(1,"FibMA"+MAPeriod+"Dn23.5%");   
   
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
 SetIndexShift(2,MAShift);  
   SetIndexLabel(2,"FibMA"+MAPeriod+"Dn38.2,Up61.8");   
   
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
  SetIndexShift(3,MAShift);  
   SetIndexLabel(3,"FibMA"+MAPeriod+"50%");   
      
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ExtMapBuffer5);
  SetIndexShift(4,MAShift); 
   SetIndexLabel(4,"FibMA"+MAPeriod+"Up38.2,Dn61.8");      
   
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,ExtMapBuffer6);
  SetIndexShift(5,MAShift); 
   SetIndexLabel(5,"FibMA"+MAPeriod+"Up23.5%");      
   
   SetIndexStyle(6,DRAW_LINE);
   SetIndexBuffer(6,ExtMapBuffer7);
  SetIndexShift(6,MAShift); 
   SetIndexLabel(6,"FibMA"+MAPeriod+"Dn100%");   
 
  IndicatorShortName ("MA Chanels FiboEnv Mid("+MAPeriod+")");
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   max =0;
   min =0;
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   max =0;
   min =0;
   
   
   if (iBars(NULL,0) < BarsCount)
      BarsCount = iBars(NULL,0) -MAPeriod-1 ;
      
   for (int i =BarsCount; i>=0; i--)
   {
   
      double m = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i);
      double top = High[i] - m;      
      if (top > max)
         max = top;
      
      double bottom = Low[i] - m;      
      if (bottom < min)
         min = bottom;
    
   }
   
   if (MathAbs(max) >  MathAbs(min))
      Inc4 = max; 
      else
      Inc4 = min;
    
      Inc1 = (max-min)*0.118; 
      Inc2 = (max-min)*0.264; 
      Inc3 = (max-min)*0.5;
      

   for (i =BarsCount; i>=0; i--)
   {
      ExtMapBuffer1[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) + Inc3; 
      ExtMapBuffer2[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) + Inc2 ;
      ExtMapBuffer3[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) + Inc1 ;
      ExtMapBuffer4[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i);      
      ExtMapBuffer5[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) - Inc1;
      ExtMapBuffer6[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) - Inc2;
      ExtMapBuffer7[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) - Inc3;
  
      
   }

   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: