extern int AllBars=0;//How many bars should be counted. 0 - all the bars.
extern int Otstup=30;//Step back.
extern double Per=9;//Period.
int SH,NB,i,UD;
double R,SHMax,SHMin;
double BufD[];
double BufU[];
//+------------------------------------------------------------------+
//| Функция инициализации |
//+------------------------------------------------------------------+
int init()
{
//We will write the number of the bars for which we are counting to the NB
if (Bars<AllBars+Per || AllBars==0) NB=Bars-Per; else NB=AllBars;
IndicatorBuffers(2);
IndicatorShortName("SHI_SilverTrendSig");
SetIndexStyle(0,DRAW_ARROW,0,3);
SetIndexStyle(1,DRAW_ARROW,0,3);
SetIndexArrow(0,159);
SetIndexArrow(1,159);
SetIndexBuffer(0,BufU);
SetIndexBuffer(1,BufD);
SetIndexDrawBegin(0,Bars-NB);//This indicator will be shown for NB bar only
SetIndexDrawBegin(1,Bars-NB);
ArrayInitialize(BufD,0.0);//Give a lot of "zero" to the buffe. Otherwise it will be garbage during the changing of time frame.
ArrayInitialize(BufU,0.0);
return(0);
}