round_value

Author: Copyright � 2010, Korwin
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
round_value
//+------------------------------------------------------------------+
//|                                                  round value.mq4 |
//|                                         Copyright © 2010, Korwin |
//|                                             korwin-kor@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Korwin"
#property link      "korwin-kor@yandex.ru"

#property indicator_chart_window
#property indicator_buffers 5
#property indicator_style1 2
#property indicator_style2 2
#property indicator_style3 2
#property indicator_style4 2
#property indicator_style5 2

#property indicator_color1 DimGray
#property indicator_color2 DimGray
#property indicator_color3 DimGray
#property indicator_color4 DimGray
#property indicator_color5 DimGray

extern double Øàã = 0.005;

double buf0[];
double buf1[];
double buf2[];
double buf3[];
double buf4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(5);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexStyle(1,DRAW_SECTION);
   SetIndexStyle(2,DRAW_SECTION);
   
   SetIndexBuffer(1,buf0);
   SetIndexBuffer(2,buf1);
   SetIndexBuffer(3,buf2);
   
   SetIndexBuffer(0,buf3);
   SetIndexBuffer(4,buf4);      
   
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);
   
   SetIndexEmptyValue(3,0.0);
   SetIndexEmptyValue(4,0.0);
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i,pos;
   int counted_bars = IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars > 0)   counted_bars--;
   int limit = Bars - counted_bars;
   if(counted_bars==0) limit--;   
//----
   for(i=limit; i>=0; i--)
      {
       buf0[i]=NormalizeDouble(Close[0],2)+Øàã;
       buf1[i]=NormalizeDouble(Close[0],2);
       buf2[i]=NormalizeDouble(Close[0],2)-Øàã;
       
       buf3[i]=NormalizeDouble(Close[0],2)+Øàã+Øàã;
       buf4[i]=NormalizeDouble(Close[0],2)-Øàã-Øàã;
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments