Finding Monthly HIGH without today's data

I am working with 3 mins time frame chart. I want to draw monthly HIGH and monthly LOW on this chart.
If the today HIGH is also monthly HIGH, I can not see what was monthly HIGH as today's HIGH is overwriting earlier monthly HIGH.
Please suggest how find monthly HIGH without considering today's data (monthly HIGH till yesterday).

The code I am using to find monthly HIGH is given below. It finds monthly HIGH till today.

tfm= inMonthly;
TimeFrameSet( tfm ); 

You can try and test certain combinations of line width and line style with contrasting colors as one way of plotting and overlap.


I can get this with

PlotGrid( LastValue( H), colorBrightGreen, 10, 1, True );
PlotGrid( LastValue( H), colorRed,          9, 1, True );

This appears to be a simple resolve, otherwise there are more complex ways in which you can detect the same values and plottext or alert yourself of an overlap.

Your piece of code should go in between, Please confirm.

tfm= inMonthly;
your code here ? 

I want monthly HIGH excluding today's data.

In the code I provided, you just have to make sure that the two lines appear in the order as shown above.

My approach would be different however.

dHigh = LastValue( TimeFrameGetPrice( "H", inDaily  ));
mHigh = LastValue( TimeFrameGetPrice( "H", inMonthly));

PlotGrid( dHigh, colorBrightGreen, 10, 1, True );
PlotGrid( mHigh, colorRed,          9, 1, True );

This piece of code draws daily HIGH & Monthly HIGH which do include TODAY's data for calculation.
My requirement is finding monthly HIGH which do not consider today's data. Monthly HIGH till last day excluding today.

As if we are on Yesterday and finding Monthly HIGH.

This one should do that.

/// Version 1
/// @link
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);

And another way...

/// Version 2
/// @link
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);

Thank you.
Can you clarify following point please.
The Monthly HIGH will be for a calendar month or for 30 days?

By Calendar month, I mean.. as of today on 8th Jan, it will find monthly HIGH for 1st Jan to 7th Jan.
I am looking for 30 days irrespective of the today's date.

You know what...

Help yourself. Enough is enough.

The whole time your were talking about monthly. You even used inMonthly in your first post and following ones. You said monthly High/low all the time. Nowhere, I mean nowhere anywhere was any mention of "not calendar month but n-days high/low"!

Monthly means as per calendar month but not some days span!
Surprise, surprise.

Now all of the sudden guy wants 30 days period (no matter from where it starts) instead of calendar month.

If you like wasting time of others or playing games then go to different forum!
This is not kiddy forum!


Such users should really get ignored to give responses to until they eventually get it how to properly ask for something.

Enough is enough. Expecting and getting free code which takes time but showing complete disrespect by playing "Let's hide important information" games the whole time.

How about checking yourself?! What do you think do "newmth" & "mthhigh" variables mean? Output them. Too much work on your hand? Me too.

1 Like

Thank you very much for helping me with your expertise and effort.
I was under the impression, MONTHLY means 30 days. Now I understand it is calendar month. After going through the code given by you I understood, it is not.

However, the pointer given by you helped me to code for this requirement.

I want to share the code I had written to find monthly HIGH excluding today's data.

tfdd= inDaily;
TimeFrameSet( tfdd );
if (mhigh<1.03*LastValue(C)) {
PlotText("MHIGH:"+mhigh, BarCount-170,mhigh , colorRed);
1 Like

This is wrong. The solutions are the monthly high codes I was posting. Not even single appreciation click on top but just copy & pasting.

Your code is not a solution because it is flawed and got nothing to do with thread topic monthly!

OK, I am giving a like to one of your responses.