Navigation´╝ÜHome > Content >

dan_rsi_separate_window_(modified).mq4

Time: 2018-07-28 | Download file:dan_rsi_separate_window_(modified).mq4

//+------------------------------------------------------------------+
//|                                      dan rsi separate window.mq4 |
//|                                                           .....h |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link      "interbank forum crew"

#property indicator_separate_window
#property indicator_buffers 6

#property indicator_color1 Green
#property indicator_color2 Blue
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_color5 Red
#property indicator_color6 Lime

#property indicator_level1 65
#property indicator_level2 35
#property indicator_levelcolor Blue
#property indicator_levelwidth 1
#property indicator_levelstyle STYLE_DASH

extern int RSI  = 14;        // rsi period 
extern int MA1  = 5;         // ma of rsi
extern int MODE = 0;         // 0 = sma, 1 = ema, 2 = smma, 3 = lwma
extern int cbars = 0;
extern int SoundAlert = 1;   // 0 = disabled
extern int levelUp = 65;       // level for alert 
extern int levelDn = 35;       // level for alert 

double RSIBuffer[];
double MaBuffer[];

double Up[];
double Dn[];
double ChartUp[];
double ChartDn[];

void init() {
  SetIndexStyle (0, DRAW_LINE,0, 2);
  SetIndexBuffer(0, RSIBuffer);
  SetIndexStyle (1, DRAW_LINE,0,1);    // ma of rsi
  SetIndexBuffer(1, MaBuffer);
  
  
  SetIndexStyle (2, DRAW_ARROW);
  SetIndexBuffer(2, Up);
  SetIndexEmptyValue(2,0);
  SetIndexArrow(2,233);           // change the 233 to symbol of choice
  
  SetIndexStyle (3, DRAW_ARROW);
  SetIndexBuffer(3, Dn);
  SetIndexEmptyValue(3,0);
  SetIndexArrow(3,234);           // change the 234 to symbol of choice
  
  
  
  
}

void deinit() {
}


int start() {
  int i,limit = cbars;
  if(limit==0) limit = Bars;
  for(i=limit-1; i>=0; i--) {
  
      RSIBuffer[i] = iRSI(NULL,0,RSI,PRICE_CLOSE,i);
      }
     for(i=limit-1; i>=0; i--) {
     
      MaBuffer[i] = iMAOnArray(RSIBuffer,0,MA1,0,MODE,i);
      
      if(RSIBuffer[i]>levelUp && RSIBuffer[i+1]>levelUp && MaBuffer[i]>levelUp && MaBuffer[i+1]>levelUp){if((RSIBuffer[i] - MaBuffer[i])<=0 && (RSIBuffer[i+1] - MaBuffer[i+1]) > 0) {Dn[i]=MaBuffer[i]+2;} else {Dn[i]=0;}}
      if(RSIBuffer[i]=0 && (RSIBuffer[i+1] - MaBuffer[i+1]) < 0) {Up[i]=MaBuffer[i]-2;} else {Up[i]=0;}}
      
     
     
   
   double rsicur = iRSI(NULL, 0, RSI, 0, 1);
   double rsipre = iRSI(NULL, 0, RSI, 0, 2);
   

     {
      if(RSIBuffer[i]>levelUp && RSIBuffer[i+1]>levelUp && MaBuffer[i]>levelUp && MaBuffer[i+1]>levelUp){if((rsicur < MaBuffer[i]) && (rsipre >= MaBuffer[i + 1])&& (SoundAlert != 0)) {
         Alert(Symbol(), " M", Period(), "  RSI crossed below setting");}
     }
  
  
     {
      if(RSIBuffer[i] MaBuffer[i]) && (rsipre<= MaBuffer[i + 1])&& (SoundAlert != 0)) {
         Alert(Symbol(), " M", Period(), "  RSI crossed above setting");}
      }
      }
      }
      }
       
       
//----
   return(0);
  }
//+------------------------------------------------------------------+

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

Recommend