/*[[ Name := Murrey_Math_Modified Separate Window := no First Color := Blue First Draw Type := Line First Symbol := 217 Use Second Data := no Second Color := Red Second Draw Type := Line Second Symbol := 218 ]]*/ input : beginer(64),periodtotake(64); Variable : shift(0),sum(0),v1(0),v2(0),fractal(0); variable : v45(0),mml00(0),mml0(0),mml1(0),mml2(0),mml3(0),mml4(0),mml5(0),mml6(0),mml7(0),mml8(0),mml9(0),mml98(0),mml99(0); variable : range(0),octave(0),mn(0),mx(0); variable : finalH(0),finalL(0); variable : x1(0),x2(0),x3(0),x4(0),x5(0),x6(0),y1(0),y2(0),y3(0),y4(0),y5(0),y6(0); SetLoopCount(0); For shift = 1 Downto 0 Begin //price v1=(L[lowest(MODE_LOW,beginer,periodtotake)]); v2=(H[highest(MODE_HIGH,beginer,periodtotake)]); //determine fractal..... If v2<=250000 AND V2>25000 then fractal=100000 else If v2<=25000 AND V2>2500 then fractal=10000 else If v2<=2500 AND V2>250 then fractal=1000 else If v2<=250 AND V2>25 then fractal=100 else If v2<=25 AND V2>12.5 then fractal=12.5 else If v2<=12.5 AND V2>6.25 then fractal=12.5 else If v2<=6.25 AND V2>3.125 then fractal=6.25 else If v2<=3.125 AND V2>1.5625 then fractal=3.125 else If v2<=1.5625 AND V2>0.390625 then fractal=1.5625 else If v2<=0.390625 AND V2>0 then fractal=0.1953125; range=(v2-v1); sum=Floor(log(fractal/range)/log(2)); octave=fractal*(pow(0.5,sum)); mn=Floor(v1/octave)*octave; If (mn+octave)>v2 then mx=mn+octave else mx=mn+(2*octave); // calculating xx //x2 if (v1>=3/16*(mx-mn)+mn)and (v2<=9/16*(mx-mn)+mn)then x2=mn+(mx-mn)/2 else x2=0; //x1 if (v1>=mn-(mx-mn)/8)and (v2<=5/8*(mx-mn)+mn) and x2=0 then x1=mn+(mx-mn)/2 else x1=0; //x4 if (v1>=mn+7*(mx-mn)/16)and (v2<=13/16*(mx-mn)+mn) then x4=mn+3*(mx-mn)/4 else x4=0; //x5 if (v1>=mn+3*(mx-mn)/8)and (v2<=9/8*(mx-mn)+mn)and x4=0 then x5=mx else x5=0; //x3 if (v1>=mn+(mx-mn)/8)and (v2<=7/8*(mx-mn)+mn)and x1=0 and x2=0 and x4=0 and x5=0 then x3=mn+3*(mx-mn)/4 else x3=0; //x6 if x1+x2+x3+x4+x5=0 then x6=mx else x6=0; finalH=x1+x2+x3+x4+x5+x6; // calculating yy //y1 if x1>0 then y1=mn else y1=0; //y2 if x2>0 then y2=mn+(mx-mn)/4 else y2=0; //y3 if x3>0 then y3=mn+(mx-mn)/4 else y3=0; //y4 if x4>0 then y4=mn+(mx-mn)/2 else y4=0; //y5 if x5>0 then y5=mn+(mx-mn)/2 else y5=0; //y6 if finalH>0 and (y1+y2+y3+y4+y5=0) then y6=mn else y6=0; finalL=y1+y2+y3+y4+y5+y6; v45=(finalH-finalL)/8; mml00=(finalL-v45*2); //-2/8 mml0=(finalL-v45); //-1/8 mml1=(finalL);// 0/8 mml2=(finalL+v45);// 1/8 mml3=(finalL+2*v45); // 2/8 mml4=(finalL+3*v45); // 3/8 mml5=(finalL+4*v45); // 4/8 mml6=(finalL+5*v45); // 5/8 mml7=(finalL+6*v45); // 6/8 mml8=(finalL+7*v45);// 7/8 mml9=(finalL+8*v45);// 8/8 mml99=(finalL+9*v45);// +1/8 mml98=(finalL+10*v45);// +2/8 comment("\n","finalh = ",finalh,"\n","finalL = ",finalL,"\n","v45 = ",v45, "\n","octave = ",octave,"\n","mn = ",mn,"\n","mx = ",mx,"\n","Fractal = ",fractal, "\n","range = ",range,"\n","sum = ",sum,"\n","high =",v2,"\n","Low = ",v1); SetObjectText("mm11_txt","-2/8 ","Arial",10,Black); MoveObject("mm11_txt",OBJ_TEXT,time[30],mml00,time[30],mml00,Black); SetObjectText("mm12_txt","-1/8 ","Arial",10,Black); MoveObject("mm12_txt",OBJ_TEXT,time[30],mml0,time[30],mml0,Black); SetObjectText("mm1_txt","0/8 ","Arial",10,blue); MoveObject("mm1_txt",OBJ_TEXT,time[30],mml1,time[30],mml1,blue); SetObjectText("mm2_txt","1/8 ","Arial",10,Orange); MoveObject("mm2_txt",OBJ_TEXT,time[30],mml2,time[30],mml2,Orange); SetObjectText("mm3_txt","2/8 ","Arial",10,red); MoveObject("mm3_txt",OBJ_TEXT,time[30],mml3,time[30],mml3,red); SetObjectText("mm4_txt","3/8 ","Arial",10,Green); MoveObject("mm4_txt",OBJ_TEXT,time[30],mml4,time[30],mml4,Green); SetObjectText("mm5_txt","4/8 ","Arial",10,blue); MoveObject("mm5_txt",OBJ_TEXT,time[30],mml5,time[30],mml5,blue); SetObjectText("mm6_txt","5/8 ","Arial",10,Green); MoveObject("mm6_txt",OBJ_TEXT,time[30],mml6,time[30],mml6,Green); SetObjectText("mm7_txt","6/8 ","Arial",10,red); MoveObject("mm7_txt",OBJ_TEXT,time[30],mml7,time[30],mml7,red); SetObjectText("mm8_txt","7/8 ","Arial",10,Orange); MoveObject("mm8_txt",OBJ_TEXT,time[30],mml8,time[30],mml8,Orange); SetObjectText("mm9_txt","8/8 ","Arial",10,blue); MoveObject("mm9_txt",OBJ_TEXT,time[30],mml9,time[30],mml9,blue); SetObjectText("mm-1_txt","+1/8 ","Arial",10,Black); MoveObject("mm-1_txt",OBJ_TEXT,time[30],mml99,time[30],mml99,Black); SetObjectText("mm-2_txt","+2/8 ","Arial",10,Black); MoveObject("mm-2_txt",OBJ_TEXT,time[30],mml98,time[30],mml98,Black); MoveObject("mm11" ,OBJ_HLINE,time[0],mml00,time[0],mml00,Black,2,STYLE_SOLID);// -2/8 MoveObject("mm12" ,OBJ_HLINE,time[0],mml0,time[0],mml0,Black,2,STYLE_SOLID);// -1/8 MoveObject("mm1" ,OBJ_HLINE,time[0],mml1,time[0],mml1,blue,2,STYLE_SOLID);// 0/8 MoveObject("mm2" ,OBJ_HLINE,time[0],mml2,time[0],mml2,Orange,1,STYLE_SOLID);// 1/8 MoveObject("mm3" ,OBJ_HLINE,time[0],mml3,time[0],mml3,red,1,STYLE_SOLID);// 2/8 MoveObject("mm4" ,OBJ_HLINE,time[0],mml4,time[0],mml4,Green,1,STYLE_SOLID);// 3/8 MoveObject("mm5" ,OBJ_HLINE,time[0],mml5,time[0],mml5,blue,1,STYLE_SOLID);// 4/8 MoveObject("mm6" ,OBJ_HLINE,time[0],mml6,time[0],mml6,Green,1,STYLE_SOLID);// 5/8 MoveObject("mm7" ,OBJ_HLINE,time[0],mml7,time[0],mml7,red,1,STYLE_SOLID);// 6/8 MoveObject("mm8" ,OBJ_HLINE,time[0],mml8,time[0],mml8,Orange,1,STYLE_SOLID);// 7/8 MoveObject("mm9" ,OBJ_HLINE,time[0],mml9,time[0],mml9,blue,2,STYLE_SOLID);// 0/8 MoveObject("mm-1" ,OBJ_HLINE,time[0],mml99,time[0],mml99,Black,2,STYLE_SOLID);// +2/8 MoveObject("mm-2" ,OBJ_HLINE,time[0],mml98,time[0],mml98,Black,2,STYLE_SOLID);// +1/8 end; SetIndexValue(shift,O);