INERCIA_bars

Author: NICTRADER
INERCIA_bars
0 Views
0 Downloads
0 Favorites
INERCIA_bars
//+------------------------------------------------------------------+
//|                                                 INERCIA_bars.mq4 |
//|                                              Translated by KimIV |
//|                                              http://www.kimiv.ru |
//|                                                                  |
//| 10.11.2005  Øàáëîí èíäèêàòîðà ñ äâóìÿ ñèãíàëàìè                  |
//+------------------------------------------------------------------+
/*[[
	Name := INERCIA_bars
	Author := BOL
	Link := http://nyctrader.ru/
	Notes := NICTRADER
	Separate Window := No
	First Color := Blue
	First Draw Type := Histogram
	First Symbol := 217
	Use Second Data := Yes
	Second Color := Red
	Second Draw Type := Histogram
	Second Symbol := 218
]]*/
#property copyright "NICTRADER"
#property link      "http://nyctrader.ru/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

//------- Âíåøíèå ïàðàìåòðû èíäèêàòîðà -------------------------------
extern int body         = 7;
extern int NumberOfBars = 400;     // Êîëè÷åñòâî áàðîâ îáñ÷¸òà (0-âñå)

//------- Áóôåðû èíäèêàòîðà ------------------------------------------
double buf0[];
double buf1[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() {
  SetIndexBuffer(0, buf0);
  SetIndexStyle (0, DRAW_HISTOGRAM);
  SetIndexEmptyValue(0, EMPTY_VALUE);

  SetIndexBuffer(1, buf1);
  SetIndexStyle (1, DRAW_HISTOGRAM);
  SetIndexEmptyValue(1, EMPTY_VALUE);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void start() {
  int LoopBegin, sh;

 	if (NumberOfBars==0) LoopBegin=Bars-1;
  else LoopBegin=NumberOfBars-1;
  LoopBegin=MathMin(Bars-25, LoopBegin);

  for (sh=LoopBegin; sh>=0; sh--) {
    buf0[sh]=EMPTY_VALUE;
    buf1[sh]=EMPTY_VALUE;
    if (Close[sh]>Open[sh] && Close[sh]-Open[sh]>body*Point) {
      buf0[sh]=High[sh];
      buf1[sh]=Low[sh];
    }
    if (Close[sh]<Open[sh] && Open[sh]-Close[sh]>body*Point) {
      buf0[sh]=Low[sh];
      buf1[sh]=High[sh];
    }
  }
}
//+------------------------------------------------------------------+

Comments