Download MetaTrader 5

A question about MACD...

To add comments, please log in or register
thomas2004
175
thomas2004  

Hi all,

I will use in my algo the so called MACD golden cross or dead cross. This means I need considering the signal line and the macd line. But it seems the indicator in MT4 iMACD just have the MODE_MAIN (Histogramm) and MODE_SIGNAL.

Where can I get the MACD which has the Signal and the MACD? Or must I write it myself?



Marco vd Heijden
Moderator
6138
Marco vd Heijden  

Do you mean you want to implement it into an EA that trades?

Then you can just use 12,26,9 (for the standard example) so 3 separate MA's.

The histogram is type only for visualization output of the indicator.

thomas2004
175
thomas2004  
Marco vd Heijden:

Do you mean you want to implement it into an EA that trades?

Then you can just use 12,26,9 (for the standard example) so 3 separate MA's.

The histogram is type only for visualization output of the indicator.


Here is the definition of iMACD:

double  iMACD( 

   string       symbol,           // symbol 

   int          timeframe,        // timeframe 

   int          fast_ema_period,  // Fast EMA period 

   int          slow_ema_period,  // Slow EMA period 

   int          signal_period,    // Signal line period 

   int          applied_price,    // applied price 

   int          mode,             // line index 

   int          shift             // shift 

   );


Do you mean the MODE_MAIN and MODE_SIGNAL are what I am looking for? This means if the MODE_SIGNAL crosses above MODE_MAIN, then it is golden cross and vise verse is dead cross?



How to change the visualization not with histogramm but the Main line?

Marco vd Heijden
Moderator
6138
Marco vd Heijden  

okay so first you say this:

thomas2004:

Hi all,

I will use in my algo...

And now you say this:

thomas2004:

How to change the visualization not with histogramm but the Main line?

What do you want?

are you trying to write a robot?

that trades on MACD crosses,??

Or are you trying to change the visualization??

on the indicator??

so not on your algo??

what are you trying to do??

Please be specific.
thomas2004
175
thomas2004  
Marco vd Heijden:

okay so first you say this:

And now you say this:

What do you want?

are you trying to write a robot?

that trades on MACD crosses,??

Or are you trying to change the visualization??

on the indicator??

so not on your algo??

what are you trying to do??

Please be specific.

Hi,

1.

By default the MAIN_LINE by MACD is shown as histogram. I want it as a line.


2.

In my algo I will scan the golden cross and dead cross of the MACD. In iMACD you can get two outputs: MODE_MAIN and MODE_SIGNAL. I am not sure if I can just use these two outputs to judge the golden or dead cross.


That's what I want.

Naguisa Unada
168
Naguisa Unada  

Open your MACD with MetaEditor and find "SetIndexStyle(0,DRAW_HISTOGRAM);".

Correct it as follows.

//SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexStyle(0,DRAW_LINE);

That's only one which you have to do.

Have a nice trade.

thomas2004
175
thomas2004  
Naguisa Unada:

Open your MACD with MetaEditor and find "SetIndexStyle(0,DRAW_HISTOGRAM);".

Correct it as follows.

That's only one which you have to do.

Have a nice trade.


Thanks, you are right!

To add comments, please log in or register