//----------------------------------------------------------------------------------------------------------------------------
#property copyright "Copyright © 2014 Serkov Alexandr"
#property link "serkov-alexandr@mail.ru"
//================================== properties
#property indicator_separate_window
#property indicator_buffers 13
#property indicator_color1 C'0,120,240'
#property indicator_color2 C'0,0,220'
#property indicator_color3 C'0,20,200'
#property indicator_color4 C'0,40,180'
#property indicator_color5 C'0,60,160'
#property indicator_color6 C'0,80,140'
#property indicator_color7 C'0,100,120'
#property indicator_color8 C'0,120,100'
#property indicator_color9 C'0,140,80'
#property indicator_color10 C'0,160,60'
#property indicator_color11 C'0,180,40'
#property indicator_color12 C'0,200,20'
#property indicator_color13 C'0,220,0'
#property indicator_level1 0
#property indicator_levelcolor clrWhite
#property indicator_levelstyle STYLE_SOLID
extern int step=6;
extern int hist=1000;
double Buf1[],Buf2[],Buf3[],Buf4[],Buf5[],Buf6[],Buf7[],Buf8[],Buf9[],Buf10[],Buf11[],Buf12[],Buf13[];
int i,x,y;
double ma[13];
double mb[13][100];
int ind[13]={1,2,3,4,6,8,10,13,16,19,22,26,30};
//=============================== initialization
int init()
{string label;
label="Dynamix light("+IntegerToString(step)+")";
IndicatorShortName(label);
SetIndexLabel(0,label);
SetIndexDrawBegin(1,1);
IndicatorDigits(Digits+1);
SetIndexBuffer(0,Buf1);SetIndexBuffer(1,Buf2);SetIndexBuffer(2,Buf3);
SetIndexBuffer(3,Buf4);SetIndexBuffer(4,Buf5);SetIndexBuffer(5,Buf6);
SetIndexBuffer(6,Buf7); SetIndexBuffer(7,Buf8);SetIndexBuffer(8,Buf9);
SetIndexBuffer(9,Buf10);SetIndexBuffer(10,Buf11);SetIndexBuffer(11,Buf12);
SetIndexBuffer(12,Buf13);
return(0);}
//=============================== main function
int start()
{
//===========================================================
for(i=hist+(61*step); i>-1; i--)
{
for(x=0;x<13;x++)
for(y=99;y>0;y--)
mb[x][y]=mb[x][y-1];
for(x=0;x<13;x++)
{ma[x]=ma[x]-Close[i+(step*ind[x])]+Close[i];
mb[x][0]=ma[x]/(step*ind[x]);}
if(i<(hist-61*step)) {
Buf1[i]=((mb[0][0]-mb[0][11])+(mb[0][0]-mb[0][22])+(mb[0][0]-mb[0][33])+(mb[0][0]-mb[0][44])+(mb[0][0]-mb[0][55])+(mb[0][0]-mb[0][66])+(mb[0][0]-mb[0][77])+(mb[0][0]-mb[0][88])+(mb[0][0]-mb[0][99]))/9;
Buf2[i]=((mb[1][0]-mb[1][11])+(mb[1][0]-mb[1][22])+(mb[1][0]-mb[1][33])+(mb[1][0]-mb[1][44])+(mb[1][0]-mb[1][55])+(mb[1][0]-mb[1][66])+(mb[1][0]-mb[1][77])+(mb[1][0]-mb[1][88])+(mb[1][0]-mb[1][99]))/9;
Buf3[i]=((mb[2][0]-mb[2][11])+(mb[2][0]-mb[2][22])+(mb[2][0]-mb[2][33])+(mb[2][0]-mb[2][44])+(mb[2][0]-mb[2][55])+(mb[2][0]-mb[2][66])+(mb[2][0]-mb[2][77])+(mb[2][0]-mb[2][88])+(mb[2][0]-mb[2][99]))/9;
Buf4[i]=((mb[3][0]-mb[3][11])+(mb[3][0]-mb[3][22])+(mb[3][0]-mb[3][33])+(mb[3][0]-mb[3][44])+(mb[3][0]-mb[3][55])+(mb[3][0]-mb[3][66])+(mb[3][0]-mb[3][77])+(mb[3][0]-mb[3][88])+(mb[3][0]-mb[3][99]))/9;
Buf5[i]=((mb[4][0]-mb[4][11])+(mb[4][0]-mb[4][22])+(mb[4][0]-mb[4][33])+(mb[4][0]-mb[4][44])+(mb[4][0]-mb[4][55])+(mb[4][0]-mb[4][66])+(mb[4][0]-mb[4][77])+(mb[4][0]-mb[4][88])+(mb[4][0]-mb[4][99]))/9;
Buf6[i]=((mb[5][0]-mb[5][11])+(mb[5][0]-mb[5][22])+(mb[5][0]-mb[5][33])+(mb[5][0]-mb[5][44])+(mb[5][0]-mb[5][55])+(mb[5][0]-mb[5][66])+(mb[5][0]-mb[5][77])+(mb[5][0]-mb[5][88])+(mb[5][0]-mb[5][99]))/9;
Buf7[i]=((mb[6][0]-mb[6][11])+(mb[6][0]-mb[6][22])+(mb[6][0]-mb[6][33])+(mb[6][0]-mb[6][44])+(mb[6][0]-mb[6][55])+(mb[6][0]-mb[6][66])+(mb[6][0]-mb[6][77])+(mb[6][0]-mb[6][88])+(mb[6][0]-mb[6][99]))/9;
Buf8[i]=((mb[7][0]-mb[7][11])+(mb[7][0]-mb[7][22])+(mb[7][0]-mb[7][33])+(mb[7][0]-mb[7][44])+(mb[7][0]-mb[7][55])+(mb[7][0]-mb[7][66])+(mb[7][0]-mb[7][77])+(mb[7][0]-mb[7][88])+(mb[7][0]-mb[7][99]))/9;
Buf9[i]=((mb[8][0]-mb[8][11])+(mb[8][0]-mb[8][22])+(mb[8][0]-mb[8][33])+(mb[8][0]-mb[8][44])+(mb[8][0]-mb[8][55])+(mb[8][0]-mb[8][66])+(mb[8][0]-mb[8][77])+(mb[8][0]-mb[8][88])+(mb[8][0]-mb[8][99]))/9;
Buf10[i]=((mb[9][0]-mb[9][11])+(mb[9][0]-mb[9][22])+(mb[9][0]-mb[9][33])+(mb[9][0]-mb[9][44])+(mb[9][0]-mb[9][55])+(mb[9][0]-mb[9][66])+(mb[9][0]-mb[9][77])+(mb[9][0]-mb[9][88])+(mb[9][0]-mb[9][99]))/9;
Buf11[i]=((mb[10][0]-mb[10][11])+(mb[10][0]-mb[10][22])+(mb[10][0]-mb[10][33])+(mb[10][0]-mb[10][44])+(mb[10][0]-mb[10][55])+(mb[10][0]-mb[10][66])+(mb[10][0]-mb[10][77])+(mb[10][0]-mb[10][88])+(mb[10][0]-mb[10][99]))/9;
Buf12[i]=((mb[11][0]-mb[11][11])+(mb[11][0]-mb[11][22])+(mb[11][0]-mb[11][33])+(mb[11][0]-mb[11][44])+(mb[11][0]-mb[11][55])+(mb[11][0]-mb[11][66])+(mb[11][0]-mb[11][77])+(mb[11][0]-mb[11][88])+(mb[11][0]-mb[11][99]))/9;
Buf13[i]=((mb[12][0]-mb[12][11])+(mb[12][0]-mb[12][22])+(mb[12][0]-mb[12][33])+(mb[12][0]-mb[12][44])+(mb[12][0]-mb[12][55])+(mb[12][0]-mb[12][66])+(mb[12][0]-mb[12][77])+(mb[12][0]-mb[12][88])+(mb[12][0]-mb[12][99]))/9;
}
if(i>(hist-61*step))
{Buf1[i]=0;Buf2[i]=0;Buf3[i]=0;Buf4[i]=0;Buf5[i]=0;Buf6[i]=0;Buf7[i]=0;Buf8[i]=0;Buf9[i]=0;Buf10[i]=0;
Buf11[i]=0;Buf12[i]=0;Buf13[i]=0;}
} return(0);}
Comments