#property copyright "Copyright © 2014 Serkov Alexandr"
#property link "serkov-alexandr@mail.ru"
//================================== properties
#property indicator_separate_window
#property indicator_buffers 27
#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_color14 C'60,240,0'
#property indicator_color15 C'0,220,0'
#property indicator_color16 C'20,200,0'
#property indicator_color17 C'40,180,0'
#property indicator_color18 C'60,160,0'
#property indicator_color19 C'80,140,0'
#property indicator_color20 C'100,120,0'
#property indicator_color21 C'120,100,0'
#property indicator_color22 C'140,80,0'
#property indicator_color23 C'160,60,0'
#property indicator_color24 C'180,40,0'
#property indicator_color25 C'200,20,0'
#property indicator_color26 C'220,0,0'
#property indicator_color27 C'240,120,0'
#property indicator_level1 0
#property indicator_levelcolor clrWhite
#property indicator_levelstyle STYLE_SOLID
extern int step=3;
extern int hist=1000;
double Buf1[],Buf2[],Buf3[],Buf4[],Buf5[],Buf6[],Buf7[],Buf8[],Buf9[];
double Buf10[],Buf11[],Buf12[],Buf13[],Buf14[],Buf15[],Buf16[],Buf17[],Buf18[];
double Buf19[],Buf20[],Buf21[],Buf22[],Buf23[],Buf24[],Buf25[],Buf26[],Buf27[];
int i,x,y;
double ma[27];
double mb[27][100];
int ind[27]={1,2,3,4,5,6,8,10,12,14,16,18,20,22,24,27,30,33,36,39,42,45,48,51,54,57,60};
//=============================== initialization
int init()
{string label;
label="Dynamix("+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);SetIndexBuffer(13,Buf14);SetIndexBuffer(14,Buf15);
SetIndexBuffer(15,Buf16);SetIndexBuffer(16,Buf17);SetIndexBuffer(17,Buf18);
SetIndexBuffer(18,Buf19);SetIndexBuffer(19,Buf20);SetIndexBuffer(20,Buf21);
SetIndexBuffer(21,Buf22);SetIndexBuffer(22,Buf23);SetIndexBuffer(23,Buf24);
SetIndexBuffer(24,Buf25);SetIndexBuffer(25,Buf26);SetIndexBuffer(26,Buf27);
return(0);}
//=============================== main function
int start()
{
//===========================================================
for(i=hist+(61*step); i>-1; i--)
{
for(x=0;x<27;x++)
for(y=99;y>0;y--)
mb[x][y]=mb[x][y-1];
for(x=0;x<27;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;
Buf14[i]=((mb[13][0]-mb[13][11])+(mb[13][0]-mb[13][22])+(mb[13][0]-mb[13][33])+(mb[13][0]-mb[13][44])+(mb[13][0]-mb[13][55])+(mb[13][0]-mb[13][66])+(mb[13][0]-mb[13][77])+(mb[13][0]-mb[13][88])+(mb[13][0]-mb[13][99]))/9;
Buf15[i]=((mb[14][0]-mb[14][11])+(mb[14][0]-mb[14][22])+(mb[14][0]-mb[14][33])+(mb[14][0]-mb[14][44])+(mb[14][0]-mb[14][55])+(mb[14][0]-mb[14][66])+(mb[14][0]-mb[14][77])+(mb[14][0]-mb[14][88])+(mb[14][0]-mb[14][99]))/9;
Buf16[i]=((mb[15][0]-mb[15][11])+(mb[15][0]-mb[15][22])+(mb[15][0]-mb[15][33])+(mb[15][0]-mb[15][44])+(mb[15][0]-mb[15][55])+(mb[15][0]-mb[15][66])+(mb[15][0]-mb[15][77])+(mb[15][0]-mb[15][88])+(mb[15][0]-mb[15][99]))/9;
Buf17[i]=((mb[16][0]-mb[16][11])+(mb[16][0]-mb[16][22])+(mb[16][0]-mb[16][33])+(mb[16][0]-mb[16][44])+(mb[16][0]-mb[16][55])+(mb[16][0]-mb[16][66])+(mb[16][0]-mb[16][77])+(mb[16][0]-mb[16][88])+(mb[16][0]-mb[16][99]))/9;
Buf18[i]=((mb[17][0]-mb[17][11])+(mb[17][0]-mb[17][22])+(mb[17][0]-mb[17][33])+(mb[17][0]-mb[17][44])+(mb[17][0]-mb[17][55])+(mb[17][0]-mb[17][66])+(mb[17][0]-mb[17][77])+(mb[17][0]-mb[17][88])+(mb[17][0]-mb[17][99]))/9;
Buf19[i]=((mb[18][0]-mb[18][11])+(mb[18][0]-mb[18][22])+(mb[18][0]-mb[18][33])+(mb[18][0]-mb[18][44])+(mb[18][0]-mb[18][55])+(mb[18][0]-mb[18][66])+(mb[18][0]-mb[18][77])+(mb[18][0]-mb[18][88])+(mb[18][0]-mb[18][99]))/9;
Buf20[i]=((mb[19][0]-mb[19][11])+(mb[19][0]-mb[19][22])+(mb[19][0]-mb[19][33])+(mb[19][0]-mb[19][44])+(mb[19][0]-mb[19][55])+(mb[19][0]-mb[19][66])+(mb[19][0]-mb[19][77])+(mb[19][0]-mb[19][88])+(mb[19][0]-mb[19][99]))/9;
Buf21[i]=((mb[20][0]-mb[20][11])+(mb[20][0]-mb[20][22])+(mb[20][0]-mb[20][33])+(mb[20][0]-mb[20][44])+(mb[20][0]-mb[20][55])+(mb[20][0]-mb[20][66])+(mb[20][0]-mb[20][77])+(mb[20][0]-mb[20][88])+(mb[20][0]-mb[20][99]))/9;
Buf22[i]=((mb[21][0]-mb[21][11])+(mb[21][0]-mb[21][22])+(mb[21][0]-mb[21][33])+(mb[21][0]-mb[21][44])+(mb[21][0]-mb[21][55])+(mb[21][0]-mb[21][66])+(mb[21][0]-mb[21][77])+(mb[21][0]-mb[21][88])+(mb[21][0]-mb[21][99]))/9;
Buf23[i]=((mb[22][0]-mb[22][11])+(mb[22][0]-mb[22][22])+(mb[22][0]-mb[22][33])+(mb[22][0]-mb[22][44])+(mb[22][0]-mb[22][55])+(mb[22][0]-mb[22][66])+(mb[22][0]-mb[22][77])+(mb[22][0]-mb[22][88])+(mb[22][0]-mb[22][99]))/9;
Buf24[i]=((mb[23][0]-mb[23][11])+(mb[23][0]-mb[23][22])+(mb[23][0]-mb[23][33])+(mb[23][0]-mb[23][44])+(mb[23][0]-mb[23][55])+(mb[23][0]-mb[23][66])+(mb[23][0]-mb[23][77])+(mb[23][0]-mb[23][88])+(mb[23][0]-mb[23][99]))/9;
Buf25[i]=((mb[24][0]-mb[24][11])+(mb[24][0]-mb[24][22])+(mb[24][0]-mb[24][33])+(mb[24][0]-mb[24][44])+(mb[24][0]-mb[24][55])+(mb[24][0]-mb[24][66])+(mb[24][0]-mb[24][77])+(mb[24][0]-mb[24][88])+(mb[24][0]-mb[24][99]))/9;
Buf26[i]=((mb[25][0]-mb[25][11])+(mb[25][0]-mb[25][22])+(mb[25][0]-mb[25][33])+(mb[25][0]-mb[25][44])+(mb[25][0]-mb[25][55])+(mb[25][0]-mb[25][66])+(mb[25][0]-mb[25][77])+(mb[25][0]-mb[25][88])+(mb[25][0]-mb[25][99]))/9;
Buf27[i]=((mb[26][0]-mb[26][11])+(mb[26][0]-mb[26][22])+(mb[26][0]-mb[26][33])+(mb[26][0]-mb[26][44])+(mb[26][0]-mb[26][55])+(mb[26][0]-mb[26][66])+(mb[26][0]-mb[26][77])+(mb[26][0]-mb[26][88])+(mb[26][0]-mb[26][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;Buf14[i]=0;Buf15[i]=0;Buf16[i]=0;Buf17[i]=0;Buf18[i]=0;Buf19[i]=0;Buf20[i]=0;
Buf21[i]=0;Buf22[i]=0;Buf23[i]=0;Buf24[i]=0;Buf25[i]=0;Buf26[i]=0;Buf27[i]=0;}
} return(0);}
Comments