Finding Monthly HIGH without today's data


This one should do that.

/// Version 1
/// @link https://forum.amibroker.com/t/finding-monthly-high-without-todays-data/10680/7
mth = Month();
newmth = mth != Ref(mth,-1);
///
tmfrm = inDaily;
mthhigh = HighestSince(newmth, H);
yest_mthhigh = TimeFrameCompress(mthhigh, tmfrm, compressHigh);
yest_mthhigh = TimeFrameExpand(yest_mthhigh, tmfrm, expandLast);
///
Plot(C, "Price", colorDefault, styleCandle);
PlotGrid(LastValue(yest_mthhigh),colorGreen,8,4,True);

And another way...

/// Version 2
/// @link https://forum.amibroker.com/t/finding-monthly-high-without-todays-data/10680/7
mth = Month();
newmth = mth != Ref(mth,-1);
///
dn = DateNum();
newday = dn != Ref(dn,-1);
daybars = BarsSince(newday)+1;
///
mthhigh = HighestSince(newmth, H);
yest_mthhigh = Ref(mthhigh, -daybars);
///
Plot( C, "Price", colorDefault, styleCandle);
PlotGrid(LastValue(yest_mthhigh),colorGreen,8,4,True);
2 Likes