0

I am using the following AFL code for "Initial Balance with Range Extension" in AmiBroker -

_SECTION_BEGIN("Initial Balance with Range Extensions");

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;

IB1xh  = IBHigh+IBrange ; // Target 1 for range extension upside
IB2xh  = IBHigh+2*IBrange ;
IB3xh  = IBHigh+3*IBrange ;
IB1xl  = IBLow-IBrange ;
IB2xl  = IBLow-2*IBrange ; // target 1 for range extension downside
IB3xl  = IBLow-3*IBrange ;

PlotGrid(LastValue(IBHigh, True), colorPlum, pattern=10, width = 2, label = True); 
PlotGrid(LastValue(IBLow, True), colorPlum, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IBM, True), colorBrown, pattern=10, width = 2, label = True);  

PlotGrid(LastValue(IB1xh, True), colorGreen, pattern=10, width = 2, label = True); 
PlotGrid(LastValue(IB2xh, True), colorGreen, pattern=10, width = 2, label = True); 
PlotGrid(LastValue(IB3xh, True), colorGreen, pattern=10, width = 2, label = True); 
PlotGrid(LastValue(IB1xl, True), colorRed, pattern=10, width = 2, label = True); 
PlotGrid(LastValue(IB2xl, True), colorRed, pattern=10, width = 2, label = True); 
PlotGrid(LastValue(IB3xl, True), colorRed, pattern=10, width = 2, label = True); 

_SECTION_END();

This code is plotting continuous horizontal lines. But I need disjointed horizontal lines for individual sessions. How can I get that? Please help me to fix this issue. Thanks for your time and effort. Regards.

0 Answers0