How can I attach an indicator in a EA?
Hi, I am new to mql myself but as far as I know you can not use indicators on EA's...You will need to use the icustom function if you want to use your indicator data for your EA. Look here https://docs.mql4.com/indicators/icustom
This will only use the data from the indicator, if you want to see indicators on the chart in real time then you will need to attach the indicator on a separate chart. When you backrest the EA on strategy tester and then open the chart then the indicators will show up on the chart, well does for me but I am just using a simple moving average.
If you are struggling with icustom (I was) then Look in code base for similar code or this might help you understand the icustom function https://www.mql5.com/en/forum/138577/page3#627521
This will only use the data from the indicator, if you want to see indicators on the chart in real time then you will need to attach the indicator on a separate chart. When you backrest the EA on strategy tester and then open the chart then the indicators will show up on the chart,
You do not need to attach the indicator to a separate chart, you can attach it to the same chart that has the EA running.
if you are using strategy tester visual mode for an EA named "MyEA"
If you load indicators onto a chart and save the template as "MyEA" (or whatever the EA is named)
Whenever you test that EA in visual mode, the template will be loaded and you will see the indicators on the chart. Note that the settings for the indicator will be the same as when the template was saved. So if you save the template with eg. an MA with the period set to 20 , changing the settings of the EA to use an MA period of 10 will not change the settings for the indicator that is being displayed.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey Guys,
I know how to get specific data from a indicator in a EA. For example I use iMA to get the current data for the moving average.
But I also want to visualize those data for the user.
So my question is, how can I implement the moving average so that the moving average is appering on the chart?
Also I want to visualize the Supertrend Indicator. Has anyone a idea? - Because in the EA there is no OnStart()-methode or OnCalculate()-methode...
My code for and moving average Indicator:
Thanks!