best way of checking if anMQL5 indicator is on the chart from EA OnInit()
Forum on trading, automated trading systems and testing trading strategies
General rules and best practices of the Forum.
Alain Verleyen, 2018.08.03 23:01
When you post code please use the SRC button !
I did it myself but I am sure others will want to know so here it is:
int iIndicatorCount =0; int totalIndicators = ChartIndicatorsTotal(0,0); for(int i=0; i<totalIndicators; i++) { string indicatorName = ChartIndicatorName(0,0,i); if ((indicatorName == "My Funny Indicator") || (indicatorName == "His Funnier Indicator")) iIndicatorCount ++; } if (iIndicatorCount < 2) { Alert ("Two funny indicators are required"); return ERROR; }
What is the best way of checking if a required indicator is on the chart before proceeding?
I was looking along these lines but I am struggling to find a better function to do the job that ObjectsTotal() ?