Average Daily Range Calculation question  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
jorsde
Posts: 10
Joined: 01 Apr 2014
Has thanked: 5 times

Average Daily Range Calculation question

Postby jorsde » 27 Apr 2014

Hi

I want to build a simple indicator that will calculate the average daily range (of the ~last 4 months) and plot it in the chart.
I want to write a simple function that will looks something like
Result = (Σ(day's high - Day's low) ) / 88 (around 88 trading days)

However , I can't find how can I retrieve the daily high and low.
AFAIK using Bars.StatusLine.High ,Bars.High or AverageFC won't help because they retrieve the bars (not necessary the daily high or lows).


Is there a simple way to retrieve the day's high and low ?

Thank you

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Average Daily Range Calculation question

Postby JoshM » 30 Apr 2014

However , I can't find how can I retrieve the daily high and low.
AFAIK using Bars.StatusLine.High ,Bars.High or AverageFC won't help because they retrieve the bars (not necessary the daily high or lows).

Is there a simple way to retrieve the day's high and low ?
You can store the daily high/low in a variable that keeps track of these values through out the day. I posted an example for that here.

jorsde
Posts: 10
Joined: 01 Apr 2014
Has thanked: 5 times

Re: Average Daily Range Calculation question

Postby jorsde » 01 May 2014

The solution you gave will work but is there a simple way to get a specific day High/low ?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Average Daily Range Calculation question  [SOLVED]

Postby JoshM » 01 May 2014

The solution you gave will work but is there a simple way to get a specific day High/low ?
Not that I'm aware of, unless there is some PowerLanguage .NET property that returns that specific value. Even in the simple PowerLanguage (default MultiCharts) you'll need to do the three things from that example.

I'm not sure how to make it more simpler than referring to an example.

jorsde
Posts: 10
Joined: 01 Apr 2014
Has thanked: 5 times

Re: Average Daily Range Calculation question

Postby jorsde » 02 May 2014

The code you've posted only checks the current session, however I want to calculate the high/low that was 2 days ago or 100 days ago.
I want to calculate the average range during the last 2/3 months.

How can I get this data ?

Thank you

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Average Daily Range Calculation question

Postby Henry MultiСharts » 13 May 2014

jorsde, have you tried using the prebuilt HighD, LowD functions?

jorsde
Posts: 10
Joined: 01 Apr 2014
Has thanked: 5 times

Re: Average Daily Range Calculation question

Postby jorsde » 13 May 2014

I've found a way to solve it as JoshM suggested but I think a simple function (or functions) which will retrieve this information will serve a lot of users because I can think of a lot of uses for it.

Thank you


Return to “MultiCharts .NET”