Discussion of article "MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors" - page 2

 
For beginners, this article is sufficient to illustrate the use of indicators.
 
Could you please tell me how in an indicator, for example, in the
Bands_handle=iBands(NULL,0,144,0,2,PRICE_CLOSE);

change PRICE_CLOSE to the value of "previous indicator", which is written manually.
In the terminal it can be selected, but how to write in the code, I do not understand.
The manual says that Handle is needed, but I only have a buffer.
Please help.

 
Григорий Муратов #:
Could you please tell me how to change PRICE_CLOSE in an indicator, for example in the

change PRICE_CLOSE to the value of "previous indicator", which is written manually.
In the terminal it can be selected, but how to write in the code, I do not understand.
The manual says that Handle is needed, but I only have a buffer.
Please help.

Look at the article https://www.mql5.com/ru/articles/15

Индикатор от индикатора в MQL5
Индикатор от индикатора в MQL5
  • www.mql5.com
При написании индикатора, который использует краткую форму вызова функции OnCalculate(), можно упустить то обстоятельство, что индикатор может рассчитываться не только на ценовых данных, но и на данных другого индикатора (встроенного или пользовательского - не имеет значения). Вы хотите улучшить индикатор, чтобы он правильно считался не только на ценовых данных, но и значениях другого индикатора? В этой статье мы по шагам пройдем все необходимые этапы такой модификации и выведем дополнительные полезные правила для правильного написания индикатора.
 
Rashid Umarov #:

Check out the article https://www.mql5.com/ru/articles/15

Thanks for the link, however it claims in the comments there that the code is out of date. I'll try to look into it
 

Григорий Муратов #:
Подскажите пожалуйста, как в индикаторе, например в 

Bands_handle=iBands(NULL,0,144,0,2,PRICE_CLOSE);

change PRICE_CLOSE to the value of "previous indicator", which is written manually.
In the terminal it can be selected, but I don't understand how to write it in the code.
The manual says that Handle is needed, but I only have a buffer.
Please help me.

If you look at the documentation https://www.mql5.com/ru/docs/indicators/ibands -- the specification reads:

int  iBands(
   string              symbol,            // character name
   ENUM_TIMEFRAMES     period,            // period
   int                 bands_period,      // period for calculating the average line
   int                 bands_shift,       // indicator offset horizontally
   double              deviation,         // number of standard deviations
   ENUM_APPLIED_PRICE  applied_price      // price type or handle
   );

-- "price type or handle" -- here instead of PRICE_CLOSE you can write the handle of a custom indicator.

For example:

MA_Custom_handle=iCustom(NULL,0,"Examples\\Custom Moving Average",
                     MA_Period,
                     MA_Shift,
                     MA_Method,
                     PRICE_CLOSE
                     );
Bands_handle=iBands(NULL,0,144,0,2, MA_Custom_handle );