I want to hide some built-in indicator lines in my EA when I use Visual Mode on Strategy tester.
- Add the desired indicators to your chart.
- Modify the indicator's line color to None to be hidden while running visual mode on Strategy.
- Once you're satisfied with your setup, navigate to Charts > Templates > Save Template in the toolbar to save your chart configuration.
- In the Strategy Tester's toolbar, go to Charts > Templates > Load Template, then load the saved template.
Alternatively, you can modify the indicator's code directly by adding an input option to toggle plot visibility, or set the line color to clrNone to hide it.
- Add the desired indicators to your chart.
- Modify the indicator's line color to None to be hidden while running visual mode on Strategy.
- Once you're satisfied with your setup, navigate to Charts > Templates > Save Template in the toolbar to save your chart configuration.
- In the Strategy Tester's toolbar, go to Charts > Templates > Load Template, then load the saved template.
Alternatively, you can modify the indicator's code directly by adding an input option to toggle plot visibility, or set the line color to clrNone to hide it.
Thank you very much.
Hello
I want to hide some built-in indicator lines in my EA when I use Visual Mode on Strategy tester. For example I want to hide iATR() lines but show iMA() lines. I usually use 3 ATRs in my EAs, and hence each opens in a new sub-window, it is too disturbing.
I don't want to use
since it hides all indicator lines of the chart.
Have you tried plotting ATR value in main chart instead?
You could hide any plot this way:
- Use a DRAW_COLOR_LINE or DRAW_COLOR_SECTION drawing style, and set clrNONE as the last color index (index 2 in this case)
#property indicator_label1 "MA Line" #property indicator_type1 DRAW_COLOR_LINE #property indicator_color1 clrGreen, clrRed, clrNONE #property indicator_width1 2
clrGreen = index 0
clrRed = index 1
clrNONE = index 2
Then in OnCalculate, you can color the line to none exclusively for the strategy tester
if(MQLInfoInteger(MQL_TESTER) || MQLInfoInteger(MQL_VISUAL_MODE)) for(int i=0; i<rates_total && !IsStopped(); i++) color_buf[i] = 2; // the index 2 is where clrNONE is configured
When I call iAtr function, it always opens in a new sub-window. Hence I don't know how to plot such an indicator in the main window.
ATR can't be plotted on the main chart because it's not outputting OHLC prices, it outputs a measure of the market volatility. If you want a chart based ATR indicator, then you need to use ATR only for calculations upon the OHLC prices, and then represent the calculated values in new plot buffer.
So what it sounds like you need to do is build an indicator with the number of ATRs that you want, assign them for calculation only in the indicator (they will not be plotted), and plot whatever you want to be plotted from the custom indicator.Your choices are as follows:
- You can code the ATR calculations directly in the EA (quite simple), so that no indicator is used, or ...
- ... you can code your own custom indicator to calculate the ATR (or adapt from a CodeBase publication), and have it able to disable the plot, or ...
- if you insist on using iATR(), then you have no choice but to use TesterHideIndicators(true).
You could hide any plot this way:
- Use a DRAW_COLOR_LINE or DRAW_COLOR_SECTION drawing style, and set clrNONE as the last color index (index 2 in this case)
clrGreen = index 0
clrRed = index 1
clrNONE = index 2
Then in OnCalculate, you can color the line to none exclusively for the strategy tester
ATR can't be plotted on the main chart because it's not outputting OHLC prices, it outputs a measure of the market volatility. If you want a chart based ATR indicator, then you need to use ATR only for calculations upon the OHLC prices, and then represent the calculated values in new plot buffer.
So what it sounds like you need to do is build an indicator with the number of ATRs that you want, assign them for calculation only in the indicator (they will not be plotted), and plot whatever you want to be plotted from the custom indicator.Your choices are as follows:
- You can code the ATR calculations directly in the EA (quite simple), so that no indicator is used, or ...
- ... you can code your own custom indicator to calculate the ATR (or adapt from a CodeBase publication), and have it able to disable the plot, or ...
- if you insist on using iATR(), then you have no choice but to use TesterHideIndicators(true).
Thank you. Your suggestions improved my understanding regarding MQL5.

- 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
I want to hide some built-in indicator lines in my EA when I use Visual Mode on Strategy tester. For example I want to hide iATR() lines but show iMA() lines. I usually use 3 ATRs in my EAs, and hence each opens in a new sub-window, it is too disturbing.
I don't want to use
since it hides all indicator lines of the chart.