ADX_Crossy
Download scriptThis specialized trading tool is designed to identify specific shifts in market momentum by monitoring the relationship between two primary trend indicators. Instead of just looking at price movement alone, it analyzes the "strength" and "direction" of the market to pinpoint potential turning points where one force overcomes another.
Core Operational Logic
The script operates by comparing two moving components of the ADX (Average Directional Index) indicator:
- The Plus DI: Represents the strength of upward price movement.
- The Minus DI: Represents the strength of downward price movement.
Rather than simply tracking where these lines sit, the logic focuses on crossovers. It scans historical and real-time data to find the exact moment these two components switch positions.
How It Identifies Signals
The tool looks for two specific scenarios to trigger a visual cue on your chart:
-
Bearish Reversal (Downside Signal): The script monitors if the "Plus" indicator was previously higher than the "Minus" indicator but has just dropped below it. This suggests that upward momentum is exhausting and selling pressure is taking over. When this happens, the tool places a visual marker below the price.
-
Bullish Reversal (Upside Signal): Conversely, the script looks for moments where the "Minus" indicator was previously higher than the "Plus" indicator but has just dropped below it. This indicates that downward pressure is fading and buying momentum is taking control. In this case, the tool places a visual marker above the price.
Dynamic Adjustments
To ensure the signals remain clear across different types of charts (ranging from fast 1-minute scales to long-term daily views), the script includes an automated "spacing" logic. It calculates how far away the markers should appear from the candles based on your chosen timeframe. This prevents the visual signals from overlapping with the price bars, ensuring that whether you are day trading or swing trading, the information remains easy to read at a glance.
Summary for the User
In short, this tool acts as an early-warning system. It filters out the "noise" of standard price movement and only alerts you when there is a confirmed shift in market dominance—specifically when the trend strength flips from one direction to another.
//+------------------------------------------------------------------+
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
extern int ADXcrossesPeriod = 14;
extern int SignalBar=1;
extern int CountBars=350;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double b4plusdi, b4minusdi, nowplusdi, nowminusdi;
int nShift;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0, DRAW_ARROW, 0, 1);
SetIndexArrow(0, 225);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1, DRAW_ARROW, 0, 1);
SetIndexArrow(1, 226);
SetIndexBuffer(1, ExtMapBuffer2);
IndicatorShortName("ADXcrosses(" + ADXcrossesPeriod + ")");
SetIndexLabel(0, "ADXcrUp");
SetIndexLabel(1, "ADXcrDn");
switch(Period())
{
case 1: nShift = 1; break;
case 5: nShift = 3; break;
case 15: nShift = 5; break;
case 30: nShift = 10; break;
case 60: nShift = 15; break;
case 240: nShift = 20; break;
case 1440: nShift = 80; break;
case 10080: nShift = 100; break;
case 43200: nShift = 200; break;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars = IndicatorCounted();
if(counted_bars < 0)
return(-1);
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
for(int i = 0; i < limit; i++)
{
b4plusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_PLUSDI, i+SignalBar+1 );
nowplusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_PLUSDI, i+SignalBar);
b4minusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_MINUSDI, i+SignalBar+1);
nowminusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_MINUSDI, i+SignalBar);
if(b4plusdi > b4minusdi && nowplusdi < nowminusdi)
ExtMapBuffer1[i] = Low[i] - nShift*Point;
if(b4plusdi < b4minusdi && nowplusdi > nowminusdi)
ExtMapBuffer2[i] = High[i] + nShift*Point;
}
return(0);
}
Comments