Ema Cross, nothing is happening

 

Hi, I am just trying to made Expert Advisor based on "MACD Sample" from mql5 examples. It is kind of ema cross, but with low price ema and high price ema, I made it in different way, but without possibility of changing inputs. After changes high ema and low ema aren't apperating on chart and Expert Advisor isn't making any transactions during test. Could you tell me what is wrong with this code? Code in appendix. 

Files:
trying.mq5  18 kb
 
kkidyba :

Hi, I am just trying to made Expert Advisor based on " MACD Sample" from mql5 examples. It is kind of ema cross, but with low price ema and high price ema, I made it in different way, but without possibility of changing inputs. After changes high ema and low ema aren't apperating on chart and Expert Advisor isn't making any transactions during test. Could you tell me what is wrong with this code? Code in appendix. 


<*ex*.*  file deleted>

You must attach an open source - * .mq5 file.

 
Vladimir Karputov:

You must attach an open source - * .mq5 file.

Ok, sorry I don't know why it just deleted itself. 
 

You forgot to initialize the handles:

//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
CSampleExpert::CSampleExpert(void) : m_adjusted_point(0),
   m_handle_macd(INVALID_HANDLE),
   m_handle_ema(INVALID_HANDLE),
   m_handle_high(INVALID_HANDLE),
   m_handle_low(INVALID_HANDLE),
   m_macd_current(0),
   m_macd_previous(0),
   m_signal_current(0),
   m_signal_previous(0),
   m_ema_current(0),
   m_ema_previous(0),
   m_low_current(0),
   m_low_previous(0),
   m_high_current(0),
   m_high_previous(0),
   m_macd_open_level(0),
   m_macd_close_level(0),
   m_stop_loss(0)
  {
 
Vladimir Karputov:

You forgot to initialize the handles:

ooooo my god thany you so much bosss