Get an Indicator's signal in an Expert

 

Hi there,

am writing an Expert that is going to open trade on Buy/Sell signals (arrows) from Hull MA indicator

This is an example of my code:

double val = iCustom(_Symbol,PERIOD_CURRENT,"hull-moving-average-arrows",34,0,2,1,5,0,0,0,0,0,1,2,233,234,1,1,1);

But it always returns the market price.

How may I know if it's a sell or a buy signal?

Example of the indicator signals:

Example of signals

 
  1. Why did you post your MT4 question in the 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. Your iCustom call is bogus.

    Icustom
    Indicator
    double val = iCustom(_Symbol,PERIOD_CURRENT,
                         "hull-moving-average-arrows",
                                   missing string       
    34,
    0, don't hard code constants, use proper enumeration
    2,                             not a double   
    1,                             not a bool
    5,
    0,                             not a color
    0,                             not a color
                                   missing string       
    0,                             not a bool
    0,                             not a bool
    0,                             not a bool
    1,                             not a bool
                                   missing bool 
                                   missing bool
    2, 
    233, 
    234, 
    1,                             not a bool
    1,1
    );
    
    ⋮
    ⋮
    extern string TimeFrame        = "Current time frame";
    extern int    HMAPeriod        = 34;
    extern int    HMAPrice         = PRICE_CLOSE;
    extern double HMASpeed         = 2.0;
    extern bool   LinesVisible     = true;
    extern int    LinesNumber      = 5;
    extern color  ColorUp          = Blue;
    extern color  ColorDown        = Red;
    extern string UniqueID         = "HullLines1";
    extern bool   alertsOn         = false;
    extern bool   alertsOnCurrent  = true;
    extern bool   alertsMessage    = false;
    extern bool   alertsSound      = false;
    extern bool   alertsEmail      = false;
    extern bool   ShowArrows       = true;
    extern int    arrowSize        = 2;
    extern int    uparrowCode      = 233;
    extern int    dnarrowCode      = 234;
    extern bool   ArrowsOnFirstBar = true;
    ⋮
    ⋮
    
  3.       SetIndexBuffer(3,arrowUp);   
          SetIndexBuffer(4,arrowDn); 
    Why are you not looking at the correct buffer indexes.
 
William Roeder #:
  1. Why did you post your MT4 question in the 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. Your iCustom call is bogus.

    Icustom
    Indicator
  3. Why are you not looking at the correct buffer indexes.

Thank you William,

I didn't notice I am posting my question in a wrong place. Thanks for the heads up. I'll pay attention the next time.

Also, thank you for your advice. I just noticed that the Indicator's source code is available and I could take a look.

I was trying a few indicators and most of them don't come with the source code. I'm still not sure how to read the signals from most of them. But I guess you solved my problem with this one :)