iCustom and #property indicator_applied_price

 

HI

I am trying to use iCustom with the simple call form of OnCalculate indicator.

int  OnCalculate( 
   const int        rates_total,       // price[] array size 
   const int        prev_calculated,   // number of handled bars at the previous call 
   const int        begin,             // index number in the price[] array meaningful data starts from 
   const double&    price[]            // array of values for calculation 
   );

Using this form, we can define in the indicator the #property indicator_applied_price  in order to apply price to something other than PRICE_CLOSE

Help page is saying : "If the first call form is used in the indicator, then at the custom indicator start you can additionally indicate data for calculation in its "Parameters" tab. If the "Apply to" parameter is not selected explicitly, the default calculation is based on the values of "Close" prices."

#property indicator_applied_price PRICE_CLOSE works when attaching the indicator manualy to the charts using Terminal UI

but it is not taken into account when using iCustom inside EA code.

Do you know why ?

Thank you 

Regards

Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Program Properties (#property) - Preprocessor - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Philippe Pauleau: I am trying to use iCustom with the simple call form of OnCalculate indicator.
Please show your code where you are using the iCustom() call and wanting the default value for the applied price.
Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
iCustom - Technical Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro #:
Please show your code where you are using the iCustom() call and wanting the default value for the applied price.


Sure.

Inside EA:

HandleBands    = iCustom(NULL,_TimeFrame,"Examples\BB.ex5",    _BandsPeriod,0,_BandsDeviation);


and I've modified the included Examples\BB.mq5 example indicator adding

#property indicator_applied_price PRICE_LOW


The UI interface is correctly using this property as default.
But iCustom function does not take it into account and still apply to PRICE_CLOSE which is the default


Strange