what is wrong with this code?

 

I am always getting the same errors and am not intelligent enough to understand what is wrong with this line in the code. Can someone please help me? It's really appreciated. 

code line

double maShortPrev = iMA(_Symbol, PERIOD_H1, ShortMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);

error:

'iMA' - wrong parameters count ChartSampleInit.mqh 41 24

built-in: int iMA(const string,ENUM_TIMEFRAMES,int,int,ENUM_MA_METHOD,int) ChartSampleInit.mqh 41 24



in total five errors but they are all the same



 
ivanydze:

I am always getting the same errors and am not intelligent enough to understand what is wrong with this line in the code. Can someone please help me? It's really appreciated. 

code line

double maShortPrev = iMA(_Symbol, PERIOD_H1, ShortMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);

error:

'iMA' - wrong parameters count ChartSampleInit.mqh 41 24

built-in: int iMA(const string,ENUM_TIMEFRAMES,int,int,ENUM_MA_METHOD,int) ChartSampleInit.mqh 41 24


In MT5  the call to the indicator returns a handle for use with copybuffer

so it returns an int  and does not need the last parameter of 1

See the documentation and use the code button to post code in future </>  or Alt-S

 

Many thanks for this; this error went on forever. 
Do you know why it gave me a warning on this line?

   for (int i = totalPositions - 1; i >= 0; i--)

     {

      if (PositionSelect(i)) This line indicate warning

implicit conversion from 'number' to 'string' ChartSampleInit.mqh 89 26



 
ivanydze #:

Many thanks for this; this error went on forever. 
Do you know why it gave me a warning on this line?

   for (int i = totalPositions - 1; i >= 0; i--)

     {

      if (PositionSelect(i)) This line indicate warning

implicit conversion from 'number' to 'string' ChartSampleInit.mqh 89 26



Again.  Use the code button </>  or Alt-s to post code