What do MACD/OsMA lines and bars mean? Loooking for a way to identify when the two lines cross

 

Hello

I am amaterur on Forex and on MQL4 programing and I will apreciate all help I can get.

I am writing EA code for a strategy that uses MACD/OsMA (FEMA: 12, SEMA: 34, MACD SMA: 9 at Close) as a TakeProfit indicator on the event that the two lines that MACD/OsMA draws cross (red and green on attached picture).

I was looking for any function on MT4 (similar to iMA, iMACD, etc) that can tell me when this crossing event happen but I can not find it.

Looking for an alternative, I am trying to understand what each of those two lines represent (red and green on attached picture) hoping it might be a simple math calculation (a similar description as for MACD that says "The MACD calculation subtracts the 26-period from the 12-period to create a single line. This is known as the main line.", or something similar) so I can make my EA to calculate this crossing event.

Hope anyone can help.

Thank you

 
You didn't try very hard. Get the two current buffer values and the previous bar buffer values via iMACD and look if they've crossed.
 

The cross happens when the histogram (Osma) goes above zero or below zero.

https://forum.mql4.com/47496

 
WHRoeder:
You didn't try very hard. Get the two current buffer values and the previous bar buffer values via iMACD and look if they've crossed.


Hello WHRoeder

Thank you for reply but I am not sure if I got your idea.

iMACD syntax is:

iMACD(string symbol, int timeframe, int fast_ema_period, int slow_ema_period, int signal_period, int applied_price, int mode, int shift)

but mode only gives the options:

Constant Value Description
MODE_MAIN0Base indicator line.
MODE_SIGNAL1Signal line.

where I though "Signal Line" was the line drawn and "Base Indicator Line" was the histogram.

Now I see that none of them are the histogram but the two lines on my example picture.

Thank you, your comment helped me understand better

Reason: