M5:=MA(O,5);
M10:=MA(O,10);
M20:=MA(O,20);
M30:=MA(O,30);
M40:=MA(O,40);
M60:=MA(O,60);
M80:=MA(O,80);
M90:=MA(O,90);
M120:=MA(O,120);
M180:=MA(O,180);
M270:=MA(O,270);
M360:=MA(O,360);
M480:=MA(O,480);
M540:=MA(O,540);
M640:=MA(O,640);
M720:=MA(O,720);
M810:=MA(O,810);
M960:=MA(O,960);
M1080:=MA(O,1080);
M1440:=MA(O,1440);
M1920:=MA(O,1920);
M2160:=MA(O,2160);
M2560:=MA(O,2560);
M3240:=MA(O,3240);
M4320:=MA(O,4320);
M5120:=MA(O,5120);
M6480:=MA(O,6480);
M7290:=MA(O,7290);
M8640:=MA(O,8640);
M9720:=MA(O,9720);
M10240:=MA(O,10240);
M12960:=MA(O,12960);
M14580:=MA(O,14580);
LL1:=IF(PERIOD=14 OR PERIOD=11 OR PERIOD=10 OR PERIOD=18 OR PERIOD=17 OR PERIOD=16 OR PERIOD=15 OR PERIOD=7,1,0);
H20%:IF(ISLASTBAR AND LL1=1,H-H*0.2,DRAWNULL),COLORGRAY,LINETHICK7;
DRAWNUMBER(H20%<>DRAWNULL AND LL1=1,H20%,H20%),COLORGRAY;
H30%:IF(ISLASTBAR AND LL1=1,H-H*0.3,DRAWNULL),COLORGREEN,LINETHICK7;
DRAWNUMBER(H30%<>DRAWNULL AND LL1=1,H30%,H30%),COLORGREEN;
H40%:IF(ISLASTBAR AND LL1=1,H-H*0.4,DRAWNULL),COLORGRAY,LINETHICK7;
DRAWNUMBER(H40%<>DRAWNULL AND LL1=1,H40%,H40%),COLORGRAY;
H50%:IF(ISLASTBAR AND LL1=1,H-H*0.5,DRAWNULL),COLORGREEN,LINETHICK7;
DRAWNUMBER(H50%<>DRAWNULL AND LL1=1,H50%,H50%),COLORGREEN;
H60%:IF(ISLASTBAR AND LL1=1,H-H*0.6,DRAWNULL),COLORGRAY,LINETHICK7;
DRAWNUMBER(H60%<>DRAWNULL AND LL1=1,H60%,H60%),COLORGRAY;
H70%:IF(ISLASTBAR AND LL1=1,H-H*0.7,DRAWNULL),COLORGREEN,LINETHICK7;
DRAWNUMBER(H70%<>DRAWNULL AND LL1=1,H70%,H70%),COLORGREEN;
H80%:IF(ISLASTBAR AND LL1=1,H-H*0.8,DRAWNULL),COLORGRAY,LINETHICK5;
DRAWNUMBER(H80%<>DRAWNULL AND LL1=1,H80%,H80%),COLORGRAY;
H90%:IF(ISLASTBAR AND LL1=1,H-H*0.9,DRAWNULL),COLORGREEN,LINETHICK7;
DRAWNUMBER(H90%<>DRAWNULL AND LL1=1,H90%,H90%),COLORGREEN;
H99%:IF(ISLASTBAR AND LL1=1,H-H*0.99,DRAWNULL),COLORYELLOW,LINETHICK7;
DRAWNUMBER(H99%<>DRAWNULL AND LL1=1,H99%,H99%),COLORGREEN;
LL2:=IF(PERIOD=5,1,0);
QC:IF(ISLASTBAR AND LL2=1, REF(CLOSE,1),DRAWNULL),COLORLIGREEN,LINETHICK4;
ZHANG2%:IF(ISLASTBAR AND LL2=1,QC+QC*0.02,DRAWNULL),COLORWHITE,LINETHICK3;
{DRAWNUMBER(ZHANG2%<>DRAWNULL AND LL2=1,ZHANG2%,ZHANG2%),COLORWHITE;}
ZHANG3%:=IF(ISLASTBAR AND LL2=1,QC+QC*0.03,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(ZHANG3%<>DRAWNULL AND LL2=1,ZHANG3%,ZHANG3%),COLORWHITE;}
ZHANG4%:=IF(ISLASTBAR AND LL2=1,QC+QC*0.04,DRAWNULL),COLORWHITE,LINETHICK3;
{DRAWNUMBER(ZHANG4%<>DRAWNULL AND LL2=1,ZHANG4%,ZHANG4%),COLORWHITE;}
ZHANG5%:IF(ISLASTBAR AND LL2=1,QC+QC*0.05,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(ZHANG5%<>DRAWNULL AND LL2=1,ZHANG5%,ZHANG5%),COLORWHITE;}
ZHANG6%:=IF(ISLASTBAR AND LL2=1,QC+QC*0.06,DRAWNULL),COLORWHITE,LINETHICK3;
{DRAWNUMBER(ZHANG6%<>DRAWNULL AND LL2=1,ZHANG6%,ZHANG6%),COLORWHITE;}
ZHANG7%:=IF(ISLASTBAR AND LL2=1,QC+QC*0.07,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(ZHANG7%<>DRAWNULL AND LL2=1,ZHANG7%,ZHANG7%),COLORWHITE;}
ZHANG8%:IF(ISLASTBAR AND LL2=1,QC+QC*0.08,DRAWNULL),COLORWHITE,LINETHICK3;
{DRAWNUMBER(ZHANG8%<>DRAWNULL AND LL2=1,ZHANG8%,ZHANG8%),COLORWHITE;}
ZHANG9%:=IF(ISLASTBAR AND LL2=1,QC+QC*0.09,DRAWNULL),COLORBLUE,LINETHICK3;
{DRAWNUMBER(ZHANG9%<>DRAWNULL AND LL2=1,ZHANG8%,ZHANG8%),COLORWHITE;}
ZHANG10%:IF(ISLASTBAR AND LL2=1,QC+QC*0.1,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(ZHANG10%<>DRAWNULL AND LL2=1,ZHANG10%,ZHANG10%),COLORWHITE;}
DIE2%:IF(ISLASTBAR AND LL2=1,QC-QC*0.02,DRAWNULL),COLORGRAY,LINETHICK3;
{DRAWNUMBER(DIE2%<>DRAWNULL AND LL2=1,DIE2%,DIE2%),COLORGRAY;}
DIE3%:=IF(ISLASTBAR AND LL2=1,QC-QC*0.03,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(DIE3%<>DRAWNULL AND LL2=1,DIE3%,DIE3%),COLORGRAY;}
DIE4%:=IF(ISLASTBAR AND LL2=1,QC-QC*0.04,DRAWNULL),COLORGRAY,LINETHICK3;
{DRAWNUMBER(DIE4%<>DRAWNULL AND LL2=1,DIE4%,DIE4%),COLORGRAY;}
DIE5%:IF(ISLASTBAR AND LL2=1,QC-QC*0.05,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(DIE5%<>DRAWNULL AND LL2=1,DIE5%,DIE5%),COLORGRAY;}
DIE6%:=IF(ISLASTBAR AND LL2=1,QC-QC*0.06,DRAWNULL),COLORGRAY,LINETHICK3;
{DRAWNUMBER(DIE6%<>DRAWNULL AND LL2=1,DIE6%,DIE6%),COLORGRAY;}
DIE7%:=IF(ISLASTBAR AND LL2=1,QC-QC*0.07,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(DIE7%<>DRAWNULL AND LL2=1,DIE7%,DIE7%),COLORGRAY;}
DIE8%:IF(ISLASTBAR AND LL2=1,QC-QC*0.08,DRAWNULL),COLORGRAY,LINETHICK3;
{DRAWNUMBER(DIE8%<>DRAWNULL AND LL2=1,DIE8%,DIE8%),COLORGRAY;}
DIE9%:=IF(ISLASTBAR AND LL2=1,QC-QC*0.09,DRAWNULL),COLORGRAY,LINETHICK3;
{DRAWNUMBER(DIE9%<>DRAWNULL AND LL2=1,DIE9%,DIE9%),COLORGRAY;}
DIE10%:IF(ISLASTBAR AND LL2=1,QC-QC*0.1,DRAWNULL),COLORBLUE,LINETHICK4;
{DRAWNUMBER(DIE10%<>DRAWNULL AND LL2=1,DIE10%,DIE10%),COLORGRAY;}
B10:MIN(M10,M5),LINETHICK3,COLORRED;
B20:MIN(M20,B10),COLORBLUE;
B30:MIN(M30,B20),COLORGREEN;
B40:MIN(M40,B30),COLORGREEN;
B60:MIN(M60,B40),COLORCYAN;
B80:MIN(M80,B60),COLORRED;
B90:MIN(M90,B80),COLORMAGENTA;
B120:MIN(M120,B90),COLORMAGENTA;
B180:MIN(M180,B120),COLORLIGRAY;
B270:MIN(M270,B180),COLORLIBLUE;
B360:MIN(M360,B270),COLORLIGREEN;
B480:MIN(M480,B360),COLORLICYAN;
B640:MIN(M640,B480),COLORLICYAN;
B720:MIN(M720,B640),COLORLIRED;
B810:MIN(M810,B720),COLORLIMAGENTA;
B960:MIN(M960,B810),COLORLIMAGENTA;
B1080:MIN(M1080,B960),COLORLIMAGENTA;
B1440:MIN(M1440,B1080),COLORYELLOW;
B1920:MIN(M1920,B1440),COLORYELLOW;
B2160:MIN(M2160,B1920),COLORYELLOW;
B2560:MIN(M2560,B2160),COLORWHITE;
B3240:MIN(M3240,B2560),COLORGREEN;
B4320:MIN(M4320,B3240),COLORGREEN;
B5120:MIN(M5120,B4320),COLORGREEN;
B6480:MIN(M6480,B5120),COLORCYAN;
B7290:MIN(M7290,B6480),COLORCYAN;
B8640:MIN(M8640,B7290),COLORCYAN;
B9720:MIN(M9720,B8640),COLORCYAN;
B10240:MIN(M10240,B9720),COLORCYAN;
B12960:MIN(M12960,B10240),COLORCYAN;
B14580:MIN(M14580,B12960),COLORCYAN;
S10:MAX(M10,M5),LINETHICK3,COLORRED;
S20:MAX(M20,S10),COLORBLUE;
S30:MAX(M30,S20),COLORGREEN;
S40:MAX(M40,S30),COLORGREEN;
S60:MAX(M60,S40),COLORCYAN;
S80:MAX(M80,S60),COLORRED;
S90:MAX(M90,S80),COLORMAGENTA;
S120:MAX(M120,S90),COLORMAGENTA;
S180:MAX(M180,S120),COLORLIGRAY;
S270:MAX(M270,S180),COLORLIBLUE;
S360:MAX(M360,S270),COLORLIGREEN;
S480:MAX(M480,S360),COLORLICYAN;
S640:MAX(M640,S480),COLORLICYAN;
S720:MAX(M720,S640),COLORLIRED;
S810:MAX(M810,S720),COLORLIMAGENTA;
S960:MAX(M960,S810),COLORLIMAGENTA;
S1080:MAX(M1080,S960),COLORLIMAGENTA;
S1440:MAX(M1440,S1080),COLORYELLOW;
S1920:MAX(M1920,S1440),COLORYELLOW;
S2160:MAX(M2160,S1920),COLORYELLOW;
S2560:MAX(M2560,S2160),COLORWHITE;
S3240:MAX(M3240,S2560),COLORGREEN;
S4320:MAX(M4320,S3240),COLORGREEN;
S5120:MAX(M5120,S4320),COLORGREEN;
S6480:MAX(M6480,S5120),COLORCYAN;
S7290:MAX(M7290,S6480),COLORCYAN;
S8640:MAX(M8640,S7290),COLORCYAN;
S9720:MAX(M9720,S8640),COLORCYAN;
S10240:MAX(M10240,S9720),COLORCYAN;
S12960:MAX(M12960,S10240),COLORCYAN;
S14580:MAX(M14580,S12960),COLORCYAN;