FOREX MT4 INDICATORS DOWNLOAD
  • Donate to us
  • MT4 INDICATORS A
  • MT4 INDICATORS B
  • MT4 INDICATORS C
  • MT4 INDICATORS D
  • MT4 INDICATORS E
  • MT4 INDICATORS F
  • MT4 INDICATORS G
  • MT4 INDICATORS H
  • MT4 INDICATORS I
  • MT4 INDICATORS J
  • MT4 INDICATORS K
  • MT4 INDICATORS L
  • MT4 INDICATORS M
  • MT4 INDICATORS N
  • MT4 INDICATORS O
  • MT4 INDICATORS P
  • MT4 INDICATORS Q
  • MT4 INDICATORS R
  • MT4 INDICATORS S
  • MT4 INDICATORS T
  • MT4 INDICATORS U
  • MT4 INDICATORS V
  • MT4 INDICATORS W
  • MT4 INDICATORS X
  • MT4 INDICATORS Y
  • MT4 INDICATORS Z
  • MT4 INDICATORS NUM
  • MT4 INDICATORS SIGN

WATR_Alert.mq4

WATR_Alert.mq4 FOREX MetaTrader4 Indicators Download

WATR_Alert.mq4 download link will appear after 20 seconds.


Icon

WATR_Alert.mq4

1 file(s) 6.54 KB
Download


WATR_Alert.mq4 Programming source code.

