iCustom() Error?

To add comments, please log in or register
Brian Brian
16
Brian Brian  

Dear Gurus


Sincerely seek your help. I am not sure why the value printed with the code below is always "0.0"? Pls refer my code and screenshots from testing below. I am very sure there is value from the DonchianChannels indicator at the most recent close bar and there is a DonchianChannels.ex4 in the indicators folder. The DonchianChannels indicator has only 1 input parameter and the first buffer number starts with "0".


void OnTick()

  {

      double value = iCustom("XAUUSD",PERIOD_H4,"DonchianChannels",20,0,1);

         Print("Time: " ,TIME_DATE, " value: " , value); 

  }




Mohamad Zulhairi Baba
21895
Mohamad Zulhairi Baba  
Brian Brian:

Dear Gurus


Sincerely seek your help. I am not sure why the value printed with the code below is always "0.0"? Pls refer my code and screenshots from testing below. I am very sure there is value from the DonchianChannels indicator at the most recent close bar and there is a DonchianChannels.ex4 in the indicators folder. The DonchianChannels indicator has only 1 input parameter and the first buffer number starts with "0".


void OnTick()

  {

      double value = iCustom("XAUUSD",PERIOD_H4,"DonchianChannels",20,0,1);

         Print("Time: " ,TIME_DATE, " value: " , value); 

  }

try

double value = iCustom("XAUUSD.s",PERIOD_H4,"DonchianChannels",20,0,1);
Brian Brian
16
Brian Brian  
Mohamad Zulhairi Baba:

try

Thank you so much! It worked! You save my day! 

William Roeder
18888
William Roeder  
  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 edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  3. double value = iCustom("XAUUSD",PERIOD_H4,"DonchianChannels",20,0,1);
    If the naming pattern of your charts isn't exactly "BasQuo" then your code fails.
    Broker's use a variety of naming patterns: EURUSD, EURUSDc, EURUSDct, EURUSDi, EURUSDm, EURUSDecn, EURUSDpro, "EUR.USD", "EUR/USD", "EURUSD#", "EURUSD.", "EURUSD..", "EURUSD.G", "EURUSD.SBe", "EURUSD.stp", "EURUSD+", "EURUSD-sb", etc.
    Don't hard code things; just use the predefined _Symbol. Or calculate the adornments
              SymbolName/Symbol. OrderSend - Symbols - MQL4 and MetaTrader 4 - MQL4 programming forum

To add comments, please log in or register