Get Impulse Direction

 

Hi

I'm hoping someone might be able to help. I'm using the attached elder impulse indicator and trying to code my EA to check the color of the indicator automatically. Either green, blue or red.

Really struggling with it though.

I think I need to use something similar to the below, and although it is returning a value, it is not correct I don't think as it definitely does not correspond to the color on the 4 hour candle. 

 double GetImpulseDirection4hr()

{

      double val = iCustom(Symbol(),PERIOD_H4,"Impulse Indicator",5000,2,1);

      return val;

}

 

Thanks in advance

Leon 

Files:
 
This function will give you the red value at last closed candle.
 
Alain Verleyen:
This function will give you the red value at last closed candle.

Hi Alain

Thanks for the info. Do you know how I can get it to return either red, blue or green depending on what the previous candle was? Is that possible?

 
Leon Lodewyks:

Hi Alain

Thanks for the info. Do you know how I can get it to return either red, blue or green depending on what the previous candle was? Is that possible?

All is possible, you will have to learn coding or ask someone to do it for you.

Your question is unclear.

 

Hi Alain

I am actually coding this myself. I am able to code, but I just need some assistance as I am just starting to use MQL.

I will try and rephrase my question, which will hopefully make it more clear: 

The indicator which I have attached, when attached to the chart, will draw either a red, blue or green line under the chart. I want my EA to "call" the indicator to retrieve the color - blue, red or green.

I thought this is done by using the iCustom function, but I can't get this to work, so I was looking for some assistance.

 

Thanks for your help

Leon 

 

yes with iCustom but you need to know what it returns can be either a price value or a level value etc. usually not a color, color is usually derived from the level.

just look into the code of the indicator and see if you can find the formula then you can build from that.

 

3 Buffers.

 

//BUY (buffer  index 0)

 double valBuy = iCustom(Symbol(),PERIOD_H4,"Impulse Indicator",5000,0,1);

 

//NEUTRAL (buffer index 0)

 double valNeutral = iCustom(Symbol(),PERIOD_H4,"Impulse Indicator",5000,1,1); 

 

//SELL (buffer index 0)

 double valSell = iCustom(Symbol(),PERIOD_H4,"Impulse Indicator",5000,2,1); 

Reason: