//+------------------------------------------------------------------+
//|                                                           ma.mq4 |
//|                             Copyright © 2010, www.metaqoutes.com |
//|                                               www.metaqoutes.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, www.metaqoutes.com"
#property link      "www.metaqoutes.com"
#include <WinUser32.mqh>


//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   double  ema10_1 = iMA(Symbol(),0,10,0,MODE_SMA,PRICE_CLOSE,1);
   double  ema10_2 = iMA(Symbol(),0,10,0,MODE_SMA,PRICE_CLOSE,2);
   double  ema197_1 = iMA(Symbol(),0,197,0,MODE_SMA,PRICE_CLOSE,1);
   double  ema197_2 = iMA(Symbol(),0,197,0,MODE_SMA,PRICE_CLOSE,2);
   if( (ema10_1 > ema10_2 && ema197_1 > ema197_2) ||
         (ema10_1 < ema10_2 && ema197_1 < ema197_2) )
      {            
      string a = "Both smas are in consolidation";
      string b = "trades are expected";
      }
   else
      {
      a = "Smas are not in consolidation";      
      b = "no trades are expected";      
      }
   MessageBox(StringConcatenate("Sma 10   [2] : ",DoubleToStr(ema10_2,Digits),
                                 ", Sma 10   [1] : ",DoubleToStr(ema10_1,Digits),
                                 "\nSma 197 [2] : ",DoubleToStr(ema197_2,Digits),
                                ", Sma 197 [1] : ",DoubleToStr(ema197_1,Digits),
                                 "\n",b),a,MB_OK|MB_ICONINFORMATION);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+