//--------------------------------------------------------------------
// RSL 60M
// Multi Timeframe RSL Tests
//--------------------------------------------------------------------
#property indicator_separate_window // Indicator is drawn in the main window
#property indicator_buffers 2 // Number of buffers
#property indicator_color2 Orange // Buf_1 RSL Indikator
extern int Aver_Bars=26; // number of bars for calculation
double Buf_1[]; // Declaring indicator arrays
//--------------------------------------------------------------------
int init() // Special function init()
{
//--------------------------------------------------------------------
SetIndexBuffer(1,Buf_1); // Assigning an array to a buffer
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);// Line style
//--------------------------------------------------------------------
}
int start()
{
int i,counted_bars=IndicatorCounted(),n=0;
double RSL_GD=0;
//----
if(Bars<=Aver_Bars) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=Aver_Bars;i++) Buf_1[Bars-i]=0.0;
//----
i=Bars-Aver_Bars-1;
if(counted_bars>=Aver_Bars) i=Bars-counted_bars-1;
while(i>=0)
{
RSL_GD=0;
for(n=0;n<Aver_Bars;n++)
{
RSL_GD=(RSL_GD+(iClose(Symbol(),PERIOD_H1,(i+n))));
}
//RSL zeichnen-START-------------------------------------------------------------
Buf_1[i]=(iClose(Symbol(),PERIOD_H1,i)/((RSL_GD)/Aver_Bars));
//-------------------------------------------------------------------------------
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments