correct errors in indicator

 
attached mq5 indicator please correct it
Files:
 
   iCountedBars=IndicatorCounted();

Unnecessary code. Throw away.


   for (i=iNewBars; i>= 0 ; i--)
     {
       // Calc SuperTrend 
      dAtr = iATR ( NULL , 0 , SuperTrendPeriod);

For this, you generally need to beat hands. Remember: you need to create an indicator handle ONCE in the OnInit () function. CopyBuffer is then used to get the values.

Read the help. See help.


I didn’t look further - I think there are a lot of mistakes there.


Homework: Explore iATR Help.

Documentation on MQL5: Technical Indicators / iATR
Documentation on MQL5: Technical Indicators / iATR
  • www.mql5.com
//|                                                    Demo_iATR.mq5 | //|                        Copyright 2011, MetaQuotes Software Corp. | //|                                              https://www.mql5.com | "The method of creation of the handle is set through the 'type' parameter (function type...
Reason: