Download MetaTrader 5

Requests & Ideas - page 4

To add comments, please log in or register
Mladen Rakic
71030
Mladen Rakic  

...

You neither Never mind : the world is ours (the patience less and stubborn ones, man do I hate when i have to wait)

Anyway, it will be sorted out (see under : stubborn one )

have a nice weekend

regards

mladen

Walander:
Patience! Of course not!

I will forward test and let you know of the results. I am sure this version will work! Hopefully, with my system tests, this becomes a valuable part of my quantitative analysis I have done as of late.

Cheers,
Mladen Rakic
71030
Mladen Rakic  

...

walander,

It seems that I found that bug : in my tryouts it happened in case when account was changed and a biggest error gets accumulated when it was changed from a broker without Sunday data to a broker that does have Sunday data. The problem comes from a fact that metatrader does not free variables declared as arrays (the hiLowsin this indicator) used by the indicator when broker and/or account is changed and symbol is not (it leaves all the "wrong" values (values from the wrong broker) and in combination with an extra day, error gets accumulated).

I checked it, and double checked it and it really leaves the arrays intact in cases when broker and/or account is changed, while in all other cases it cleans up the hiLowsarray as it should. One of "those things" metatrader does

___________________________________

This is what I got in a case like that :

The upper values are the "old" way, the lower are the "new" way which checks the account number as well as the broker change in order to make sure that everything gets reset when it should. One of 'those things"

Files:
Walander
576
Walander  

Ah,

I understand. I'm surprised there's been very little interest in the use of the indicator, I'm sure you can see the definite hypothetical strategies that can be developed with such an indicator!

Thanks again Mladen, saved me probably a months worth of coding

Cheers,

Walander
576
Walander  

Preformance Issue:

I believe the changes made have made the indicator recalculate values every tick, making it extremely ineffecient.

My metatrader has slowly died during the process of openinig more 4 instances of the indicator.

Could you verify if this is true?

mladen:
walander,

It seems that I found that bug : in my tryouts it happened in case when account was changed and a biggest error gets accumulated when it was changed from a broker without Sunday data to a broker that does have Sunday data. The problem comes from a fact that metatrader does not free variables declared as arrays (the hiLowsin this indicator) used by the indicator when broker and/or account is changed and symbol is not (it leaves all the "wrong" values (values from the wrong broker) and in combination with an extra day, error gets accumulated).

I checked it, and double checked it and it really leaves the arrays intact in cases when broker and/or account is changed, while in all other cases it cleans up the hiLowsarray as it should. One of "those things" metatrader does

___________________________________

This is what I got in a case like that :

The upper values are the "old" way, the lower are the "new" way which checks the account number as well as the broker change in order to make sure that everything gets reset when it should. One of 'those things"
Mladen Rakic
71030
Mladen Rakic  

...

You are right

Download this one or just add this : if(_!="getBarNumbers") in front of this if(Period()>PERIOD_H4) return(0); (3rd line at the beginning of start function)

regards

mladen

Igor Durkin
4224
Igor Durkin  

Try to use PriceChannelZigZag_v3.2 with default settings.

Left value - current distance between tops and bottoms in pips ,

Right value - average distance.

toddanderson:
I am looking for statistics for average pip range of a zigzag move The two attached indicators are close to this. it would be interesting to see average pip count on moves up vs moves down than you could compare time frames. So it would help with targets or entry. So if you take a long entry you know on average the market will turn in X number of pips Not sure if average or median would show a difference Thanks in advance
Walander
576
Walander  

Mladen,

Can you provide me a snippet of universal code that prevents an indicator from updating every tick? Rather every bar (I didn't understand how you did it prior so I could not use the same method for a custom indicator I have built)

Cheers,

Mladen Rakic
71030
Mladen Rakic  

...

Something like this (this is the simplest way):
if (Volume[0]>1) return(0);[/php]
place it on the beginning of start() and it will update only on a first tick of a new bar. The problem with this approach is that if you just started the indicator / script / EA or you are jumping between time frames, you will have to wait till new bar forms to update because the volume is already greater than 1 (so you are going to have an "vacuum period", sort of speaking)

______________________

The safer way is something like this :
static datetime lastTime=0;

if (lastTime != Time[0])

lastTime = Time[0];

else return(0);
This one will work even in cases when it just started to work. You should do the same thing : place it at the beginning of start(). But... even this approach has it's bad sides. If the data from a chosen time frame / symbol is still not downloaded than you are going to miss the data that is going to be downloaded and shown in a moment when metatrader finishes download.

______________________

So the safest way would be this :
[php] static datetime lastTime=0;

if (lastTime != Time[0] || (Bars-IndicatorCounted())!=1)

lastTime = Time[0];

else return(0);
The idea is to do the same thing as above but only if just one bar has been changed (so only the last bar have changed) If there is more then one bar changed, it will do the work and on next tick (assuming that only current bar data has changed) it would avoid entering the rest of the job

______________________

PS: the last way will work with indicators only, since the (Bars-IndicatorCounted()) has no meaning in EAs and scripts. For that you would need to write an indicator whose only task would be to place some values you wish in cases when it would "allow" or 'prohibit" further work of an EA

regards

mladen

Walander:
Mladen,

Can you provide me a snippet of universal code that prevents an indicator from updating every tick? Rather every bar (I didn't understand how you did it prior so I could not use the same method for a custom indicator I have built)

Cheers,
toddanderson
495
toddanderson  

Thank you

Igorad,

Thank you very much for the indicator

igorad:
Try to use PriceChannelZigZag_v3.2 with default settings.

Left value - current distance between tops and bottoms in pips ,

Right value - average distance.
Walander
576
Walander  

Excellent explanation, thank you for the snippets.

I know that previously I used the volume rick update before, and experienced the very problem you outlined.

Cheers,

mladen:
Something like this (this is the simplest way):
if (Volume[0]>1) return(0);[/php]
place it on the beginning of start() and it will update only on a first tick of a new bar. The problem with this approach is that if you just started the indicator / script / EA or you are jumping between time frames, you will have to wait till new bar forms to update because the volume is already greater than 1 (so you are going to have an "vacuum period", sort of speaking)

______________________

The safer way is something like this :
static datetime lastTime=0;

if (lastTime != Time[0])

lastTime = Time[0];

else return(0);
This one will work even in cases when it just started to work. You should do the same thing : place it at the beginning of start(). But... even this approach has it's bad sides. If the data from a chosen time frame / symbol is still not downloaded than you are going to miss the data that is going to be downloaded and shown in a moment when metatrader finishes download.

______________________

So the safest way would be this :
[php] static datetime lastTime=0;

if (lastTime != Time[0] || (Bars-IndicatorCounted())!=1)

lastTime = Time[0];

else return(0);
The idea is to do the same thing as above but only if just one bar has been changed (so only the last bar have changed) If there is more then one bar changed, it will do the work and on next tick (assuming that only current bar data has changed) it would avoid entering the rest of the job

______________________

PS: the last way will work with indicators only, since the (Bars-IndicatorCounted()) has no meaning in EAs and scripts. For that you would need to write an indicator whose only task would be to place some values you wish in cases when it would "allow" or 'prohibit" further work of an EA

regards

mladen
To add comments, please log in or register