I have coded to get high low (15 minutes intervals) of 3 time periods during the intraday.
a. 9:15am - 9:30am
b. 12.15pm - 12.30pm
c. 14.30pm - 14.30pm
when I am in say 1min TF, i get certain high low values. when I change the TF to 5min, the values changes and again it changes when I am in 15min TF.
Can you please help me identify what changes i should do so that the High Low values across 1min, 5min and 15min Timeframe, they remain static whenever i change the TF between 1m, 5m or 15, I am not switching to 30min or higher timeframe.
SetBarsRequired(86400 / Max(1, Interval() ), -1 );
SetChartOptions(0,chartShowDates|chartShowArrows|chartWrapTitle); //chartLogarithmic
GraphXSpace = 10;
dn = DateNum();
tn = TimeNum();
Today = dn != Ref(dn, -1);
marketOpenTime = ValueWhen(Today, tn,1);
// High Low of 09:15 till 09:30
StartTime = MarketOpenTime;
EndTime = StartTime + 15*100;
StartBar = tn == StartTime;
EndBar = tn == EndTime;
H0930 = IIf(tn < EndTime, Null, ValueWhen( EndBar, HighestSince( StartBar, High ) ));
L0930 = IIf(tn < EndTime, Null, ValueWhen( EndBar, LowestSince( StartBar, Low ) ));
// High low of 12:15 to 12:30
StartTime = 121500;
EndTime = StartTime + 15*100;
StartBar = tn == StartTime;
EndBar = tn == EndTime;
H1230 = IIf(tn < EndTime, Null, ValueWhen( EndBar, HighestSince( StartBar, High ) ));
L1230 = IIf(tn < EndTime, Null, ValueWhen( EndBar, LowestSince( StartBar, Low ) ));
// High Low fo 14:15 till 14:30
StartTime = 141500; EndTime = StartTime + 15*100; // 10.30am
StartBar = tn == StartTime; EndBar = tn == EndTime;
H1430 = IIf(tn < EndTime, Null, ValueWhen( EndBar, HighestSince( StartBar, High ) ));
L1430 = IIf(tn < EndTime, Null, ValueWhen( EndBar, LowestSince( StartBar, Low ) ));
Plot(C,"",colorBlack,styleCandle);
PlotGrid( SelectedValue(C), colorWhite, pattern =1, width=1,False);
hlstyle = styleDashed|styleLine|styleNoRescale|styleNoTitle;
hlstyle2 = styleDashed|styleLine|styleNoRescale|styleNoTitle|styleThick;
hlstyle3 = styleDots|styleLine|styleNoRescale|styleNoTitle;
Plot( h0930, "0930amH", colorBlue, hlstyle );
Plot( l0930, "0930amL", colorPlum, hlstyle );
Plot( h1230, "1230pmH", colorBlue, hlstyle2 );
Plot( l1230, "1230pmL", colorPlum, hlstyle2 );
Plot( h1430, "1430pmH", colorBlue, hlstyle3 );
Plot( l1430, "1430pmL", colorPlum, hlstyle3 );
pdc = TimeFrameGetPrice( "Close", inDaily, -1, expandFirst);
colortext = colorBlack;
//========================================================================================================
// Chart Title ----
//========================================================================================================
Title = EncodeColor( colortext ) + Name() + " - " + EncodeColor( colorText ) + Interval( 2 ) +
" - " + Date() + " - " + EncodeColor( colorText ) +
"O: " + O + " " + "H: " + H + " " +
"L: " + L + " " + "C: " + C + " (" +
NumToStr( 100*( C - pdc) / pdc, 1.2) + " % ) " +
"\n 09:30AM H: " + NumToStr( H0930, 1.2 ) + " L: " + NumToStr( L0930, 1.2 ) +
"\n 12:30PM H: " + NumToStr( H1230, 1.2 ) + " L: " + NumToStr( L1230, 1.2 ) +
"\n 14:30PM H: " + NumToStr( H1430, 1.2 ) + " L: " + NumToStr( L1430, 1.2 )
;
// ================================================