I have a problem to create the midlines for the VWAP bands based on a translation of a related pine script. The code is like follows
start = ParamTime( "Start Time", "09:30" );
quot1 = Param( "quot1", 1.00, 0.10, 10.00, 0.01 );
Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == start, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) / TodayVolume,0);
Plot (VWAP,"VWAP",coloryellow, styleThick);
bandBasis = VWAP * 0.01;
Val1 = sqrt(VWAP)*quot1;
Val11 = VWAP + Val1;
Val12 = VWAP - Val1;
Plot (Val11,"Val11",colorred, styleThick|styledashed);
Plot (Val12,"Val12",colorgreen, styleThick|styledashed);
midup=middn=0;
//problem starts here:
midup == VWAP + bandBasis * (quot1 * 0.5);
middn == VWAP - bandBasis * (quot1 * 0.5);
Plot (midup,"midup",coloryellow, styledashed);
Plot (middn,"middn",coloryellow, styledashed);
_SECTION_END();
``
The VWAP and the bands are drawn as expected but then the midlines fail and seem to end in a zero line...
Thank you for assistance !
type or paste code here
type or paste code here