alert

To add comments, please log in or register
campa_za
7
campa_za  
hello there I want to set an alert on my mt4 platform but I want it on the over bought or oversold indicator. can some one help me?
Magruder Trading Group, Inc.
151
Chad Magruder  

You will have to write a custom indicator to send the Alert...

//+------------------------------------------------------------------+
//|                                               AlertIndicator.mq4 |
//+------------------------------------------------------------------+
#property version   "1.00"
#property strict
#property indicator_chart_window
extern int OVERBOUGHT=70;
extern int OVERSOLD=20;
extern int MaxAlerts=3;
double RSI;
int ALERT=0;
int bars;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   bars=Bars;
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start(){
if(bars!=Bars){
   bars=Bars;
   RSI=iRSI(Symbol(),0,14,PRICE_CLOSE,1);
   if(RSI>OVERBOUGHT && ALERT<MaxAlerts){
      Alert("RSI OVERBOUGHT");
      ALERT++;
   }
   if(RSI<OVERSOLD && ALERT<MaxAlerts){
      Alert("RSI OVERSOLD");
      ALERT++;
   }
   if(RSI<OVERBOUGHT && RSI>OVERSOLD){ALERT=0;}
}
return(0);
}
//+------------------------------------------------------------------+
Files:
To add comments, please log in or register