Download MetaTrader 5

Market Range Alert

To add comments, please log in or register
nozzgile
24
nozzgile  

Hi. I have problem for making Alert if market goes 100% from Averange Range. it will always give alert if it reach it, i have a very minor MQL experiance (Newbie) and i need for the expert for Help me FIx this.. thanks for your cooperation.

//+------------------------------------------------------------------+
//|                                       DPC Market Range Alert.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                  http://wwwDeltaPrimeCapital.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://wwwDeltaPrimeCapital.com"

#property indicator_chart_window

extern int  ATR   =  26;
extern int  ATRtf =  PERIOD_D1;
extern int  Range = 100;

int PrevAlertTime = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++;counted_bars--;
   for(int i=0; i<limit; i++)
   
   double ADR  = iATR(NULL,ATRtf,ATR,i)/Point; 
   double DR    = ( iHigh(NULL,ATRtf,0) - iLow(NULL,ATRtf,0) )/Point;
   double DPR = (DR/ADR)*100; 
     
   
   
   double alertTag;
   
   
      
   if ( (DPR*Point) > (Range*Point) )
   {if ( alertTag!=Time[0])
         {PlaySound("news.wav");// buy wav
                   Alert(Symbol(),"  M",Period()," ", Symbol(), " Reach ",Range, " %" );}alertTag = Time[0];}
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
Alexander Piechotta
7040
Alexander Piechotta  
//+------------------------------------------------------------------+
//|                                       DPC Market Range Alert.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                  http://wwwDeltaPrimeCapital.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://wwwDeltaPrimeCapital.com"

#property indicator_chart_window

extern int  ATR   =  26;
extern int  ATRtf =  PERIOD_D1;
extern int  Range = 100;

int PrevAlertTime = 0;



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++;counted_bars--;
   for(int i=0; i<limit; i++)
   
   double ADR  = iATR(NULL,ATRtf,ATR,i)/Point; 
   double DR    = ( iHigh(NULL,ATRtf,0) - iLow(NULL,ATRtf,0) )/Point;
   double DPR = (DR/ADR)*100; 
     
   
   
   
   
   
      
   if ( (DPR*Point) > (Range*Point) )
   {if ( PrevAlertTime!=Time[0])
         {PlaySound("news.wav");// buy wav
                   Alert(Symbol(),"  M",Period()," ", Symbol(), " Reach ",Range, " %" );}PrevAlertTime = Time[0];}
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

To add comments, please log in or register