Initial Balance Overlay

#1
Hi, following is the code for "Initial Balance Overlay". Though it is plotting, but not properly. Can anyone here please fix the code. Thanks in advance. Regards.

Code:
_SECTION_BEGIN("Initial Balance");
Today = Day() == LastValue( Day() );

P11   = Param("IB  Start Time",091500, 0 , 235959, 1 ) ; 
P12   = Param("IB   END Time",101500, 0 , 235959, 1 ) ;
START = (TimeNum()>= P11);
END   = (TimeNum()<= P12);
ZONE  = START AND END;
ST    = (TimeNum()>= P12);
NewTime = ZONE!= Ref(ZONE, -1);
highestoftheday = HighestSince(NewTime,H,1);
Lowestoftheday  = LowestSince(NewTime,L,1);
IBHigh   = ValueWhen(ZONE,highestoftheday,1);
IBLow    = ValueWhen(ZONE,lowestoftheday,1);
ORBClose  = ValueWhen(zone,C,1);
 
IBrange = IBHigh - IBLow; // First Hour Range
IBM = IBLow+IBrange/2;

Plot(IIf(Today, IBHigh, Null), "IB-High", colorPlum, styleLine | styleNoLabel);
Plot(IIf(Today, IBLow, Null), "IB-Low", colorPlum, styleLine | styleNoLabel);
Plot(IIf(Today, IBM, Null), "IB-Median", colorPlum, styleDashed | styleNoLabel, width=2); 

_SECTION_END();
 

Similar threads