Navigation´╝ÜHome > Content >

Floor_Pivots_Minutes.mq4

Time: 2016-05-06 | Download file:Floor_Pivots_Minutes.mq4

//+------------------------------------------------------------------+
//|                                          Floor_Pivot_Minutes.mq4 |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Silver
#property indicator_color2 Gray
#property indicator_color3 Gray
#property indicator_color4 Gray
#property indicator_color5 Gray
#property indicator_color6 Gray
#property indicator_color7 Gray  // DarkSlateGray
//---- input parameters
extern int T_F   = 240;
extern int limit = 30;
extern int lm    = 0;
//---- buffers
double R3Buffer[];
double R2Buffer[];
double R1Buffer[];
double PBuffer[];
double S1Buffer[];
double S2Buffer[];
double S3Buffer[];


//----
int Displacement;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(7);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(0,PBuffer);

   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexStyle(2,DRAW_LINE,STYLE_DOT); 
   SetIndexStyle(3,DRAW_LINE,STYLE_DOT);
   SetIndexStyle(4,DRAW_LINE,STYLE_DOT); 
   SetIndexStyle(5,DRAW_LINE,STYLE_DOT);
   SetIndexStyle(6,DRAW_LINE,STYLE_DOT);       
   SetIndexBuffer(1,R1Buffer);   
   SetIndexBuffer(2,R2Buffer);
   SetIndexBuffer(3,R3Buffer);   
   SetIndexBuffer(4,S1Buffer);
   SetIndexBuffer(5,S2Buffer);   
   SetIndexBuffer(6,S3Buffer);
      
   if( lm==0)
         Displacement=T_F/Period();
      else
         Displacement=1;

SetIndexShift(0,Displacement);
SetIndexShift(1,Displacement);
SetIndexShift(2,Displacement);
SetIndexShift(3,Displacement);
SetIndexShift(4,Displacement);
SetIndexShift(5,Displacement);
SetIndexShift(6,Displacement);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int cb,sbb_index,sbb_Aux_i,sbe_Aux_i,i;
   int counted_bars=IndicatorCounted();
   datetime Corresp_bbbnTime;
   double StHigh,StLow,DHigh,DLow,SStaticStep,SDBStep;
 
   for(cb=limit;cb>=0;cb--)
   {
      Corresp_bbbnTime=NormTimeBarBegin(Time[cb],T_F);
      sbb_index=n_iBarShift(Corresp_bbbnTime,Period());
      
      StHigh=High[iHighest(NULL,0,MODE_HIGH,sbb_index-cb+1,cb)];
      StLow=Low[iLowest(NULL,0,MODE_LOW,sbb_index-cb+1,cb)];
      
      PBuffer[cb]=MathRound((Close[cb]+StHigh+StLow)/3/Point)*Point;

      if( cb        

Recommend