Who wants a strategy? Lots and for free) - page 56

 
zfs >> :
My manual values are the same as the averages projected in MT. The question is where do the MACD values come from, as the MACD is sort of a FastMA-SlowMA.

The MACD is FastMA-SlowMA smoothed by SignalMA.

 
TheXpert >> :

MACD is FastMA-SlowMA smoothed SignalMA.

>> Agreed. We are talking about the MACD histogram. After all, the histogram does not depend on SignalMA. The results are taken from the histogram. It seems to be a simple formula. After all, the MACD oscillator is the difference in histograms. Isn't it?

 
            for (int iBar = nSlow - 1; iBar < Bars; iBar++)
                afMACD[ iBar] = maFast[ iBar] - maSlow[ iBar];

            float[] maSignalLine = MovingAverage( nSignal, 0, slMethod, afMACD);

            for (int iBar = nSlow + nSignal - 1; iBar < Bars; iBar++)
                afHistogram[ iBar] = afMACD[ iBar] - maSignalLine[ iBar];

            component[0]. CompName   = "Histogram";
            component[0]. Value      = afHistogram;

            component[1]. CompName   = "Signal line";
            component[1]. Value      = maSignalLine;

            component[2]. CompName   = "MACD line";
            component[2]. Value      = afMACD;

MACD Line = Fast MA - Slow MA

Signal Line = MA(MACD Line)

MACD Histogram = MACD Line - Signal Line


 afIndicator1 = MACD1. Component[0]. Value;
 afIndicator2 = MACD2. Component[0]. Value;


for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
     afOscllator[ iBar] = afIndicator1[ iBar] - afIndicator2[ iBar];
}


Oscillator of MACD = MACD Histogram 1 - MACD Histogram 2

 

The formula for a traditional MACD:
MACD = EMA(12,close) - EMA(26,close) [as a line]
Signal = EMA(9,MACD) [ as a line ]
Histogram = MACD - Signal [as a histogram]


Instead, MT has the wrong MACD, which is also displayed as a bar graph, which can be misleading for some traders.

MACD = EMA(12,close) - EMA(26,close) [as a histogram]
Signal = SMA(9,MACD) [as a line]


But there are variants

 

In Forex Strategy Builder:

MACD = EMA(12,close) - EMA(26,close) [as line] - Blue line
Signal = EMA(9,MACD) [as a line] - Yellow line
Histogram = MACD - Signal [as a histogram] - Histogram (red/green bars)


The method of smoothing can be selected separately for MACD Line and Signal Line. That allows you to make them like in MT.

 
Miroslav_Popov >> :

MACD Line = Fast MA - Slow MA

Signal Line = MA(MACD Line)

MACD Histogram = MACD Line - Signal Line



Oscillator of MACD = MACD Histogram 1 - MACD Histogram 2


Signal Line = MA(MACD Line) but the smoothing method is not specified in FSB; is it the same as the MACD Line?








 

You are right. In "Oscillator of MACD" both MACD line and Signal line use the same method of smoothing.


----

Edit.

It's probably better to add "smoothing method" parameter to Signal line also.

I'll make it shortly.

 
Miroslav_Popov >> :

You are right. In "Oscillator of MACD" both MACD line and Signal line use the same method of smoothing.


----

Edit.

It's probably better to add "smoothing method" parameter to Signal line also.

I'll make it shortly.


Yes, I agree, but his absence has led me down the wrong path. Thank you for your help.

 
Miroslav_Popov >> :

You are right. In "Oscillator of MACD" both MACD line and Signal line use the same method of smoothing.

Signal line period = 9?

 

I'll add more parameters to "Oscillator of MACD" in the next beta.

Signal line smoothing method:

- Smoothed,

- Weighted,

- Exponential,

- Simple.

Signal line 1 period;

Signal line 2 period;

What to compare:

- Histogram 1 to Histogram2,

- Signal line 1 to Signal line 2,

- MACD line 1 to MACD line 2.





Expect it tomorrow in the evening.