//+------------------------------------------------------------------+ 
//|   _TRO_polishpip                                                 | 
//|                                                                  | 
//|   Copyright © 2007, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFT AND DONATIONS ACCEPTED                                    | 
//|                                                                  |
//|   therumpledone@gmail.com                                        |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| go to www.kreslik.com for the latest indicator updates           |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| Use www.efxgroup.com as your forex broker...                     |  
//| ...tell them therumpledone sent you!                             |  
//+------------------------------------------------------------------+ 

// FROM: http://forums.babypips.com/free-forex-trading-systems/12657-simple-30-min-system.html

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

#property indicator_chart_window
#property indicator_buffers 0


extern bool my.alert.sound = true ;


double      M30_MACD, M30_MACD_1 ;
double      M30_EMA5, M30_EMA5_1 ;
double      M30_EMA10, M30_EMA10_1 ;
double      M30_RSI14,  M30_RSI14_1;
double      M30_Open;
double      M30_Close;
double      M30_High;
double      M30_Low;


extern string mySymbol = "" ;
   
int init()
  {
  if( mySymbol == "" ) { mySymbol = Symbol() ; }
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   
//----
   
   M30_Open     = iOpen(mySymbol,PERIOD_M30,0);
   M30_Close    = iClose(mySymbol,PERIOD_M30,0);
 
   M30_High     = iHigh(mySymbol,PERIOD_M30,0);  
   M30_Low      = iLow(mySymbol,PERIOD_M30,0); 
   
   M30_EMA5     = iMA(NULL,30,5,0,1,0,0); 
   M30_EMA5_1   = iMA(NULL,30,5,0,1,0,1); 
   
   M30_EMA10     = iMA(NULL,30,10,0,1,0,0); 
   M30_EMA10_1   = iMA(NULL,30,10,0,1,0,1);   
   
   M30_RSI14     = iRSI(NULL,30,14,PRICE_CLOSE,0); 
   M30_RSI14_1   = iRSI(NULL,30,14,PRICE_CLOSE,1) ;  
    
   M30_MACD      = iMACD(NULL,30,8,20,9,PRICE_CLOSE,MODE_MAIN,0);
   M30_MACD_1    = iMACD(NULL,30,8,20,9,PRICE_CLOSE,MODE_MAIN,1) ; 

      
   Comment("M30 POLISHPIP Wait"); 
   
   
/*
Entry Rules:

Long:
1. MACD Crosses negative to positive, RSI above 50
2. MACD is positive, 5 EMA re-crosses 10 EMA in positive direction
Short:
1. MACD Crosses positive to negative, RSI below 50
2. MACD is negative, 5 EMA re-crosses 10 EMA in negative direction
Exit Rules:
1. For Entries “1” , exit when the EMA’s re-cross each other in opposite direction
2. For Entries “2”, there is a profit taking level of 25 pips.
Money Management:
1. For Entries “1”, S/L = 30 pips. Manually Trailing stop of 30 pips is recommended. This will create more break-even trades but you will lose less money, and is the safer way to trade. For entries "2" Profit taking is 25 pips.
2. Risk no more than 5% of account each trade.
Has been tested on GBP / USD and EUR / USD

*/
   
   
   if(M30_MACD_1 < 0
   && M30_MACD > 0
   && M30_RSI14 > 50  )    
   {
      if( my.alert.sound) { Alert(mySymbol,", M30 POLISHPIP BUY #1 "); }
      Print(mySymbol,", - M30 POLISHPIP BUY #1");
      Comment(mySymbol,", - M30 POLISHPIP BUY #1", "\n",
      "M30_MACD ",DoubleToStr(M30_MACD,2), "\n",
      "M30_RSI14 ",DoubleToStr(M30_RSI14,2), "\n",      
      "" ); 
   } 
   else
   if(M30_MACD_1 > 0
   && M30_MACD < 0
   && M30_RSI14 < 50  )   
   {
      if( my.alert.sound) { Alert(mySymbol,", M30 POLISHPIP SHORT #1 "); }
      Print(mySymbol,", M30 POLISHPIP SHORT #1");
      Comment(mySymbol,", M30 POLISHPIP SHORT #1", "\n",
      "M30_MACD ",DoubleToStr(M30_MACD,2), "\n",
      "M30_RSI14 ",DoubleToStr(M30_RSI14,2), "\n",      
      "" ); 
   } 
   

   if(M30_EMA5_1 > M30_EMA10_1
   && M30_EMA5 < M30_EMA10 )    
   {
      if( my.alert.sound) {Alert(mySymbol,", M30 POLISHPIP SELL #1 "); }
      Print(mySymbol,", - M30 POLISHPIP SELL #1");
      Comment(mySymbol,", - M30 POLISHPIP SELL #1", "\n",
      "M30_EMA5 ",DoubleToStr(M30_EMA5,Digits), "\n",
      "M30_EMA10 ",DoubleToStr(M30_EMA10,Digits), "\n",      
      "" ); 
   } 
   else
   if(M30_EMA5_1 < M30_EMA10_1
   && M30_EMA5 > M30_EMA10 )    
   {
      if( my.alert.sound) { Alert(mySymbol,", M30 POLISHPIP COVER #1 "); }
      Print(mySymbol,", - M30 POLISHPIP COVER #1");
      Comment(mySymbol,", - M30 POLISHPIP COVER #1", "\n",
      "M30_EMA5 ",DoubleToStr(M30_EMA5,Digits), "\n",
      "M30_EMA10 ",DoubleToStr(M30_EMA10,Digits), "\n",      
      "" ); 
   }

    
     
//----
   return(0);
  }
//+------------------------------------------------------------------+