#property indicator_chart_window extern int P = 64; extern int MMPeriod = 1440; extern int StepBack = 0; //+------------------------------------------------------------------+ extern bool show.price.info=true; extern int price.x.offset= 0;//250 extern int price.y.offset= -160;//-190 extern int win = 0; //+------------------------------------------------------------------+ double dmml = 0, dvtl = 0, sum = 0, v1 = 0, v2 = 0, mn = 0, mx = 0, x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, y1 = 0, y2 = 0, y3 = 0, y4 = 0, y5 = 0, y6 = 0, octave = 0, fractal = 0, range = 0, finalH = 0, finalL = 0, mml[13]; string ln_txt[13], buff_str = ""; int bn_v1 = 0, bn_v2 = 0, OctLinesCnt = 13, mml_thk = 8, mml_clr[13], mml_wdth[13], mml_shft = 35, nTime = 0, CurPeriod = 0, nDigits = 0, i = 0; int NewPeriod=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators if(MMPeriod>0) NewPeriod = P*MathCeil(MMPeriod/Period()); else NewPeriod = P; //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- ObjectsDeleteAll(win,OBJ_HLINE); ObjectsDeleteAll(win,OBJ_TEXT); ObjectsDeleteAll(win,OBJ_LABEL); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- TODO: add your code here //+------------------------------------------------------------------+ double H2DAILY = iMA(Symbol(),PERIOD_D1,1,0,MODE_HIGH,PRICE_HIGH,0); double LDAILY = iMA(Symbol(),PERIOD_D1,1,0,MODE_LOW,PRICE_LOW,0); //+------------------------------------------------------------------+ double price = iMA(Symbol(),0,1,0,0,PRICE_CLOSE,0); double V3 = iRSI(Symbol(),0,2,PRICE_MEDIAN,0); //+------------------------------------------------------------------+ double week.high = iMA(Symbol(),PERIOD_W1,1,0,MODE_HIGH,PRICE_HIGH,0); double week.low = iMA(Symbol(),PERIOD_W1,1,0,MODE_LOW,PRICE_LOW,0); //+------------------------------------------------------------------+ double next.sup = 0, next.res = 0; //+------------------------------------------------------------------+ //Time for next bar: 57 min 31 sec double q; int m,s,k; m=Time[0]+Period()*60-CurTime(); q=m/60.0; s=m%60; m=(m-m%60)/60; //Comment( m + " minutes " + s + " seconds left to bar end"); //+------------------------------------------------------------------+ if( (nTime != Time[0]) || (CurPeriod != Period()) ) { //price bn_v1 = Lowest(NULL,0,MODE_LOW,NewPeriod+StepBack,StepBack); bn_v2 = Highest(NULL,0,MODE_HIGH,NewPeriod+StepBack,StepBack); v1 = Low[bn_v1]; v2 = High[bn_v2]; //determine fractal..... if( v2<=250000 && v2>25000 ) fractal=100000; else if( v2<=25000 && v2>2500 ) fractal=10000; else if( v2<=2500 && v2>250 ) fractal=1000; else if( v2<=250 && v2>25 ) fractal=100; else if( v2<=25 && v2>12.5 ) fractal=12.5; else if( v2<=12.5 && v2>6.25) fractal=12.5; else if( v2<=6.25 && v2>3.125 ) fractal=6.25; else if( v2<=3.125 && v2>1.5625 ) fractal=3.125; else if( v2<=1.5625 && v2>0.390625 ) fractal=1.5625; else if( v2<=0.390625 && v2>0) fractal=0.1953125; range=(v2-v1); sum=MathFloor(MathLog(fractal/range)/MathLog(2)); octave=fractal*(MathPow(0.5,sum)); mn=MathFloor(v1/octave)*octave; if( (mn+octave)>v2 ) mx=mn+octave; else mx=mn+(2*octave); // calculating xx //x2 if( (v1>=(3*(mx-mn)/16+mn)) && (v2<=(9*(mx-mn)/16+mn)) ) x2=mn+(mx-mn)/2; else x2=0; //x1 if( (v1>=(mn-(mx-mn)/8))&& (v2<=(5*(mx-mn)/8+mn)) && (x2==0) ) x1=mn+(mx-mn)/2; else x1=0; //x4 if( (v1>=(mn+7*(mx-mn)/16))&& (v2<=(13*(mx-mn)/16+mn)) ) x4=mn+3*(mx-mn)/4; else x4=0; //x5 if( (v1>=(mn+3*(mx-mn)/8))&& (v2<=(9*(mx-mn)/8+mn))&& (x4==0) ) x5=mx; else x5=0; //x3 if( (v1>=(mn+(mx-mn)/8))&& (v2<=(7*(mx-mn)/8+mn))&& (x1==0) && (x2==0) && (x4==0) && (x5==0) ) x3=mn+3*(mx-mn)/4; else x3=0; //x6 if( (x1+x2+x3+x4+x5) ==0 ) x6=mx; else x6=0; finalH = x1+x2+x3+x4+x5+x6; // calculating yy //y1 if( x1>0 ) y1=mn; else y1=0; //y2 if( x2>0 ) y2=mn+(mx-mn)/4; else y2=0; //y3 if( x3>0 ) y3=mn+(mx-mn)/4; else y3=0; //y4 if( x4>0 ) y4=mn+(mx-mn)/2; else y4=0; //y5 if( x5>0 ) y5=mn+(mx-mn)/2; else y5=0; //y6 if( (finalH>0) && ((y1+y2+y3+y4+y5)==0) ) y6=mn; else y6=0; finalL = y1+y2+y3+y4+y5+y6; for( i=0; i<OctLinesCnt; i++) { mml[i] = 0; } dmml = (finalH-finalL)/8; } //+------------------------------------------------------------------+ double sup.res.frame.size=(fractal/(dmml/8)); next.res = (MathCeil(price/(fractal/sup.res.frame.size))*(fractal/sup.res.frame.size)); next.sup = (MathFloor(price/(fractal/(sup.res.frame.size)))*(fractal/(sup.res.frame.size))); //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ if (show.price.info) { ObjectCreate("X630", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("X630",Symbol(), 30, "Arial Bold", Gray); ObjectSet("X630", OBJPROP_CORNER, 0); ObjectSet("X630", OBJPROP_XDISTANCE, 760+price.x.offset); ObjectSet("X630", OBJPROP_YDISTANCE, 160+price.y.offset); ObjectCreate("X629", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("X629",DoubleToStr(next.res,Digits), 15, "Arial Bold", Red); ObjectSet("X629", OBJPROP_CORNER, 0); ObjectSet("X629", OBJPROP_XDISTANCE, 770+price.x.offset); ObjectSet("X629", OBJPROP_YDISTANCE, 197+price.y.offset); ObjectCreate("X629b", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("X629b",DoubleToStr(next.sup,Digits), 15, "Arial Bold", Blue); ObjectSet("X629b", OBJPROP_CORNER, 0); ObjectSet("X629b", OBJPROP_XDISTANCE, 770+price.x.offset); ObjectSet("X629b", OBJPROP_YDISTANCE, 260+price.y.offset); ObjectCreate("X631", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("X631",DoubleToStr(price,Digits), 40, "Arial Bold", LightGray); ObjectSet("X631", OBJPROP_CORNER, 0); ObjectSet("X631", OBJPROP_XDISTANCE, 765+price.x.offset); ObjectSet("X631", OBJPROP_YDISTANCE, 210+price.y.offset); ObjectCreate("X632", OBJ_LABEL, win, 0, 0); ObjectSetText("X632",DoubleToStr(H2DAILY,Digits), 15, "Arial Bold", LimeGreen); ObjectSet("X632", OBJPROP_CORNER, 0); ObjectSet("X632", OBJPROP_XDISTANCE, 860+price.x.offset); ObjectSet("X632", OBJPROP_YDISTANCE, 197+price.y.offset); ObjectCreate("X634", OBJ_LABEL, win, 0, 0); ObjectSetText("X634",DoubleToStr(LDAILY,Digits), 15, "Arial Bold", Crimson); ObjectSet("X634", OBJPROP_CORNER, 0); ObjectSet("X634", OBJPROP_XDISTANCE, 860+price.x.offset); ObjectSet("X634", OBJPROP_YDISTANCE, 260+price.y.offset); /* ObjectCreate("X634a", OBJ_LABEL, win, 0, 0); ObjectSetText("X634a",DoubleToStr(s,Digits-4), 15, "Arial Bold", Yellow); ObjectSet("X634a", OBJPROP_CORNER, 0); ObjectSet("X634a", OBJPROP_XDISTANCE, 900+price.x.offset); ObjectSet("X634a", OBJPROP_YDISTANCE, 280+price.y.offset);*/ ObjectCreate("X634b", OBJ_LABEL, win, 0, 0); ObjectSetText("X634b",DoubleToStr(m,Digits-4)+" : "+DoubleToStr(s,Digits-4), 15, "Arial Bold", Yellow); ObjectSet("X634b", OBJPROP_CORNER, 0); ObjectSet("X634b", OBJPROP_XDISTANCE, 870+price.x.offset); ObjectSet("X634b", OBJPROP_YDISTANCE, 280+price.y.offset); ObjectCreate("t634b", OBJ_LABEL, win, 0, 0); ObjectSetText("t634b","Time Left", 15, "Arial Bold", Gray); ObjectSet("t634b", OBJPROP_CORNER, 0); ObjectSet("t634b", OBJPROP_XDISTANCE, 765+price.x.offset); ObjectSet("t634b", OBJPROP_YDISTANCE, 280+price.y.offset); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ WindowRedraw(); //---- End Of Program return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Series array that contains the lowest prices of each bar
Series array that contains the highest prices of each bar
Indicator Curves created:
Indicators Used:
Moving average indicator
Relative strength index
Custom Indicators Used:
Order Management characteristics:
Other Features: