1. In order to plot any indicator (custom or not) on live chart use ChartIndicatorAdd in your EA code.
2. In strategy tester you get all indicators in visual mode on chart as long as you do NOT use :
TesterHideIndicators(true)
note: In default mode all indicators are shown in strategy tester(visual mode) and you do not need TesterHideIndicators.
Yashar Seyyedin #:
1. In order to plot any indicator (custom or not) on live chart use ChartIndicatorAdd in your EA code.
2. In strategy tester you get all indicators in visual mode on chart as long as you do NOT use :
note: In default mode all indicators are shown in strategy tester(visual mode) and you do not need TesterHideIndicators.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am new to MQL5, so as far as know, there are two types of indicators, one is a built-in indicator like `iMA` function, another is the custom's indicator which should be created by the trader themselves within a separate indicator file.
My target is to show these two types of indicators onto the chart both in `live trading` mode and `debug on historical data within MetaEditor` mode, so what should i do for this four conditions:
For condition 3, i have tried creating a new indicator file named "IndicatorMA.mq5"with the code below, and then dragged it to the chart, the indicator is shown successfully. The code is
and the indicator shown on the chart within MetaTrader is
For condition 4, the sample code described above triggered within MetaEditor labelled by red rectangle in the picture,![]()
but nothing shown on the chart when debugging the code with MetaEditor.
Does the `debug mode` of MetaEditor support showing indicator on the chart, or something should be changed on the above code when adapting to the MetaEditor instead of MetaTrader ?
For the condition 1 and 2, i don' t know how to directly use the `iMA` function within an EA(in the OnTick() function as well as other order placing logic code) to draw moving average line onto the chart.
So if someone can help me understand how to plot indicators on the above four conditions and list some materials for me to learn on `drawing indicator` in EA or separate custom indicator file , i would appreciate it.