// Step.mq4
// Èíäèêàòîð
#property copyright "mandorr@gmail.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_width1 2
#property indicator_style1 0
#property indicator_color1 IndianRed
extern int Step=25; // Øàã
extern int CountBars=10000; // Êîëè÷åñòâî îòîáðàæàåìûõ áàðîâ
double buffer[];
void init() {
IndicatorShortName("Step ("+Step+")");
IndicatorDigits(Digits);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(0,buffer);
SetIndexLabel(0,"Value");
SetIndexDrawBegin(0,0);
}
void start()
{
int price=MathRound(Close[CountBars-1]/Point);
int value=Step*(price/Step);
for (int i=CountBars-1; i>=0; i--)
{
price=MathRound(Close[i]/Point);
if (price>=value+Step) value=value+Step;
if (price<=value-Step) value=value-Step;
buffer[i]=value*Point;
}
}
Comments