Trying to explain all that here will be very time consuming and require too much text!
Since, there are many, many examples of EAs in the Code Base that you can study in order to learn how to use iCustom() and in particular with moving averages, it will be easier and better for your learning, if you just search the Code Base for EAs that work similarly to what you want. You can then analyse them and experiment with them in order to learn and understand the functionality, which you can then apply to your own EA.
int OnInit() { ma1=iCustom(NULL,0,"myindicator",1,0); ma2=iCustom(NULL,0,"myindicator",2,0);
Ma1 and ma2 are constant, set when you first loaded the EA. Event Handling Functions - Functions - Language Basics - MQL4 Reference
- write a self documenting function instead of calling iCustom directly, see Detailed explanation of iCustom - MQL4 forum
Hello I got it working but I am having some problems simulating on strategy tester.
On simulation there is three settings // on every tick, control points and open bar.
My results are considerably different depending on which setting I select. Say if I wanted to test this EA on a 30 minute time frame when I select every tick it says using 1 minute data..on the window(I thought everytick would be most realistic but it does not seem to be) Then when I select open bar then again I get wrong results, Control points I am not sure what data this is using.
I would just like to know what setting should I be using to simulate results of a 30 minute bar time frame as if it was in real time.
Also when I open a different window with the indicator only while running the EA on a separate chart the two indicators look completely different??? Please help thank you.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello can someone help me with my code for the icustom function. The the original indicator is just a 50,200 ema but I want to learn how to import my own custom indicator and for this the iMA function can not be used. I am using the built in moving average EA for testing the code, I just want the ea to buy when ma1 goes above ma2 or sell when ma1 goes below ma2 to see if it works. Do I need to rebuild the whole array using buffers etc or is it as simple as ma1=icustom?
When I print the values I get this in the journal which is wrong.
2016.09.12 19:44:39.186 2011.03.17 09:03 MyEA8 USDCAD,M30: ma1: -2147483648
2016.09.12 19:44:39.186 2011.03.17 09:03 MyEA8 USDCAD,M30: ma2: 0