//+------------------------------------------------------------------+ 
//|   TRO_pablopluto                                                 | 
//|                                                                  | 
//|   Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFTS AND DONATIONS ACCEPTED                                   | 
//|                                                                  |
//|   therumpledone@gmail.com                                        |  
//+------------------------------------------------------------------+ 

#property  copyright "Copyright © 2008, Avery T. Horton, Jr. aka TRO" 
#property  link      "http://www.therumpledone.com/" 

//---- indicator settings 
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_minimum 0
#property indicator_maximum 1



//---- indicator parameters  
 

extern int win = 0;
extern int price.x.offset= 0 ; 
extern int price.y.offset= 200 ; 


extern int   myFontSize       = 60;

extern int   myPeriod  = 0;

extern string Buy_Message  = "BUY" ;
extern string Wait_Message = "WAIT" ;
extern string Sell_Message = "SELL SHORT" ;


extern color Buy_color = Lime;
extern color Wait_color = Yellow;
extern color Sell_color = Red;

 
string tMessage ;

//+--------- TRO MODIFICATION ---------------------------------------+ 
string symbol, tChartPeriod,  tShortName, oldmsg = "" ;  
int    digits, period  ; 

datetime Trigger ;

int OldBars = -1, TradeBars = 0 ;

color tColor = Yellow ;
color HighColor, LowColor, MidColor, Mid1Color, CloseColor, ClOpColor;
string sPP3531 ; 
 
//+------------------------------------------------------------------+ 
int init() 
  { 
   if(myPeriod == 0) { period = Period() ; } else { period = myPeriod ; }    
   tChartPeriod =  TimeFrameToString(period) ;
   symbol       =  Symbol() ;
   digits       =  Digits ;   

   tShortName = "PP3"+ symbol + tChartPeriod  ;

   tMessage  = Wait_Message ;

   ClOpColor = Wait_color ;

   sPP3531 = "SPP3531"+tShortName;

   return(0); 
  } 

//+------------------------------------------------------------------+
int deinit() 
{ 

   
   ObjectDelete("PP3530");
   ObjectDelete("PP3529");
   ObjectDelete("PP3529B");
   ObjectDelete(sPP3531);
   ObjectDelete("PP3532");
   ObjectDelete("PP3534");   
   
   ObjectDelete("PP3530");
   ObjectDelete("PP3529");
   ObjectDelete("PP3529B");
   ObjectDelete(sPP3531);
   ObjectDelete("PP3532");
   ObjectDelete("PP3534");   
}  
 
//+------------------------------------------------------------------+ 
int start() 
  { 

double cSMA2    = iMA(NULL, period, 2, 0, 1, PRICE_CLOSE,0); 
double pSMA2    = iMA(NULL, period, 2, 0, 1, PRICE_CLOSE,1);    
double cEMA5    = iMA(NULL, period, 5, 0, 1, PRICE_CLOSE,0); 
double pEMA5    = iMA(NULL, period, 5, 0, 1, PRICE_CLOSE,1);  
double cEMA10   = iMA(NULL, period, 10, 0, 1, PRICE_CLOSE,0); 
double pEMA10   = iMA(NULL, period, 10, 0, 1, PRICE_CLOSE,1);  






while(true)
{

if( cSMA2 > cEMA5 && cEMA5 > cEMA10  )
{ 
   if( tMessage != oldmsg ) { OldBars = Bars ; tMessage =  tChartPeriod+ Buy_Message ; ClOpColor = Buy_color ; break ; }
}


if( cSMA2 < cEMA5 && cEMA5 < cEMA10 )
{ 
   if( tMessage != oldmsg )  { OldBars = Bars ;  tMessage = tChartPeriod+Sell_Message ; ClOpColor = Sell_color ;   break ; }
}

if( cSMA2 > cEMA5 && cEMA5 > cEMA10  ) {TradeBars = Bars - OldBars ; tMessage = tChartPeriod+"LONG "+TradeBars ; ClOpColor = Buy_color ;  break ; } 

if(  cSMA2 < cEMA5 && cEMA5 < cEMA10 ) {TradeBars = Bars - OldBars ;tMessage = tChartPeriod+"SHORT"+TradeBars ; ClOpColor = Sell_color ;   break ; } 

tMessage = tChartPeriod+Wait_Message ; ClOpColor = Wait_color ;  TradeBars = 0 ;
 
break;

} // while

oldmsg =  tMessage ;

//+------------------------------------------------------------------+  
                    
   ObjectCreate(sPP3531, OBJ_LABEL, win, 0, 0);//HiLow LABEL
   ObjectSetText(sPP3531,tMessage, myFontSize , "Arial Bold", ClOpColor );
   ObjectSet(sPP3531, OBJPROP_CORNER, 0);
   ObjectSet(sPP3531, OBJPROP_XDISTANCE, price.x.offset); 
   ObjectSet(sPP3531, OBJPROP_YDISTANCE, price.y.offset); 


//+------------------------------------------------------------------+        


   WindowRedraw();    
 

   return(0); 
} 

//+------------------------------------------------------------------+

 
string TimeFrameToString(int tf)
{
   string tfs;
   switch(tf) {
      case PERIOD_M1:  tfs="M1"  ; break;
      case PERIOD_M5:  tfs="M5"  ; break;
      case PERIOD_M15: tfs="M15" ; break;
      case PERIOD_M30: tfs="M30" ; break;
      case PERIOD_H1:  tfs="H1"  ; break;
      case PERIOD_H4:  tfs="H4"  ; break;
      case PERIOD_D1:  tfs="D1"  ; break;
      case PERIOD_W1:  tfs="W1"  ; break;
      case PERIOD_MN1: tfs="MN";
   }
   return(tfs);
}
//+------------------------------------------------------------------+

/*
Its simple 5/10EMA 2SMA on a 5 minute chart. 
On the 15 min chart use the same on the 5 min chart. 
its a cross strategy. 
when its top to bottom 2/5/10 go long when it 10/5/2 Go short. 
The 2 SMA acts as a momentum indicator when it starts to go flat the price is in lag or reversal mode. 
They must cross and the 2SMA must poin in the direction you want the trade to go. 
Simple. 
use whatever tp/sl you want.
*/