to_ind_Adjustable_Trading_Bands





//+------------------------------------------------------------------+
//|                             to_ind_Adjustable_Trading_Bands .mq4 |
//|                                                                * |
//|                                                                * |
//+------------------------------------------------------------------+
#property copyright "http://dmffx.com"
#property link      "http://dmffx.com"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 Khaki
//---- input parameters
extern int       ATRPeriod=5; // Ïåðèîä îïðåäåëåíèÿ ìàêñèìóìà/ìèíèìóìà öåíû
extern double    ATRFactor=1.5; // Êîýýôèöèåíò óðîâíÿ êîððåêöèè ìàêñèìóìà/ìèíèìóìà öåíû çíà÷åíèåì ATR
extern int       ATRHLPeriod=5; // Ïåðèîä ATR êîððåêòèðóþùåãî çíà÷åíèÿ ìàêñèìóìà/ìèíèìóìà öåíû
extern int       HLPeriod=34; // Ïåðèîä îïðåäåëåíèÿ ìàêñèìóìà/ìèíèìóìà öåíû îòêîððåêòèðîâàííîé ïî ATR
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double LLV_Pl_ATR[];
double HHV_Mn_ATR[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(5);
   
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   
   SetIndexBuffer(3,LLV_Pl_ATR);   
   SetIndexBuffer(4,HHV_Mn_ATR);  
   
   SetIndexLabel(0,"ATB Upper");
   SetIndexLabel(1,"ATB Lower");   
   SetIndexLabel(2,"ATB Central");       
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    limit=Bars-IndicatorCounted();
   
      for(int i=limit-1;i>=0;i--){
         LLV_Pl_ATR[i]=Low[Lowest(NULL,0,MODE_LOW,ATRPeriod,i)]+ATRFactor*iATR(NULL,0,ATRHLPeriod,i);
         HHV_Mn_ATR[i]=High[Highest(NULL,0,MODE_HIGH,ATRPeriod,i)]-ATRFactor*iATR(NULL,0,ATRHLPeriod,i);       
      }
      for(i=limit-1;i>=0;i--){
         ExtMapBuffer1[i]=LLV_Pl_ATR[ArrayMaximum(LLV_Pl_ATR,HLPeriod,i)];
         ExtMapBuffer2[i]=HHV_Mn_ATR[ArrayMinimum(HHV_Mn_ATR,HLPeriod,i)]; 
         ExtMapBuffer3[i]=(ExtMapBuffer1[i]+ExtMapBuffer2[i])/2;
      }      
      
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

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


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Indicator of the average true range


Custom Indicators Used:

Order Management characteristics:

Other Features: