ADX_Trend_and_Alert

ADX_Trend_and_Alert

This script is designed to automatically monitor market trends and provide real-time alerts based on specific price momentum conditions. It uses a well-known technical analysis indicator called the Average Directional Index (ADX) to determine whether the market is moving with enough strength to be considered a reliable trend.

How the Logic Works

The script constantly scans the current chart for three specific data points:

  1. Trend Strength: It measures how powerful the overall price movement is.
  2. Positive Momentum: It tracks the strength of the upward price movement.
  3. Negative Momentum: It tracks the strength of the downward price movement.

The Trading Signals

The script evaluates these three data points to identify two distinct types of market signals:

  • Bullish Signal (Buy): The script looks for a situation where the overall trend strength is high, the upward momentum is strong, and the downward momentum is weak. When all three conditions are met simultaneously, it identifies a potential upward move.
  • Bearish Signal (Sell): Conversely, it looks for a situation where the overall trend strength is high, the downward momentum is dominant, and the upward momentum is low. This identifies a potential downward move.

If the market is moving weakly or if the momentum is mixed (neither clearly up nor down), the script remains neutral and produces no signal.

Alert System

To ensure you don't have to watch the charts constantly, the script includes a smart notification system. It is designed to trigger an alert only at the moment a trend changes. For example, if the market switches from a "Buy" state to a "Sell" state, you will receive a notification. It prevents repetitive alerts by remembering the most recent signal, ensuring that you are only notified of new actions rather than being continuously alerted while the market stays in the same trend.

Indicators Used
Movement directional index
Miscellaneous
It issuies visual alerts to the screen
8 Views
0 Downloads
0 Favorites
ADX_Trend_and_Alert
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

int start()
{   
   double lastsignal=0, signal;   
   
   double Adx=iADX(NULL,0,14,PRICE_HIGH,MODE_MAIN,0);
   double PlusDi=iADX(NULL,0,14,PRICE_HIGH,MODE_PLUSDI,0);
   double MinusDi=iADX(NULL,0,14,PRICE_HIGH,MODE_MINUSDI,0);
 
   if     (Adx >= 25 && PlusDi  >= 25 && MinusDi <= 15) { 	signal = +1; }
   else if(Adx >= 25 && MinusDi >= 25 && PlusDi  <= 15) {   		signal = -1; }
   else {                                               	signal =  0; }
		    

   if (signal!=0) {
      if (signal!=lastsignal) {
         Alert("ADX signal on ", Symbol(),"/",Period());
         lastsignal= signal;   
      }
   } else { lastsignal= 0; }

}

Comments