_SECTION_BEGIN("dspascal");

SetBarsRequired(sbrAll);
Newday=Day()!=Ref(Day(),-1);
Show=ParamToggle("Show Lot Trend ?","No|Yes",0);
Show1=ParamToggle("Show Hi/Lo NetVol ?","No|Yes",0);
Show2=ParamToggle("Show OBV Avg ?","No|Yes",0);
Show3=ParamToggle("Show History ?","No|Yes",0);
FS=Param("History Font",10,5,14,1);
Avpe=Param("Number Of Lots",50,1,5000,1);
FB=ParamToggle("Ignore First Bar?","No|Yes",0);
Lot =Param("LOT Size Of The Trade",50,1,5000,1);
AVE=Param("OBV Average Periods",3,1,10,1);
Hou=Param("Start Time In Hour",9,9,23,1);
Minu=Param("Start Time In Minutes",15,0,55,1);
SEC1=Param("Start Time In Seconds",0,0,59,1);
Hou1=Param("End Time In Hour",9,9,23,1);
Minu1=Param("End Time In Minutes",45,0,55,1);
SEC2=Param("End Time In Seconds",0,0,59,1);
mytime = TimeNum();
PWAD=0;
PrevObv=0;
Hi=Max(H,Ref(C,-1));
Lo=Min(L,Ref(C,-1));
TimeFrameSet(0);
for(i=0;i<BarCount;i++)
{
if(i==0)
PWAD[i]=V[i]/Lot;
if(i>0 AND C[i]>C[i-1])
PWAD[i]=(V[i])/Lot+PWAD[i-1];
if(i>0 AND C[i]<C[i-1])
PWAD[i]=PWAD[i-1]-(V[i])/Lot;

} TimeFrameRestore(). i++) { TrendUp[i] = Null. } else if (netvol[i]<Dn[i-1]) { trend[i]=-1. TrendDown[i] = Null. if (trend[i-1] == -1) changeOfTrend = 1. trend[0]=1. Up=netvol+avpe. i <BarCount. } else { flag=0.if(i>0 AND C[i]==C[i-1]) PWAD[i]=PWAD[i-1]. } else if (trend[i-1]==-1) { trend[i]=-1. } if (trend[i]>0 && trend[i-1]<0) { . if (netvol[i]>Up[i-1]) { trend[i]=1. if(i>0 AND Newday[i]==0 AND FB==1) PWAD[i]=PWAD[i-1]. } else if (trend[i-1]==1) { trend[i]=1. } if (trend[i]<0 && trend[i-1]>0) { flag=1. flag=flagh=0. for (i = 1. trend[i]=1. Dn=netvol-avpe. if (trend[i-1] == 1) changeOfTrend = 1. TrendUp=TrendDown=Null. Netvol=round(PWAD). changeOfTrend = 0. changeOfTrend=0. changeOfTrend = 0.

flagh=1.. if (changeOfTrend == 1) { TrendDown[i-1] = TrendUp[i-1]. Col=IIf(netvol>TrendSL. for(i=0. } } } TrendSL=IIf(trend==1.TrendUp. } } k=1. } } else if (trend[i]==-1) { TrendDown[i]=Up[i]. } if(i>0 AND Newday[i]!=1) { PrevOBV[i]=PrevOBV[i-1].. } else { flagh=0. changeOfTrend = 0.i<BarCount. } if (trend[i]<0 && Up[i]>Up[i-1]) { Up[i]=Up[i-1]. if (changeOfTrend == 1) { TrendUp[i-1] = TrendDown[i-1]. changeOfTrend = 0. .IIf(netvol<TrendSL.i++) { if(i==0) { PrevOBV[i]=Netvol[i]. } if (trend[i]>0 && Dn[i]<Dn[i-1]){ Dn[i]=Dn[i-1].colorRed. } if (flag==1) { Up[i]=netvol[i]+avpe. } if (flagh==1) { Dn[i]=netvol[i]-avpe. y=0.colorBrown)). } if(i>0 AND Newday[i]==1) { PrevOBV[i]=NetVol[i-1].colorBlue.TrendDown). } if (trend[i]==1) { TrendUp[i]=Dn[i].

"MID". Cc=0.styleLine|styleThick).i++) { if( mytime[i]>Hou*10000+Minu*100+SEC1 AND mytime[i]<=Hou1*10000+Minu1*100+SEC2) Var1[i]=Max(NetVol[i]. } Var1=ValueWhen(mytime==Hou*10000+Minu*100+SEC1. Plot((NetVol).1). b=0.styleLine|styleThick).Netvol. while(k<Ave+1) { y=ValueWhen(newday==1.x=0. if(mytime[i]>Hou1*10000+Minu1*100+SEC2 OR mytime[i]<Hou*10000+Minu*100+SEC1) Var2[i]=Var2[i-1]. while(a<3) { b=ValueWhen(newday==1. Plot(TrendSL. if(mytime[i]>Hou1*10000+Minu1*100+SEC2 OR mytime[i]<Hou*10000+Minu*100+SEC1) Var1[i]=Var1[i-1].colorRed. k=k+1.styleNoLine|styleNoT itle|styleNoLabel)|styleThick). } Plot(Var1."HI".""+Avpe+" Lot Trend". x=x+y.Var1[i-1]).styleLine|styleThick|styleNoTitle).1). Var2=ValueWhen(mytime==Hou*10000+Minu*100+SEC1. Cc=Cc+b.styleLine.colorGreen.Var2[i-1]). Plot(PrevOBV.IIf(show==1. Plot((Var1+Var2)/2.NetVol."NetVol".Col.a)."LO".colorYellow. a=a+1.colorDarkRed.i<BarCount.colorBlue.prevobv.styleLine|styleThick|styleNoTitle). Plot(Var2. } a=1. if(show1==1) { ."Prev On Bal Vol".styleLine|styleThick|styleNoTitle). for(i=1.k). if( mytime[i]>Hou*10000+Minu*100+SEC1 AND mytime[i]<=Hou1*10000+Minu1*100+SEC2) Var2[i]=Min(Netvol[i].prevobv.

20.inDaily.30).Year(). .1). Locl=Lowest(C). if(Show3==1) { GfxSelectFont("Tahoma".1.0).1).-1))/Lot. GfxRoundRect(20.1)-PrevOBV)+"".875.styleLine|styleThick). GfxTextOut(NumToStr((TimeFrameGetPrice("V".colorOrange. Hinet=Highest(Netvol).Netvol. FS.450.130). Lonet=Lowest(Netvol). Hicl=Highest(C).styleL ine|styleThick). GfxTextOut(""+(LowestSince(newday==1.1).0)/Lot).styleLin e|styleThick).1)-PrevOBV)+"". GfxTextOut(""+(Netvol-PrevOBV)+"".inDaily.500.250).colorIndigo. } GfxTextOut(""+(HighestSince(newday==1.Day().1). GfxTextOut(NumToStr((TimeFrameGetPrice("V"."Lowest NetVol In Day". Plot(LowestSince(newday==1. y1=ValueWhen(Netvol==Hinet. GfxSelectSolidBrush(colorGreen).Netvol.colorViolet.colorBlack. d1=ValueWhen(Netvol==Hinet.250)."Highest NetVol In Day".0).225.C. m1=ValueWhen(Netvol==Hinet. } if(show2==1) { Plot((x/ave).1).Month().1).8. 500 ). Clpr=ValueWhen(Netvol==Hinet.styleLine|styleThick).Netvol.1).650.C.8). Clpr1=ValueWhen(Netvol==Lonet. GfxSetTextColor(colorWhite).875.Netvol.250)."" +AVE+" Period OBV Avg".Plot(HighestSince(newday==1.875." Spl OBV Avg".1. Plot(((Cc+Netvol)/3).

0). .0)+" --.0)+"/"+NumToStr(y2.125).1.Month().0)+"/"+NumToStr(m2.1).0).0. GfxTextOut("Lowest Close = "+NumToStr(Locl.25.Day().1). GfxTextOut("Highest NetVol Of Contract = "+NumToStr(Hinet. GfxSetBkMode(1).1.1). d3=ValueWhen(C==Hicl. m3=ValueWhen(C==Hicl.1). y3=ValueWhen(C==Hicl.1."+NumToStr(d3.Month().1. GfxTextOut("Close Price At The Time = "+NumToStr(Clpr.25.1. GfxTextOut("Close Price At The Time = "+NumToStr(Clpr1.Netvol.2)+" --.200).1).2).25.25.25.75). y2=ValueWhen(Netvol==Lonet. d4=ValueWhen(C==Locl.2).1.100).1.0.1.1.0)+"/"+N umToStr(m4.2)+" --. GfxTextOut("Highest Close = "+NumToStr(Hicl.0)+"/"+NumToStr(y4. GfxTextOut("NetVol At Lowest Close = "+NumToStr(Lonetvol.1.1. m2=ValueWhen(Netvol==Lonet.Day().False). GfxTextOut("Lowest NetVol Of Contract = "+NumToStr(Lonet.1. GfxTextOut("NetVol At Highest Close = "+NumToStr(Hinetvol.1.Month().Year().1).0)+" --.False).1.1).25.150).25."+NumToStr(d4.1.Year().0)+"/"+NumToStr(m1.Day().d2=ValueWhen(Netvol==Lonet.Netvol.1.1.1. } //Plot(0.Year().False).1. m4=ValueWhen(C==Locl. Lonetvol=ValueWhen(C==Locl.0)+"/"+NumToStr(y3.25. Hinetvol=ValueWhen(C==Hicl.175).25).0)+"/"+NumToStr(y1."+NumToSt r(d1.1). y4=ValueWhen(C==Locl.colorGold.0.styleLine|styleThick)."+NumToStr (d2.1). _SECTION_END().1.1).1)."".0)+"/"+ NumToStr(m3.False).50).0.