How do I tell an indicator should be loaded in a separate window

 

Hey guys!


Title says all.


The thing is a want to load an indicator to the chart using ChartIndicatorAdd. Some of them are oscillators - but I don't know which ones I'm loading are oscillators and thus should be loaded on a subwindow. How can I do this? I looked into the documentation, but couldn't find anything.


Thanks.

 

You may read the documentation page. The second input parameter is "sub-window number". Anything bigger than zero causes the indicator to be loaded in a sub-window.

https://www.mql5.com/en/docs/chart_operations/chartindicatoradd

 
Yashar Seyyedin #:

You may read the documentation page. The second input parameter is "sub-window number". Anything bigger than zero causes the indicator to be loaded in a sub-window.

https://www.mql5.com/en/docs/chart_operations/chartindicatoradd

Thank you, but that's actually not the problem I'm facing (or I misunderstood something).


Let me say I wanna load three indicators. I don't know what these indicators are. They're defined by the user in the input parameters of the EA. Let's suppose two situations:


Indicator 1 - Moving Average, Indicator 2 - Bollinger Bands, Indicator 3 - ADX

Indicator 1 - Moving Average, Indicator 2 - ADX, Indicator 3 - ATR


Both ATR and ADX are oscillators and should be added to a subwindow. Moving averages and Bollinger Bands are supposed to be loaded in the main window. If I want to add a subwindow, I could just do like:

ChartIndicatorAdd(0, ChartGetInteger(0, CHART_WINDOWS_TOTAL), handle);

But I can't just do that to every indicator. If so, then Moving Averages and Bollinger Bands will also be added in a subwindow. So how do I check so oscillators are properly loaded into subwindows and regular indicators are added to the main window?


Is there a way to check if the indicator has defined the #property indicator_separate_window?

Reason: