Forex Alert System

Download script
Forex Alert System

This tool is designed to function as a visual trend-tracking indicator for your trading charts. Its primary purpose is to identify specific moments where the momentum of the market shifts from bullish (upward) to bearish (downward), or vice versa, by analyzing price movements over a set period.

How the Logic Works

The script monitors the relationship between two momentum components: the "Plus" indicator (which tracks upward pressure) and the "Minus" indicator (which tracks downward pressure). Rather than looking at the price alone, it analyzes how these two forces interact with each other relative to the most recent data points.

The logic follows a specific "crossover" rule to determine when to trigger a signal:

  • Buy Signals: The script looks for a situation where the upward momentum was previously stronger than the downward momentum but has suddenly dropped below it. When this reversal occurs, the tool identifies a potential shift in sentiment and marks it on your chart with a visual indicator.
  • Sell Signals: Conversely, the script monitors for instances where the downward momentum was previously dominant but has suddenly been overtaken by upward pressure. It flags these moments as potential sell opportunities.

Key Features and Behavior

  • Visual Alerts: Every time the logic detects one of these crossovers, it automatically places an arrow on your chart. A "Buy" signal is positioned slightly below the candle's low price, while a "Sell" signal is placed slightly above the candle's high price.
  • Automated Notifications: Beyond the visual markers, the script provides real-time alerts. It will trigger a pop-up notification containing the specific signal type (Buy or Sell), the exact time of the occurrence, and the name of the currency pair or asset being traded.
  • Customizable Range: The tool allows you to define how many past bars it should analyze. This ensures that the chart remains clean and only displays the most relevant data for your current trading timeframe.
  • Dynamic Sensitivity: By utilizing an adjustable period (ADXbars), the script can be tuned to react more quickly to short-term fluctuations or provide a smoother, slower analysis of long-term trends.
Price Data Components
Series array that contains open time of each bar
Indicators Used
Movement directional index
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
14 Views
0 Downloads
0 Favorites
Forex Alert System
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red

//---- input parameters
extern int ADXbars=14;
extern int CountBars=1500;


//---- buffers
double val1[];
double val2[];

double b4plusdi,nowplusdi,b4minusdi,nowminusdi;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {   
   if (CountBars>=Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars);
   SetIndexDrawBegin(1,Bars-CountBars);
   int i,shift,counted_bars=IndicatorCounted();


   //---- check for possible errors
   if(counted_bars<0) return(-1);

   //---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0;
      for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0;
            
     } 
     
for (shift = CountBars; shift>=0; shift--)

{ 

	b4plusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift-1);
	nowplusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift);
	b4minusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift-1);
	nowminusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift); 
if (b4plusdi>b4minusdi && nowplusdi<nowminusdi && i!=1)
{
   val1[shift]=Low[shift]-5*Point;
   Alert("Buy Signal","\n","Current time is ",TimeToStr(CurTime()),"\n",Symbol());
   i++;
}
if (b4plusdi<b4minusdi && nowplusdi>nowminusdi && i!=1)
{
   val2[shift]=High[shift]+5*Point;
   Alert("Sell Signal","\n","Current time is ",TimeToStr(CurTime()),"\n",Symbol());
   i++;
}
 
      
}

   return(0);
  }
//+------------------------------------------------------------------+



Comments