Error creating indicator instance over SAR handle!!

 

Dear,


As we know, we can instantiate some indicators on other indicators. As an example, we can choose the DEMA indicator, its documentation (https://www.mql5.com/en/docs/indicators/idema) says:

applied_price

[in]  The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.


I tested a lot of indicators that worked correctly, but any indicator I try to pass a SAR handle (previously generated by the iSAR method) fails with error 4804.

ERR_INDICATOR_CANNOT_APPLY

4804

The indicator cannot be applied to another indicator


But again, this so happens just with SAR. As an example, I can create the DEMA over the MA, but I can't create it over the SAR.

   int hnd1 = iSAR(_Symbol, PERIOD_M1, 5, 20);
   int hnd2 = iMA(_Symbol, PERIOD_M1, 5, 2, MODE_SMA, PRICE_CLOSE);
   
   if (iDEMA(_Symbol, PERIOD_M1, 9, 5, hnd1) ==  INVALID_HANDLE)
      Print("Error creating DEMA handler over iSAR handler.");

   if (iDEMA(_Symbol, PERIOD_M1, 9, 5, hnd2) ==  INVALID_HANDLE)
      Print("Error creating DEMA handler over iMA handler.");

I receive "Error creating DEMA handler over iSAR handler". 


Somebody would know explain why happens with SAR?


Best regards!

Documentation on MQL5: Technical Indicators / iDEMA
Documentation on MQL5: Technical Indicators / iDEMA
  • www.mql5.com
//|                                                   Demo_iDEMA.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...