using iCustom() to catch indicator signals

 

hi guys,


as I programmer I normally find answers quickly, but this one has me stumped, im trying to include this indicator  https://www.mql5.com/en/code/15538 to my EA I want to catch the buy & sell signals ( orange & blue dots ) below is what I have so far but the values returned is not what i am expecting, which obviously suggest Im doing something wrong, please help where possible.


I've included the iCustom in a separate function to return the value, not sure what Im am missing as Im expecting either null or no value until a buy or sell signal is generated by the indicator


   double CheckCustom() {
   
      return ( iCustom(Symbol(),Period(),"trend_arrows",3) );
   
   }


then calling it in the ontick function and using hte comment to debug and see what value its returning


 double CheckValue;
  
 void OnTick() {
 
   CheckValue = CheckCustom();
   Comment("Custom Value : ", CheckValue, "\n");


the result is a counter effect where it just keeps counting like in a for loop on each tick..... please see image attached for the output in my chart.

trend_arrows
trend_arrows
  • www.mql5.com
Trend Arrows draws support/resistance lines as colored dots on a price chart. The symbol average price on a certain amount of data is used to calculate the indicator values. In case of a downward trend, the indicator draws only a resistance line (red dots), while in case of an upward trend, it plots...
Files:
Capture.PNG  28 kb
 
  1. Why did you post your MT4 question in the MT5 General 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. Perhaps you should read the manual.
        How To Ask Questions The Smart Way. 2004
          How To Interpret Answers.
              RTFM and STFW: How To Tell You've Seriously Screwed Up.

    return iCustom(
    Symbol(),
    Period(),
    "trend_arrows",
    ...
                  
    3
    );
    double  iCustom(
       string       symbol,    // symbol
       int          timeframe, // timeframe
       string       name,      // path/name of the custom indicator compiled program
       ...                     // custom indicator input parameters (if necessary)
       int          mode,      // line index
       int          shift      // shift
       );


 
William Roeder:
  1. Why did you post your MT4 question in the MT5 General 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. Perhaps you should read the manual.
        How To Ask Questions The Smart Way. 2004
          How To Interpret Answers.
              RTFM and STFW: How To Tell You've Seriously Screwed Up.


Apologies, but I am working on MQL5 code, not MQL4 code, unless I completely missed something, and I did read the MQL5 docs, which is very barebone, also searched numerous forum topics on it and watched some videos of it, none really helping.

Instead of giving me lip & attitude, help would of been appreciated much more. That's why forums are created in the first please.

 
Devan Gert De Kock: Apologies, but I am working on MQL5 code, not MQL4 code, unless I completely missed something,

Yes you did. iCustom does not return a double.

 
William Roeder:

Yes you did. iCustom does not return a double.

thank you, seems I missed that or took it by mistake from one of the many examples I looked at, will rectify on my side. but the code is still OR needs to be MQL5, Im still learning.... thats why I asked the question in the first please, seeing forums are for discussions and help. 


thanks I will check if it makes a difference on my side.