RSL1





//+------------------------------------------------------------------+
//|                                                         RSL1.mq4 |
//|                      Copyright © 2006, Õàðèòîíîâ À.             |
//|                                        HaritonovAB@rambler.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "HaritonovAB@rambler.ru"

#property indicator_chart_window
#property indicator_buffers 1

//---- input parameters
extern int       MA_period=20;                              // Ïåðèîä îïîðíîé ñêîëüçÿùåé ñðåäíåé (MA)
extern double    LHistoCor=1.0;                             // Ìíîæèòåëü êîððåêòèðîâêè âèäèìîé äëèíû ãèñòîãðàììû 
extern color     Hcolor=Red;                                // Öâåò ãèñòîãðàììû
double MA[];
int RS[];
int FS,n;
double maxHigh,minLow;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
  IndicatorBuffers(1);
  SetIndexStyle(0,DRAW_NONE);
  SetIndexBuffer(0,MA);
int Asize;
maxHigh=High[Highest(NULL,0,MODE_HIGH,WHOLE_ARRAY,0)];
minLow =Low[Lowest(NULL,0,MODE_LOW,WHOLE_ARRAY,0)];
Asize= (maxHigh - minLow)/Point;
ArrayResize(RS,Asize);
ArrayInitialize(RS, 0); 
n=0;
Print(Asize,"   ",maxHigh,"   ",minLow);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll(0, OBJ_RECTANGLE); 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
 {
int i, j,k,t,counted_bars=IndicatorCounted();
double mH,mL,maxRS;
mH=minLow;mL=maxHigh;
string LineName;
  //----
  if(Bars<=MA_period) return(0);
  //---- initial zero
  if(counted_bars<MA_period)
  for(i=1;i<=0;i++)MA[Bars-i]=0.0;
  //----
  i=Bars-MA_period-1;
  if(counted_bars>=MA_period)i=Bars-counted_bars-1;
  
  while(i>=1) {
 MA[i]=iMA(NULL,0,13,0,MODE_EMA,PRICE_MEDIAN,i);
if(High[i]>mH)mH=High[i];if((MA[i]>MA[i+1])&&(MA[i+1]<MA[i+2])){k=(mL-minLow)/Point;RS[k]++;mH=mL;}
if(Low[i]<mL)mL=Low[i];  if((MA[i]<MA[i+1])&&(MA[i+1]>MA[i+2])){k=(mH-minLow)/Point;RS[k]++;mL=mH;}

         i--; }
        ObjectsDeleteAll(0, OBJ_RECTANGLE); 
        t=Period()*60*LHistoCor;
        j=(maxHigh-minLow)/Point-1;Print(j);
        while(j>=0){
        LineName="P_line"+j;
         ObjectCreate(LineName,OBJ_RECTANGLE,0,Time[FirstVisibleBar( )],minLow+j*Point,Time[FirstVisibleBar( )]+t*RS[j],minLow+(j+0.4)*Point);
         ObjectSet(LineName,OBJPROP_COLOR,Hcolor);// çàäàäèì öâåò ëèíèè 
         ObjectSet(LineName, OBJPROP_STYLE, STYLE_DOT);
         j--;}
 //----
   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
Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type DRAW_NONE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: