iCustom does not return value after 1st 2 reads

 

I'm putting together an EA, I'm testing this indicator "SMI" https://www.mql5.com/en/code/7203. For some reason after I read the first 2 values I get a maximum double value "2147483647.0", I've attached a screenshot of the Journal window which shows this.


I'm not sure whether this is my code or the indicator "SMI" that is the issue, I have tested with other indicators and it works fine, any help would be greatly appreciated


void OnTick(){     
      double line = iCustom(NULL,0,"Downloads\\SMI",0,1);
      Print("LINE = ",line);
}
SMI
SMI
  • www.mql5.com
StrangeIndicator This indicator belongs to the oscillator group. T3 TRIX (ROC of T6) The TRIX indicator represents the rate-of-change percentage, smoothed by the exponential МА of the closing price.
Files:
ss.png  23 kb
 
  1. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. Please use the link button Use the link button See the difference? https://www.mql5.com/en/code/7203
              Messages Editor

  3. 2147483647 is EMPTY_VALUE No value. Since Your indicator always places values in all buffers, the problem must be your code. Do you really have a <datafolder>\MQ4\Indicator\Downloads\SMI.ex4. Verify it!
              Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 17.02.2014

  4. double line = iCustom(NULL,0,"Downloads\\SMI",0,1);
    Don't use NULL.
    • You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not.
    • Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
    • Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
    • MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].

Reason: