Navigation´╝ÜHome > Content >

10Min_RsiSto_01.mq4

Time: 2015-05-23 | Download file:10Min_RsiSto_01.mq4

//+------------------------------------------------------------------+
//| 10 Minute trader                                                 |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 White  // arrow up for moving average
#property indicator_color2 White  // arrow down for moving average
#property indicator_color3 Aqua   // box for stoch
#property indicator_color4 Red    // box for rsi
#property indicator_color5 White  // box for macd
#property indicator_color6 White  // dot for early stoch cross

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];


// User Input


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {

   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   // 168 open square
   
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexArrow(0,233);  //up
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexArrow(1,234);  //down

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexArrow(2,168);  //open square

   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, ExtMapBuffer4);
   SetIndexArrow(3,168);  //open square

   SetIndexStyle(4,DRAW_ARROW);
   SetIndexBuffer(4, ExtMapBuffer5);
   SetIndexArrow(4,168);  //open square

   SetIndexStyle(5,DRAW_ARROW);
   SetIndexBuffer(5, ExtMapBuffer6);
   SetIndexArrow(5,159);  //dot

   return(0);
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i=0)
     {
     
      wma_p=wma; // save previous calculations
      wma=iMA(Symbol(),0,10,0,MODE_LWMA,PRICE_CLOSE,pos);

      sma_p=sma; // save previous calculations
      sma=iMA(Symbol(),0,20,0,MODE_SMA,PRICE_CLOSE,pos);
      
      stochm=iStochastic(Symbol(),0,10,6,6,0,1,0,pos);
      stochs=iStochastic(Symbol(),0,10,6,6,0,1,1,pos);
      stochm1=iStochastic(Symbol(),0,10,6,6,0,1,0,pos+1);
      stochm2=iStochastic(Symbol(),0,10,6,6,0,1,0,pos+2);
      stochm3=iStochastic(Symbol(),0,10,6,6,0,1,0,pos+3);
      stochm4=iStochastic(Symbol(),0,10,6,6,0,1,0,pos+4);
      
      rsi=iRSI(Symbol(),0,28,PRICE_CLOSE,pos);
      rsi1=iRSI(Symbol(),0,28,PRICE_CLOSE,pos+1);
      rsi2=iRSI(Symbol(),0,28,PRICE_CLOSE,pos+2);
      rsi3=iRSI(Symbol(),0,28,PRICE_CLOSE,pos+3);
      rsi4=iRSI(Symbol(),0,28,PRICE_CLOSE,pos+4);
      
      macdm=iMACD(Symbol(),0,24,52,18,0,0,pos);
      macds=iMACD(Symbol(),0,24,52,18,0,1,pos);
      
      // RISING stochastic cross
      // if (stochm_p>stochm && stochs_pstochm)

      // FALLING stochastic cross
      // if (stochm_pstochs && stochs60 && rsi2>60 && rsi3>60 && rsi4>60 )
        {
         if (stochm1>80 && stochm2>80 && stochm3>80 && stochm4>80 )                               //red
           {
            ExtMapBuffer1[pos]=wma - 0.0011;
           }
        }

      if (rsi1<40 && rsi2<40 && rsi3<40 && rsi4<40 )
        {
         if (stochm1<20 && stochm2<20 && stochm3<20 && stochm4<20 )                               //red
           {
            ExtMapBuffer2[pos]=wma - 0.0011;
           }
        }

 
 	   pos--;
     }

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

Recommend