This looks very interesting. Thanks
is it possible to add channel on this indicator, similary as rsx channel on oma?
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.
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 :
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
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?
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
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
Of the daily trend you are trying to find : you need to redefine it (rewrite it). Right now it is written like this :
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
}[/php]and you are calling it like this :
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;
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
Just in case ...
Thanks very much for the explanation. Much appreciated and also helping me to understand the coding better.
I will download the 2nd one immediately.