Navigation´╝ÜHome > Content >

A_Hanafy5.mq4

Time: 2011-09-14 | Download file:A_Hanafy5.mq4

//+------------------------------------------------------------------+
//|                                                     A Hanafy.mq4 |
//|                                                              A H |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "A H"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 MediumSeaGreen
#property indicator_color2 Red
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,0,1);
   SetIndexArrow(0,233);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW,0,1);
   SetIndexArrow(1,234);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
 //ObjectDelete("Label"); 
 //ObjectDelete("Labe2"); 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   if (counted_bars<0) return(-1); 

//---- last counted bar will be recounted 

if (counted_bars>0) counted_bars--; 

int pos=Bars-counted_bars; 

while(pos>=0) 

{  

 //buy 
  if((iRSI(NULL,0,14,PRICE_CLOSE,pos)>=30 &&iSAR(NULL,0,0.02,0.2,pos)iRSI(NULL,0,14,PRICE_CLOSE,pos+1)
  && iRSI(NULL,0,14,PRICE_CLOSE,pos)>iRSI(NULL,0,14,PRICE_CLOSE,pos+2))
  {
   
  ExtMapBuffer1[pos]=Low[pos]- 5*Point ;
  }
    else
    {
    ExtMapBuffer1[pos]=0;
    } 
  //sell

  if((iRSI(NULL,0,14,PRICE_CLOSE,pos)<=70 &&iSAR(NULL,0,0.02,0.2,pos)> High[pos])
  && iRSI(NULL,0,14,PRICE_CLOSE,pos)        

Recommend