How to use iCustom for TDI

 

Hello All,

 I have trouble with using of iCustom & RSI signal in TDI indicator.

I'm using iCustoms like this

//---- calculate EMA for the trend recognition
        EMA_0 = iCustom(NULL,TimePeriodDay,"EMA",5,3,1,0,0);
        EMA_1 = iCustom(NULL,TimePeriodDay,"EMA",5,3,1,0,1);
        EMA_2 = iCustom(NULL,TimePeriodDay,"EMA",5,3,1,0,2);
   
//---- TDI;
        RSI_Green_0 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,4,0);
        RSI_Green_1 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,4,1);
        RSI_Green_2 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,4,2);
        TSL_Red_0 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,5,0);
        TSL_Red_1 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,5,1);
        TSL_Red_2 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,5,2);
        MBL_Yellow_0 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,2,0);
        MBL_Yellow_1 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,2,1);
        MBL_Yellow_2 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,2,2);


Yes I can use iRSI

                RSI_Green_0 = iRSI(NULL,0,13,PRICE_OPEN,0); // the RSI at the current time frame 
                RSI_Green_1 = iRSI(NULL,0,13,PRICE_CLOSE,1); // the RSI at the current time frame 
                RSI_Green_2 = iRSI(NULL,0,13,PRICE_CLOSE,2); // the RSI at the current time frame 


But what about EMA, TSL & MBL?  They are always recalculate with every new tick, so their 1tick values are differ than output of tester run.

With iCustom for RSI - I got always another value, for following lines in tester and reality. I have another output in the morning, another at afternon and another in the evening, always taking 1st tick.

Of course EA tester is not usable for this, I think it took last value of the day, but my EA is operating with 1st tick of new bar.

In correct situation Shift0 of today shall be the same number as Shift1 in next day, if I can set "PRICE_OPEN" for Shift0  and  "PRICE_CLOSE" for Shift1

        RSI_Green_0 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,4,0);
        RSI_Green_1 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,4,1);
        TSL_Red_0 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,5,0);
        TSL_Red_1 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,5,1);
        MBL_Yellow_0 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,2,0);
        MBL_Yellow_1 = iCustom(NULL,TimePeriodDay,"TDI_Red_Green",13,0,34,2,0,7,0,2,1);


Is here some clever easy solution for this situation?

How can I force iCustom to use "PRICE_OPEN" or "PRICE_CLOSE"  ??


Many Thanks for any advice

Yuri

 
  1. You don't force iCustom to use anything. iCustom ONLY reads what is in the indicator's buffers. Period. If the indicator doesn't provide a parameter to control something is can't be done. Detailed explanation of iCustom - MQL4 forum
  2. EMA_0 = iCustom(NULL,TimePeriodDay,"EMA",5,3,1,0,0);
    Do you really have a CUSTOM indicator called EMA? I doubt it. Perhaps you should RTFM: iMA - MQL4 Documentation
 

Hi WHRoeder

tried modiffied iCustom, you have right, TDI have this option to use "RSI Price settings".

Unfortunatelly the output is not the same as output of iRSI.

Is it possible that my setup of TDI is wrong, or have downloaded not working version?

                double RSI_Green_00 = iRSI(NULL,0,13,PRICE_OPEN,0); // the RSI at the current time frame 
                double RSI_Green_11 = iRSI(NULL,0,13,PRICE_CLOSE,1); // the RSI at the current time frame 
                double RSI_Green_22 = iRSI(NULL,0,13,PRICE_CLOSE,2); // the RSI at the current time frame 

                RSI_Green_0 = iCustom(NULL,0,"TDI_Red_Green",13,PRICE_OPEN,34,2,0,7,0,4,0);
                RSI_Green_1 = iCustom(NULL,0,"TDI_Red_Green",13,PRICE_CLOSE,34,2,0,7,0,4,1);
                RSI_Green_2 = iCustom(NULL,0,"TDI_Red_Green",13,PRICE_CLOSE,34,2,0,7,0,4,2);
Files:
 

Found what was necessary.

Thanks for opening my eyes..

 

I'm also having this issue, works for Market Base Line but not for the RSI green line:


double TDI_RSI_Green_1, TDI_RSI_Green_2, TDI_MarketBase_Yellow_1, TDI_MarketBase_Yellow_2;
  
      // https://www.mql5.com/en/forum/144862
      
      //WORKS (corresponds to values on indicator in MT4)
      TDI_MarketBase_Yellow_1 = iCustom(NULL, 0, "TDI_Red_Green", 13, PRICE_CLOSE, 34, 2, 0, 7, 0, 
         2, //2=Market Base
         1 
      );
      Print("TDI_MarketBase_Yellow_1=", TDI_MarketBase_Yellow_1);
      
      //WORKS
      TDI_MarketBase_Yellow_2 = iCustom(NULL, 0, "TDI_Red_Green", 13, PRICE_CLOSE, 34, 2, 0, 7, 0, 
         2, //2=Market Base
         2 
      );
      Print("TDI_MarketBase_Yellow_2=", TDI_MarketBase_Yellow_2);     
      
      // DOES NOT WORK (different values shown than last 2 bars in MT4 indicator chart)
      TDI_RSI_Green_1 = iCustom(NULL, 0, "TDI_Red_Green", 13, PRICE_CLOSE, 34, 2, 0, 7, 0, 
         4, //4=RSI Price line
         1 
      ); 
      Print("TDI_RSI_Green_1=", TDI_RSI_Green_1);
      
      // DOES NOT WORK
      TDI_RSI_Green_2 = iCustom(NULL, 0, "TDI_Red_Green", 13, PRICE_CLOSE, 34, 2, 0, 7, 0, 
         4, //4=RSI Price line
         2
      ); 
      Print("TDI_RSI_Green_2=", TDI_RSI_Green_2);
Reason: