How to get info what candles closed below/above using MA

 

Hi,

I want to get what candle Bearish/Bullish closed above/below using MA.


This is my code, but not works.


double ema13 = iMA(_Symbol, _Period, 13, 0, MODE_EMA, PRICE_CLOSE, 0);

  
       bool bullish1 = Close[1] > Open[1] ? true : false;
       
  
      if((Close[1]> ema13)&& (Close[0]<ema13)){
      
            if (bullish1==true)
            {
               Comment("Bullish Has Closed Below MA");
            }
            if (bullish1==false)
            {
                Comment("Bearish Has Closed Below MA");
            }
      
      }
       
       if((Close[1] < ema13)&& (Close[0]> ema13))
       {      
            if (bullish1==true)
            {
         Comment("Bullish  Has Closed Above MA");
         }
         if (bullish1==false)
         {
            Comment("Bearish  Has Closed Above MA");
         }
       } 


       
 
Is this your whole code? Does your whole code compile or not? What errors does compiler throw?

Is this supposed to become a Script, Indicator ot EA?
 
Tobias Johannes Zimmer #:
Is this your whole code? Does your whole code compile or not? What errors does compiler throw?

Is this supposed to become a Script, Indicator ot EA?

This is my code and its EA.

The problem is because not  showing correctly Bearish or Bullish when MA is above or below.