Quarterly Open, High, Low, Close  [SOLVED]

Questions about MultiCharts and user contributed studies.
mickatrade
Posts: 93
Joined: 12 Jul 2015
Has thanked: 18 times
Been thanked: 14 times

Quarterly Open, High, Low, Close

Postby mickatrade » 26 Feb 2018

Hello,

I'm looking for reserved words for Quarterly Open, quarterly high, quarterly low, quarterly close but i can't find them.
Does someone have a custom code for them or can help me to code them ?
I think it would be nice to have those reserved word on future versions of MC.
Regards.
MJ

User avatar
fbertram
Posts: 161
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 37 times
Been thanked: 66 times
Contact:

Re: Quarterly Open, High, Low, Close

Postby fbertram » 26 Feb 2018

Hi MJ,

while I no longer have a PowerLanguage version of MultiCharts available to me (I converted to .NET) and therefore can't test my response, you will need to code something along the lines of this:

Code: Select all

vars:
   monthSeries, quarterlyHigh;
monthSeries = Month(DateTime);

if (Floor((monthSeries[0] - 1) / 4) > Floor((monthSeries[1] - 1)/4)) then begin
   // a new quarter just began
   quarterlyHigh = High[0];
end else begin
   // we are somewhere within a quarter
   quarterlyHigh = MaxList(quarterlyHigh, High[0]);
end;


I hope this gets you going,
Cheers,

Felix

mickatrade
Posts: 93
Joined: 12 Jul 2015
Has thanked: 18 times
Been thanked: 14 times

Re: Quarterly Open, High, Low, Close

Postby mickatrade » 27 Feb 2018

Hello Felix,
Thank you for your help.
Here the indicator.
I'll have to customise your code to get what i want.
quarterly indicator.png
quarterly indicator.png (54.85 KiB) Viewed 144 times

mickatrade
Posts: 93
Joined: 12 Jul 2015
Has thanked: 18 times
Been thanked: 14 times

Re: Quarterly Open, High, Low, Close

Postby mickatrade » 27 Feb 2018

This is what i want to do.
The indicator plots the high and the low of the previous month.
I need to do the same but with previous quarterly high and low.
previous month low and high.png
previous month low and high.png (61.75 KiB) Viewed 143 times

User avatar
fbertram
Posts: 161
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 37 times
Been thanked: 66 times
Contact:

Re: Quarterly Open, High, Low, Close

Postby fbertram » 27 Feb 2018

Hi MJ,

so looking at your chart it seems that you'd like a function to return the open/high/low/close of the *previous* quarter. That's easy to do, just change the code to this:

Code: Select all

vars:
   monthSeries, quarterlyHigh, prevQuarterlyHigh;
monthSeries = Month(DateTime);

if (Floor((monthSeries[0] - 1) / 4) > Floor((monthSeries[1] - 1)/4)) then begin
   // a new quarter just began
   prevQuarterlyHigh = quarterlyHigh;
   quarterlyHigh = High[0];
end else begin
   // we are somewhere within a quarter
   quarterlyHigh = MaxList(quarterlyHigh, High[0]);
end;


Cheers, Felix
These users thanked the author fbertram for the post:
mickatrade

mickatrade
Posts: 93
Joined: 12 Jul 2015
Has thanked: 18 times
Been thanked: 14 times

Re: Quarterly Open, High, Low, Close

Postby mickatrade » 28 Feb 2018

fbertram wrote:Hi MJ,

so looking at your chart it seems that you'd like a function to return the open/high/low/close of the *previous* quarter. That's easy to do, just change the code to this:

Code: Select all

vars:
   monthSeries, quarterlyHigh, prevQuarterlyHigh;
monthSeries = Month(DateTime);

if (Floor((monthSeries[0] - 1) / 4) > Floor((monthSeries[1] - 1)/4)) then begin
   // a new quarter just began
   prevQuarterlyHigh = quarterlyHigh;
   quarterlyHigh = High[0];
end else begin
   // we are somewhere within a quarter
   quarterlyHigh = MaxList(quarterlyHigh, High[0]);
end;


Cheers, Felix


Hi felix,
Thank you for your updated code, it seems the behavior of the indicator is not good.
see the picture attached.
Regards,
MJ
quarterly2.png
quarterly2.png (135.9 KiB) Viewed 127 times

mickatrade
Posts: 93
Joined: 12 Jul 2015
Has thanked: 18 times
Been thanked: 14 times

Re: Quarterly Open, High, Low, Close  [SOLVED]

Postby mickatrade » 28 Feb 2018

Hello,
I've managed to do it.
I've modified OHLCperiodago to do it.
Finally i've created HighQ and LowQ :)
code.png
code.png (106.79 KiB) Viewed 124 times

HighQ.png
HighQ.png (24.48 KiB) Viewed 124 times

quarterlyindicator.png
quarterlyindicator.png (11.16 KiB) Viewed 124 times


Return to “MultiCharts”