//+------------------------------------------------------------------+
//|                                                        WATR.mq4  |
//+------------------------------------------------------------------+
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Coral
#property indicator_color2 DodgerBlue
//---- input parameters
extern int    WATR_K = 10;
extern double WATR_M = 4.0;
extern int    ATR = 21;
extern bool   ALERTS = true;
//---- buffers
double ExtMapBufferUp[];
double ExtMapBufferDown[];
//---
datetime AlertLast = 0;
//---
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {  
   IndicatorBuffers(2);  
   SetIndexBuffer(0, ExtMapBufferUp); 
   ArraySetAsSeries(ExtMapBufferUp, true);      
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(1, ExtMapBufferDown); 
   ArraySetAsSeries(ExtMapBufferDown, true);      
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   IndicatorShortName("WATR(" + WATR_K + ", " + WATR_M + ")"); 
   SetIndexLabel(0, "WATR_Up");
   SetIndexLabel(1, "WATR_Dn");  
   IndicatorDigits(_Digits);  
   return(0); 
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator function                                        |
//+------------------------------------------------------------------+
bool AntiTrendBar(int i)
  {
   bool res = (TrendUp(i) && (Close[i] < Open[i])) ||         
              (!TrendUp(i) && (Close[i] > Open[i]));    
   return(res);
  }
//+------------------------------------------------------------------+
//| Custom indicator function                                        |
//+------------------------------------------------------------------+
double CalcIndicValue(int i, bool trend)
  {
   double res = Close[i];  
   if(trend)
       res -= (WATR_K*Point + WATR_M*iATR(NULL, 0, ATR, i));
   else
       res += (WATR_K*Point + WATR_M*iATR(NULL, 0, ATR, i));        
   return(NormalizeDouble(res, _Digits));
  }
//+------------------------------------------------------------------+
//| Custom indicator function                                        |
//+------------------------------------------------------------------+
bool TrendUp(int i)
  {
   return((Close[i+1] > ExtMapBufferUp[i+1]) && 
          (ExtMapBufferUp[i+1] != EMPTY_VALUE));
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars = IndicatorCounted();
//---- ÔÓÒΉÌËÈ ÔÓÒ˜ËÚ‡ÌÌ˚È ·‡ ·Û‰ÂÚ ÔÂÂÒ˜ËÚ‡Ì
//---- ÔÂ‚Ó Á̇˜ÂÌË Ë̉Ë͇ÚÓ‡ == ˆÂÌÂ-1 point, 
//     ÚÓ ÂÒÚ¸ Ò˜ËÚ‡ÂÚ ÚẨ ‚ÓÒıÓ‰ˇ˘ËÏ
   ExtMapBufferUp[Bars] = Close[Bars] - WATR_K*Point;     
// limit = (counted_bars > 0) ? (Bars - counted_bars) : (Bars - 1);
   limit = Bars - counted_bars;
//---- ÓÒÌÓ‚ÌÓÈ ˆËÍÎ
   for(int i = limit; i >= 0; i--)
     {
       if(AntiTrendBar(i))
         {
           ExtMapBufferUp[i] = ExtMapBufferUp[i+1];            
           ExtMapBufferDown[i] = ExtMapBufferDown[i+1];            
         }
       else
         {
           if(TrendUp(i))
             {
               ExtMapBufferUp[i] = CalcIndicValue(i, true);
               if(ExtMapBufferUp[i] < ExtMapBufferUp[i+1])
                   ExtMapBufferUp[i] = ExtMapBufferUp[i+1];                                 
               ExtMapBufferDown[i] = EMPTY_VALUE; 
             }
           else
             {
               ExtMapBufferDown[i] = CalcIndicValue(i, false);                        
               if(ExtMapBufferDown[i] > ExtMapBufferDown[i+1])
                   ExtMapBufferDown[i] = ExtMapBufferDown[i+1];                                             
               ExtMapBufferUp[i] = EMPTY_VALUE;
             }
         }
       // ÔÂÂÒ˜ÂÌˡ Ò ˆÂÌÓÈ                 
       if(TrendUp(i) && (Close[i] < ExtMapBufferUp[i]))
         {
           ExtMapBufferDown[i] = CalcIndicValue(i, false);  
           ExtMapBufferUp[i] = EMPTY_VALUE;
         }
       if((!TrendUp(i)) && (Close[i] > ExtMapBufferDown[i]))
         {
           ExtMapBufferUp[i] = CalcIndicValue(i, true);                  
           ExtMapBufferDown[i] = EMPTY_VALUE; 
         }
     }
     //---
     //---
     if (ALERTS && AlertLast != Time[0]) {
        if (ExtMapBufferDown[0] != EMPTY_VALUE && NormalizeDouble(Bid, _Digits) >= NormalizeDouble(ExtMapBufferDown[0], _Digits)) {
            AlertLast = Time[0];
            Alert("WATR > ", Symbol(), " : ", eGetPeriodString(), " > DOWN");
        }
        if (ExtMapBufferUp[0] != EMPTY_VALUE && NormalizeDouble(Bid, _Digits) <= NormalizeDouble(ExtMapBufferUp[0], _Digits)) {
            AlertLast = Time[0];
            Alert("WATR > ", Symbol(), " : ", eGetPeriodString(), " > UP");
        }
     }
     //---
   return(0);
  }
//+------------------------------------------------------------------+
string eGetPeriodString()
{
    string periodStr = "??";
    if      (_Period == PERIOD_M1)  { periodStr = "M1";  }
    else if (_Period == PERIOD_M5)  { periodStr = "M5";  }
    else if (_Period == PERIOD_M15) { periodStr = "M15"; }
    else if (_Period == PERIOD_M30) { periodStr = "M30"; }
    else if (_Period == PERIOD_H1)  { periodStr = "H1";  }
    else if (_Period == PERIOD_H4)  { periodStr = "H4";  }
    else if (_Period == PERIOD_D1)  { periodStr = "D1";  }
    else if (_Period == PERIOD_W1)  { periodStr = "W1";  }
    else if (_Period == PERIOD_MN1) { periodStr = "MN1"; }
    //---
    return(periodStr);
}
//+------------------------------------------------------------------+

WATR.mq4 Wave trend oscillator 1.5.mq4

Related Posts

METATRADER4W

Wpr (alerts + arrows).mq4

METATRADER4W

WmiVol.mq4

METATRADER4W

wlxFractals.mq4

METATRADER4W

Williams_Accumulation_Distribution.mq4

METATRADER4W

Williams AD +MA TT [x3 AG].mq4

METATRADER4W

wbb.mq4

METATRADER4W

Wave trend oscillator 1.5.mq4

METATRADER4W

WATR.mq4

METATRADER4W

Waddah_Attar_Pivot_Fibo_First.mq4

METATRADER4W

Web_Trend_Mountain.ex4

How to use this site.
  1. Subscribe YouTube
  2. Subscribe Facebook
  3. Subscribe Instagram
  4. Download MT4
  5. Watch Youtube Video
  6. Downliad Indicator and Try Trading
  7. Donate to us for update

Recent News

  • i-g-cci2.mq4
  • haosvisual_27jk8.mq4
  • HamaSystem separate window.ex4
  • HalfTrend 2.mq4
  • Gitalovsa.mq4

Donate