Need Help Reading SSRC Indicator Using icustom Function

To add comments, please log in or register
joset783
19
joset783  

Dear Forum,

I've been struggling to read the attached SSRC indicator values without success for days. The value returned by my code is different from what is displayed in the Data Window with same timeframe as the code. For some unknown reasons, the three values are the same and different from the actual SSRC indicator on the chart.

I have used icustom function without problem before and painfully I can't figure out what is wrong with the below code. Please, help me to figure out what I'm doing wrong!

      
      int shift = 0;
      const int totalBars = 100;
      const int snakeRange = 21;
      const double filterPeriod = 21;
      const double martFiltr = 2.0;
      const int priceConst = 6;

      const string SSRC_INDICATOR = "Custom_Path\\SSRCR";
      
      static double currentSSRC =  iCustom(NULL, _primaryTradingTimeframe, SSRC_INDICATOR,totalBars,snakeRange,filterPeriod,martFiltr,priceConst, 0, shift);
      static double previous1SSRC = iCustom(NULL, _primaryTradingTimeframe, SSRC_INDICATOR,totalBars,snakeRange,filterPeriod,martFiltr,priceConst,0, shift+1);
      static double previous2SSRC = iCustom(NULL, _primaryTradingTimeframe, SSRC_INDICATOR,totalBars,snakeRange,filterPeriod,martFiltr,priceConst,0, shift+2);

      Print("previous2SSRC = ", previous2SSRC, " | previous1SSRC = ", previous1SSRC, " | currentSSRC = ", currentSSRC);


 

Files:
ssrc.mq4 8 kb
William Roeder
21914
William Roeder  
const string SSRC_INDICATOR = "Custom_Path\\SSRCR";
Open "«DataFolder»\MQL4\Indicators\«Custom_path»\" and see that you do actually have a ssrcr.ex4 in there.
          Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03
lippmaje
1193
lippmaje  
const string SSRC_INDICATOR = "Custom_Path\\SSRCR";
      static double currentSSRC =  iCustom(NULL, _primaryTradingTimeframe, SSRC_INDICATOR,totalBars,snakeRange,filterPeriod,martFiltr,priceConst, 0, shift);
joset783
19
joset783  
William Roeder:
Open "«DataFolder»\MQL4\Indicators\«Custom_path»\" and see that you do actually have a ssrc.ex4 in there.
          Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03
Yes, it's actually in the target path. The EA was able to load the indicator and read it, the only problem I'm having is that it's not reading the right values.
joset783
19
joset783  
lippmaje:

Thanks, I got the point you're making. 

I extracted the above code out of my EA and attached another copy of the same SSCR indicator in question. The EA was able to load the indicator and read it, the only problem I'm having is that it's not reading the right values.

lippmaje
1193
lippmaje  
Did you remove the static? Show all of the relevant code and the output you got if it doesn't work.
joset783
19
joset783  

lippmaje:
Did you remove the static? Show all of the relevant code and the output you got if it doesn't work.

Yes, thanks. 

I eventually discovered that the problem is with the indicator and it does not worth the headache!

Cheers.

To add comments, please log in or register