Hi Sir,
Thanks for the above information, it was very much helpful in resolving my issue... But I couldnt get u as how to do the check for the Custom Indicator in the init() method...
Is there any method that we can call for this... Could you please explain this...
Thanks n Regards
Ganesh
Hello,
A study has been made on this forum (or articles) about embedding the indicators in the EA and I remember it doesn't worth the doing in terms of speed, the only advantage is to have all the code in one set.
It is better for you to modify your indicators to accept parameters so you will pass those in the same manner you using iMA, iFractals, iCCI, ... and yes if you want to let the user change the value you will have to create extern data but what's the problem? I don't think there is a limit, it is just memory allocation as for other data.
-> To read the indicator value(s) at a specific bar, you usually use the shift parameter (see the iMA parameters description).
Hope it helps a little.
This seems to being a common issue. I tried several times using the iCustom Function without success. It seems a complex solution to a simple problem. Why can't the indicators just allow definition of an external array thereby giving access to the EA?
What I want to do is solved by the following. If there is another way to accomplish this please post it. Thanks.
//
// EA Code
double IndArray[];
// Indicator Code
extern IndArray[];
N="SomeCalculatedValue"
for (i=0;i< 10;i++)
{
IndArray[i]=N;
}
You could adopt the method of placing indicator code in the EA but:-
1) There is a significant performance disadvantage
2) If you make a mistake in the indi code, its very difficult to spot - with iCustom you can view the indi on a chart to prove it works
> Why can't the indicators just allow definition of an external array thereby giving access to the EA
Well, again this would not be efficient for memory use
So... try again with iCustom!
Good Luck
-BB-
>>efficiency
Sometimes it is preferable to optimize human efficiency over computer resource efficiency.
Just saying...
RS
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When writing an EA we often need the values of indicators to base our decisions on. for the standard indicators we can easily use the built-in functions such as iMA, iFractals, iCCI, etc. For custom indicators I know of 2 ways:
Regarding the iCustom method of doing things, this could become quite challenging if you have to use a number of indicators. The reason being that for each custom indicator you need the input values. Yes, you can hard-code these values but most of the time you need to allow the user to change them so now we end up having to create an extern for each indicator parameter we need. Before you know it you could end up having your EA scattered with extern variables and things could get quite messy. A concern that come to mind is this: Is there a limit on the max number of extern variables one can declare?
This brings me to the point of my discussion. Is there a way to read the value of an indicator at a specific bar? The information is stored somewhere as is evident by the fact that the data window readily displays the indicator index values. The question is whether this data is only available to MetaTrader internally or is there some way for us to read these values. If so, things could be drastically simplified. Instead of having to reproduce indicator calculations at EA level we can structure our EA as follows: