Elite indicators :) - page 184

Fudomyo
89
Fudomyo  
mladen:
Mike Here it is
regards Mladen

This looks very interesting. Thanks

bbjurek
67
bbjurek  

Add channel

mrtools:
Did a jurik rsx mod of trendstrength .

mrtools,

is it possible to add channel on this indicator, similary as rsx channel on oma?

bbjurek

Hercs
2970
Hercs  

DTosc message...

Mladen,

I get a message in the Expers Folder that says......."incorrect start position 10148 for Array Maximum function" - the indicator seems to behave perfectly though.

Any explanation please?

Thanking you in advance.

Mladen Rakic
151615
Mladen Rakic  

ValeoFX

Without knowing which indicator it is about, it usually is something like this Find where the limit is determined and change it to something like this :

limit=MathMin(Bars-counted_bars,Bars-1);

The second parameter in this expression (Bars-1) in this case ensures that limit is not greater than the number of bars on chart.

But, as you already have noticed, it is a "benign" error : it will happen only once (when the indicator is loaded or when the time frame is changed) and, unlike some other errors, it does not stop indicator calculation so all the rest of calculation is done correctly and values are calculated properly

regards

mladen

ValeoFX:
Mladen,

I get a message in the Expers Folder that says......."incorrect start position 10148 for Array Maximum function" - the indicator seems to behave perfectly though.

Any explanation please?

Thanking you in advance.
Hercs
2970
Hercs  

Thanks...

mladen:
ValeoFX

Without knowing which indicator it is about, it usually is something like this Find where the limit is determined and change it to something like this :

limit=MathMin(Bars-counted_bars,Bars-1);

The second parameter in this expression (Bars-1) in this case ensures that limit is not greater than the number of bars on chart.

But, as you already have noticed, it is a "benign" error : it will happen only once (when the indicator is loaded or when the time frame is changed) and, unlike some other errors, it does not stop indicator calculation so all the rest of calculation is done correctly and values are calculated properly

regards

mladen

======================

Sorry Mladen, I had the name of the indicator in the "Title" window (DTOsc) and did not think to repeat it again. However, thank you for the explanation - I will look at it immediately.

On Line 124 I found:

limit = MathMax(limit,MathMin(Bars,iCustom(NULL,timeFrame,IndicatorFileName,"getBarsCount",0,0)*timeFrame/Period()));

As it is different to what you suggested, would you mind elaborating on what I should do to rectify it, please?

Much appreciated.

Mladen Rakic
151615
Mladen Rakic  

ValeoFX

I did not pay attention to the subtitle of the message, sorry

Anyway, if you are using the one from this post : https://www.mql5.com/en/forum/general then you are getting that message

On the other hand, if you are using the one from this post : https://www.mql5.com/en/forum/general (the newer one) then you are not going to get that message

I do not remember when exactly did I make the one from the first post but have changed some coding styles since (hence the lack of that error message) and frankly, before I did not care too much for that error message since it really does not change anything. After that I simply decided not to leave any space for any eventual errors, hence the "safety check" when determining the limit

____________________________________

PS: that line works in multi time frame mode. It 'asks" the target time frame how many bars have changed in the target time frame in order to be able to recalculate the exact number of bars in current time frame needed. So that line is effective only when in mtf mode

Manu
81
Manu  

mladen,

I'm new in coding. And its difficult. But if I have only CodersGuru's book to do an EA....... won't be enough...

see my post page 183

Mladen Rakic
151615
Mladen Rakic  

Tradefx1

Of the daily trend you are trying to find : you need to redefine it (rewrite it). Right now it is written like this :

int GetDailyTrend (int res){

double MA5_1 = double iMA(NULL,1440,5,0,1,0,1);

double MA5_0 = double iMA(NULL,1440,5,0,1,0,0);

double MA8_1 = double iMA(NULL,1440,8,0,1,0,1);

double MA8_0 = double iMA(NULL,1440,8,0,1,0,0);

if (MA5_1 MA8_0) res =1;//Cross up

if (MA5_1 > MA8_1 && MA5_0 < MA8_0) res =2;//Cross down

BarCount=Bars;

return (res);

}[/php]and you are calling it like this :

if (GetDailyTrend(1) && ...) Order = SIGBNAL_BUY;

if (GetDailyTrend(2) && ...) Order = SIGNAL_SELL;

[/php]The way it is used and called now expressions GetDailyTrend(1) and GetDailyTrend(2) are always true (in metatrader any value not equal to 0 is considered a true.

_________________________

Redefine the GetDailyTrend() to something like this:

[php]int GetDailyTrend ()

{

int res = 0;

double MA5_1 = double iMA(NULL,1440,5,0,1,0,1);

double MA5_0 = double iMA(NULL,1440,5,0,1,0,0);

double MA8_1 = double iMA(NULL,1440,8,0,1,0,1);

double MA8_0 = double iMA(NULL,1440,8,0,1,0,0);

if (MA5_1 MA8_0) res =1;//Cross up

if (MA5_1 > MA8_1 && MA5_0 < MA8_0) res =2;//Cross down

return (res);

}

And then use it this way :

[php]if (GetDailyTrend()==1 && ...) Order = SIGBNAL_BUY;

if (GetDailyTrend()==2 && ...) Order = SIGNAL_SELL;

_________________________

As of book and coding : I have always believed that the best way to learn coding is from examples and working programs. Believe it or not but Microsoft people are excellent to learn from (they do write the code uniformly (which means that they have firm team rules how the code should be written) very clean and they are trying to make it as efficient as they can).

There are a lot of examples and working EAs in elite section that anybody can use (I can recommend you this one https://www.mql5.com/en/forum/180383 ) for reasons I stated at that thread already and I think it can easily be used as a "frame" for other EAs. But also, there is a lot of other very useful EAs that can be used to learn and to make working EAs.

And always remember one thing : coding languages are exactly that : "languages". Which means it is a simple talk as any other talk. Just be careful what do you "tell" to computer because computer, unlike people, does not question what you tell it but simply executes it (and then sometimes it is not what we want it to do ) And then, after some time, you get used to "talk" to PC and then everything gets much easier

Mladen Rakic
151615
Mladen Rakic  

Just in case ...

In case someone is wondering what is the basic logic behind the adxvma indicator, here is one middle step of it that might be as useful as the indicator itself. (there are additional steps after this one, so do not compare the 2 indicators, but this step seems particularly interesting)

If it seems familiar to anyone, the answer is "yes". It seems that it is the power trend indicator (the "real" power trend, not the ones that are posted and published as it - of this I am not 100% sure (all I have seen from the "real" one are pictures of it), but it sure as hell looks a lot like it)
Files:
Hercs
2970
Hercs  
mladen:
ValeoFX

I did not pay attention to the subtitle of the message, sorry

Anyway, if you are using the one from this post : https://www.mql5.com/en/forum/general then you are getting that message

On the other hand, if you are using the one from this post : https://www.mql5.com/en/forum/general (the newer one) then you are not going to get that message

I do not remember when exactly did I make the one from the first post but have changed some coding styles since (hence the lack of that error message) and frankly, before I did not care too much for that error message since it really does not change anything. After that I simply decided not to leave any space for any eventual errors, hence the "safety check" when determining the limit

____________________________________

PS: that line works in multi time frame mode. It 'asks" the target time frame how many bars have changed in the target time frame in order to be able to recalculate the exact number of bars in current time frame needed. So that line is effective only when in mtf mode

=========================================================

Thanks very much for the explanation. Much appreciated and also helping me to understand the coding better.

I will download the 2nd one immediately.

Best wishes.