# Requests & Ideas - page 2

96279

...

Walander,

Just checking if I understand correctly :

It should show a range that was:

from 08:00 to 17:00 of periods1 length

from 17:00 to xx:xx of periods2 length

from xx:xx to yy:yy of periods3 length and so on

Am I correct?

Walander:
Hey,

I was wondering if I could request a average range indicator that can be based on any custom range based on time.

Hence you can find any daily range for any timezone. Or any range of time size back a custom amount of periods.

So an example of the indicators goal would be able to calculate the range range of say, "8:00" to "17:00" for x periods back.Or the average range of the US EST close day for x periods.

Cheers,
576

That could be a variation assuming other people who probably want variable time sizes on a continuous range basis.

My goal is.

8:00 to 13:00 = Range 1

Next Day

8:00 to 13:00 = Range 2

Next Day

8:00 to 13:00 = Range 3

Avg Range = Range 1 + Range 2 + Range 3 / Range

Customizable Start and End times or continuous time frame ranges

96279

...

Walander

I am working on it

This is just a "scratch" version : it is bloody slow (too many loops within loops - have to rewrite it in order to make it a normal indicator), so as soon as i make one that runs as it should will post it here

regards

Walander:
That could be a variation assuming other people who probably want variable time sizes on a continuous range basis.

My goal is.

8:00 to 13:00 = Range 1

Next Day

8:00 to 13:00 = Range 2

Next Day

8:00 to 13:00 = Range 3

Avg Range = Range 1 + Range 2 + Range 3 / Range

Customizable Start and End times or continuous time frame ranges

Files:
96279

...

Try this one if it is what you had in mind (no problem with the speed any more )

Parameters :
AtrDays-> number of days you want the range calculated for

AtrFrom-> starting time for high/lows determining

AtrTo-> ending time for highs/lows determining

______________________________ The way it works :
It finds highest high an lowest low for the period specified by AtrFrom and AtrTo (AtrTo time is left out of the calculation - meaning if AtrTo is, for example 13:00, than a bar at 12:59 is taken into calculation, but the one from 13:00 is not) and then calculates average range for AtrDays ranges obtained that way

Since it is limited to calculating daily ranges, it will not work for time frames > 4 hour

If you place it to 1 minute time frame, you might get something that look like an empty indicator. It happens because all the values for the specified window are the same and than metatrader shows it that way. Zoom out and you will get the "step like" look

______________________________

PS: do not use this indicator but use the one from post #17. This one has a bug when working on certain brokers which bug is corrected in the later one. Kept it here as a reminder to myself not to rush without thorough testing

regards

Files:
atr.gif 12 kb
576

I am amazed at your program design skills. I tried doing this, and I think I had about 100+ more lines of code, let alone calculating it properly. I will try it out! Thanks!

96279

...

I must admit that this indicator caused me a serious hart attack :)

_______________________________

The reason is simple : I was testing the indicator on one broker, and everything went smooth. And then I jumped to another broker, and what did I get : rubbish, an absolute rubbish. As a proof a picture of it (upper is how it should look like and a lower is the one that caused me a hart attack) Took me some time to understand what happened : Sunday data. But it could be any day which does not have data that satisfies the time filter.

To cut the story short, here is the corrected one. What it does is that when there is no data for some days (like those Sundays when it effectively could not find any data that satisfied the time filter) it skips it and goes to previous day (and so on, and so on...)

_______________________________

Hope you did not get the similar hart attack as I did :)

regards

Walander:
Mladen, I am amazed at your program design skills. I tried doing this, and I think I had about 100+ more lines of code, let alone calculating it properly. I will try it out! Thanks!
Files:
atr_1.gif 16 kb
576

You're right.

I did have a heart attack doing this, because of the syntax that metatrader has.

It makes it nearly impossible to do this effeciently, which is very annoying.

Also, one more error. Say if im trying to have London Close Day Average Range on +1 Broker. The hours are from Start 01:00 end 01:00

This is where I truly got a heart attack, I don't know anyway around this.

96279

...

Will cook some solution for that too

Walander:
You're right.

I did have a heart attack doing this, because of the syntax that metatrader has.

It makes it nearly impossible to do this effeciently, which is very annoying.

Also, one more error. Say if im trying to have London Close Day Average Range on +1 Broker. The hours are from Start 01:00 end 01:00

This is where I truly got a heart attack, I don't know anyway around this.
576

Yours I'm sure will be elegant, mine will be filled over 100 conditional statements

96279

...

Walander,

I think this is the one

_________________________