/*[[ Name := Float_V_Unknown_Final Author := Bigblockfw / minor additions by transport_david Separate Window := Yes First Color := Blue First Draw Type := histogram First Symbol := 217 Use Second Data := Yes Second Color := Red Second Draw Type := Line Second Symbol := 218 ]]*/ Inputs : use_fibos(1), Fib_76.4(0.764), Fib_61.8(0.618), Fib_50.0(0.50), Fib_38.2(0.382), Fib_23.6(0.236), Backtesting(0); Variables : float(0),shift(0),f(0),c1(0),high_bar(0),Low_bar(0),bars_high(0),bars_low(0); Variables : cumulativeV(0),FLOATV(0),cumulativeV2(0),loopbegin2(0),swing(0),swing_time(0); Variables : swingv(0),loopbegin1(0),cnt(0); Variables : first(True),first1(True), prevbars(0); Variables : cvstart(0),cvend(0),bar(0),newcv(0),CV(0),CV2(0); Variables : fib23(0),fib38(0),fib50(0),fib62(0),fib76(0); Variables : dinap0(0),dinap1(0),dinap2(0),dinap3(0),dinap4(0),dinap5(0); Variables : CVL(0),CVL1(0),CVL2(0),CVL3(0),CVL4(0),Sum(0),PrevSum(0); If float=288 then float=288 else { Switch Period { // Set the float according to period here // If you like a float of 200 on a 60 minute chart // change case 60: float=48; to case 60: float=200; case 1: float=288; case 5: float=288; case 15: float=192; case 30: float=96; case 60: float=48; case 240: float=24; case 1440: float=24; case 10080: float=10; Default: exit; }; }; cumulativeV=0; cumulativeV2=0; Sum=Period+float+bars; If (Sum!=PrevSum)or((bars-prevbars)<0) Then { first = True; first1 = True; prevbars = bars; FLOATV=0; PrevSum=Period+float+bars; }; If first Then Begin loopbegin1 = float; loopbegin2 = float; first = False; SetLoopCount(0); loopbegin1 = loopbegin1+1; For shift = loopbegin1 Downto 0 Begin //find high and low high_bar = H[Highest(MODE_HIGH,float,float)]; Low_bar = L[Lowest(MODE_LOW,float,float)]; //find bar counts bars_high = highest(MODE_HIGH,float,float); bars_low = lowest(MODE_LOW,float,float); //find swing price differance swing = H[Highest(MODE_HIGH,float,float)]- L[Lowest(MODE_LOW,float,float)]; //find float time barcount swing_time = abs(bars_low-bars_high); //find cumulative volume for float period IF bars_high < bars_low then { cvstart=bars_low; cvend=bars_high; } else { cvstart=bars_high; cvend=bars_low; } If first1 and FLOATV=0 Then Begin for shift = cvstart downto cvend Begin { FLOATV=FLOATV+V[shift]; first1 = False;} end; //find cumulative volume since last turnover for shift = cvstart downto 0 Begin cumulativeV=cumulativeV+V[shift]; if cumulativeV>=FLOATV then{ cumulativeV=0; } SetIndexValue(shift,cumulativeV*0.001);//Blue SetIndexValue2(shift,FLOATV*0.001);//red comment("\n","Float = ",float, "\n", "\n","High = ",bars_high," bars ago"," @ ",high_bar, "\n","Fib_76.4 = ",(high_bar-((high_bar-Low_bar)*Fib_23.6)), "\n","Fib_61.8 = ",(high_bar-((high_bar-Low_bar)*Fib_38.2)), "\n","Fib_50.0 = ",(high_bar-((high_bar-Low_bar)*Fib_50.0)), "\n","Fib_38.2 = ",(high_bar-((high_bar-Low_bar)*Fib_61.8)), "\n","Fib_23.6 = ",(high_bar-((high_bar-Low_bar)*Fib_76.4)), "\n","Low = ",bars_low," bars ago"," @ ",Low_bar, "\n", "\n","Float time was = ", swing_time," bars", "\n","Float Vol. left = ",FLOATV-cumulativeV, "\n","Float Volume = ",FLOATV); MoveObject("swingtop",OBJ_TRENDLINE,Time[cvstart],high_bar,Time[1],high_bar,Blue,1,STYLE_SOLID); MoveObject("swingbottom",OBJ_TRENDLINE,Time[cvstart],Low_bar,Time[1],Low_bar,Blue,1,STYLE_SOLID); //fibos If use_fibos=1 then{ fib23=((high_bar-Low_bar)*0.236)+Low_bar; fib38=((high_bar-Low_bar)*0.382)+Low_bar; fib50=((high_bar-Low_bar)/2)+Low_bar; fib62=((high_bar-Low_bar)*0.618)+Low_bar; fib76=((high_bar-Low_bar)*0.764)+Low_bar; dinap0=(Low_bar+fib23)/2; dinap1=(fib23+fib38)/2; dinap2=(fib38+fib50)/2; dinap3=(fib50+fib62)/2; dinap4=(fib62+fib76)/2; dinap5=(high_bar+fib76)/2; MoveObject("fib23",OBJ_TRENDLINE,Time[cvstart],fib23,Time[1],fib23,Green,1,STYLE_DASH); SetObjectText("23","23.6","Arial",8,green); MoveObject("23",OBJ_TEXT,time[0],fib23,time[0],fib23,Green); MoveObject("fib38",OBJ_TRENDLINE,Time[cvstart],fib38,Time[1],fib38,Green,1,STYLE_DASH); SetObjectText("38","38.2","Arial",8,green); MoveObject("38",OBJ_TEXT,time[0],fib38,time[0],fib38,Green); MoveObject("fib50",OBJ_TRENDLINE,Time[cvstart],fib50,Time[1],fib50,Red,2,STYLE_SOLID); SetObjectText("50","50","Arial",8,green); MoveObject("50",OBJ_TEXT,time[0],fib50,time[0],fib50,Green); MoveObject("fib62",OBJ_TRENDLINE,Time[cvstart],fib62,Time[1],fib62,Green,1,STYLE_DASH); SetObjectText("62","61.8","Arial",8,green); MoveObject("62",OBJ_TEXT,time[0],fib62,time[0],fib62,Green); MoveObject("fib76",OBJ_TRENDLINE,Time[cvstart],fib76,Time[1],fib76,Green,1,STYLE_DASH); SetObjectText("76","76.4","Arial",8,green); MoveObject("76",OBJ_TEXT,time[0],fib76,time[0],fib76,Green); MoveObject("dinap0",OBJ_TRENDLINE,Time[cvstart],dinap0,Time[1],dinap0,Red,1, STYLE_DOT); MoveObject("dinap1",OBJ_TRENDLINE,Time[cvstart],dinap1,Time[1],dinap1,Red,1, STYLE_DOT); MoveObject("dinap2",OBJ_TRENDLINE,Time[cvstart],dinap2,Time[1],dinap2,Red,1, STYLE_DOT); MoveObject("dinap3",OBJ_TRENDLINE,Time[cvstart],dinap3,Time[1],dinap3,Red,1, STYLE_DOT); MoveObject("dinap4",OBJ_TRENDLINE,Time[cvstart],dinap4,Time[1],dinap4,Red,1, STYLE_DOT); MoveObject("dinap5",OBJ_TRENDLINE,Time[cvstart],dinap5,Time[1],dinap5,Red,1, STYLE_DOT); //vert. float lines. these draw the lines that calculate the float //if you change "trendline" to "Vline" it will draw through oscillators too. might be fun MoveObject("CVSTART",OBJ_TRENDLINE,Time[cvstart],high_bar,Time[cvstart],Low_bar*point,Blue,1,STYLE_SOLID); MoveObject("CVEND",OBJ_TRENDLINE,Time[cvend],high_bar,Time[cvend],Low_bar*point,Blue,1,STYLE_SOLID); } //vert float predictions. These are only time based. //see blue histogram for real float values. //if you change "trendline" to "Vline" it will draw through oscillators too. might be fun if cvend-swing_time>0 then { MoveObject("swingend",OBJ_TRENDLINE,Time[(cvend-swing_time)+5],high_bar,Time[cvend-swing_time+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend",0,0,0,0);} if cvend-(swing_time*2)>0 then { MoveObject("swingend2",OBJ_TRENDLINE,Time[(cvend-(swing_time*2))+5],high_bar ,Time[cvend-(swing_time*2)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend2",0,0,0,0);} if cvend-(swing_time*3)>0 then { MoveObject("swingend3",OBJ_TRENDLINE,Time[(cvend-(swing_time*3))+5],high_bar ,Time[cvend-(swing_time*3)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend3",0,0,0,0);} if cvend-(swing_time*4)>0 then { MoveObject("swingend4",OBJ_TRENDLINE,Time[(cvend-(swing_time*4))+5],high_bar ,Time[cvend-(swing_time*4)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend4",0,0,0,0);} if cvend-(swing_time*5)>0 then { MoveObject("swingend5",OBJ_TRENDLINE,Time[(cvend-(swing_time*5))+5],high_bar ,Time[cvend-(swing_time*5)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend5",0,0,0,0);} if cvend-(swing_time*6)>0 then { MoveObject("swingend6",OBJ_TRENDLINE,Time[cvend-(swing_time*6)+5],high_bar,Time[cvend-(swing_time*6)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend6",0,0,0,0);} if cvend-(swing_time*7)>0 then { MoveObject("swingend7",OBJ_TRENDLINE,Time[cvend-(swing_time*7)+5],high_bar,Time[cvend-(swing_time*7)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend7",0,0,0,0);} if cvend-(swing_time*8)>0 then { MoveObject("swingend8",OBJ_TRENDLINE,Time[cvend-(swing_time*8)+5],high_bar,Time[cvend-(swing_time*8)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend8",0,0,0,0);} if cvend-(swing_time*9)>0 then { MoveObject("swingend9",OBJ_TRENDLINE,Time[cvend-(swing_time*9)+5],high_bar,Time[cvend-(swing_time*9)+5],Low_bar,Red,1,STYLE_DOT); } else { DelObject("swingend9",0,0,0,0);} //comment out anything you"re not using it will help with speed. If Backtesting = 1 then { SetGlobalVariable("fib23",fib23); SetGlobalVariable("fib38",fib38); SetGlobalVariable("fib50",fib50); SetGlobalVariable("fib62",fib62); SetGlobalVariable("fib76",fib76); SetGlobalVariable("dinap0",dinap0); SetGlobalVariable("dinap1",dinap1); SetGlobalVariable("dinap2",dinap2); SetGlobalVariable("dinap3",dinap3); SetGlobalVariable("dinap4",dinap4); SetGlobalVariable("dinap5",dinap5); SetGlobalVariable("swingtop",high_bar); SetGlobalVariable("swingbottom",Low_bar); SetGlobalVariable("CVSTART",CVSTART); SetGlobalVariable("CVEND",CVEND); SetGlobalVariable("FLOATV",FLOATV); SetGlobalVariable("cumulativeV",cumulativeV); SetGlobalVariable("swing_time",swing_time); SetGlobalVariable("bars_high",bars_high); SetGlobalVariable("bars_low",bars_low); if cvend-swing_time>0 then SetGlobalVariable("swingend",(cvend-swing_time)+5); if cvend-(swing_time*2)>0 then SetGlobalVariable("swingend2",cvend-(swing_time*2)+5); if cvend-(swing_time*3)>0 then SetGlobalVariable("swingend3",cvend-(swing_time*3)+5); if cvend-(swing_time*4)>0 then SetGlobalVariable("swingend4",cvend-(swing_time*4)+5); if cvend-(swing_time*5)>0 then SetGlobalVariable("swingend5",cvend-(swing_time*5)+5); if cvend-(swing_time*6)>0 then SetGlobalVariable("swingend6",cvend-(swing_time*6)+5); if cvend-(swing_time*7)>0 then SetGlobalVariable("swingend7",cvend-(swing_time*7)+5); if cvend-(swing_time*8)>0 then SetGlobalVariable("swingend8",cvend-(swing_time*8)+5); if cvend-(swing_time*9)>0 then SetGlobalVariable("swingend9",cvend-(swing_time*9)+5); };end;end;end;end;