Need help to debug the afl or any new way to compare yesterday first 15min low high with low high of rest of the day

Hi seniors,
I am not pro in coding, but i tried to code for comparing last day first 15 min high low with low high of rest of the day.
After deploying the afl, it is capturing last day first 15 min either low or high, but not capturing both low high of candle ( as you can see in attached picture) instead of one part it is capturing from prev candle.
CODE is following :
TimeFrameSet(in15Minute);
TimeFrameInMinutes = 1;
ppl = ParamToggle( "IB_LEVELS", "Off|On", 1 );
pplxt = ParamToggle( "IB _LEVELSExtn", "Off|On", 0 );
P11 = ParamTime( "IB Start Time", "09:14:59") ;
P12 = ParamTime( "IB END Time", "09:29:59" );

tn = TimeNum();

START = tn > P11;
END = tn <= P12;
ZONE = START AND END;
ST = tn >= P12;
NewTime = Ref (ZONE,-1)==ZONE;
highestoftheday = HighestSince( NewTime, H, 1 );
Lowestoftheday = LowestSince( NewTime, L, 1 );

IBHigh = ValueWhen( ZONE, highestoftheday, 1 );
IBLow = ValueWhen( ZONE, lowestoftheday, 1);

AddColumn( IBHigh, "High of time window", 1.2 );
AddColumn( IBLow, "Low of time window", 1.2 );

Plot( Close, "Price", colorDefault, styleCandle );

Capture prevHigh = TimeFrameGetPrice("High",inDaily,-1);
prevLow = TimeFrameGetPrice("Low",inDaily,-1);

Plot(IBHigh, "Prev Day 1st candle High", colorRed, styleLine);
Plot(IBLow, "Prev Day 1st candle Low", colorGreen, styleLine);

What is the original time frame of the chart?

It's 15 min chart. Since my requirement is for first 15 min

Actually I want to check last day congestion period through above AFL. Most of the time if stock moves in very tight range and give breakout next day then nice move generally comes.

@kislay then use 15 minute in Analysis window and find first bar of day values,

dn = DateNum();
//dn = Day(); // alternate method
newDay = dn != Ref( dn, -1 );

FirstBarOpen = ValueWhen( newday, Open );
FirstBarHigh = ValueWhen( newday, High);
FirstBarLow = ValueWhen( newday, Low );
FirstBarClose = ValueWhen( newday, Close);
FirstBarVolume = ValueWhen( newday, Volume);

YesterdayFBO = ValueWhen( newday, Open, 2 );
YesterdayFBH = ValueWhen( newday, High, 2);
YesterdayFBL = ValueWhen( newday, Low, 2 );
YesterdayFBC = ValueWhen( newday, Close, 2);
YesterdayFBV = ValueWhen( newday, Volume, 2);

2 Likes

Thanx @portfoliobuilder .
Lastly i got the answer . I have tried other forums also but no coder helped me to rectify the problem. Coders like you who is sparing their precious time to solving others problem .....making this amiborker dedicated forum really strong. I will also try to help other trader with my limited knowledge of coding.
Final result of my idea is
Capture

:pray:

2 Likes

Thanx @ travick for showing interest in afl
:pray:

1 Like

can you share correct afl please

@kislay can u share complete and correct afl here please