sar_AUTO_STOP_REVERS
Download scriptThis automated trading indicator is designed to provide visual signals on a price chart by analyzing the strength and momentum of market trends. Instead of relying on a single piece of data, it combines three distinct technical components to filter out "noise" and identify high-probability entry points where a trend might be reversing or stabilizing.
Core Analytical Logic
The script operates by evaluating the market based on three primary conditions:
1. Trend Direction (Parabolic SAR) The tool uses the Parabolic SAR (Stop and Reverse) indicator as its primary visual reference. This is a trend-following tool that plots dots above or below the price candles to indicate whether the current momentum is bullish (upward) or bearish (downward).
2. Trend Strength (ADX Measurement) To ensure the script doesn't give signals during "choppy" or sideways markets where prices move without clear direction, it uses the Average Directional Index (ADX). The logic looks at the ADX value to determine if there is sufficient power behind a move. Specifically, it monitors whether the trend strength is increasing or decreasing over time.
3. The "Sweet Spot" Filtering The script employs a specific set of rules to decide when to display a signal:
- Active Trend Identification: It looks for moments where the ADX value sits within a specific "healthy" range (between 25 and 40). This helps identify a trend that is strong enough to be tradable but hasn't become overextended.
- Momentum Confirmation: It compares current market strength against the previous candle to see if the momentum is accelerating or decelerating.
Visual Execution
The indicator translates these mathematical calculations into visual markers on your trading screen:
- Primary Signals: When the market meets specific criteria—namely, a rising ADX value within the target range and a consistent trend direction—the script places a visual marker based on the standard Parabolic SAR calculation.
- Contrarian/Warning Signals: The script also features a secondary logic check. If the market strength falls below the minimum threshold, exceeds the maximum limit, or shows a decline in momentum, it triggers a different visual marker using an adjusted sensitivity setting. This serves as a notification that the current trend is losing steam or that the market is entering a period of high volatility/instability.
Summary for the User
Essentially, this tool acts as a "filter." It watches the market's pulse (ADX) and its path (Parabolic SAR) simultaneously. It aims to highlight moments where the price is moving with intent, while providing visual alerts when that intent starts to fade, helping traders avoid entering positions in weak or exhausted markets.
//+------------------------------------------------------------------+
//| AUTO_STOP_REVERS.mq4 |
//| "pip" |
//+------------------------------------------------------------------+
#property copyright "pupok"
#property link "bobik@trah.guchka.eu"
#property indicator_chart_window
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_buffers 2
extern int Range=14;
extern int ATR=14;
double ExtGlistoBuffer[];
double ExtGlistoBuffer2[];
//----------------------------------------------------------------+
int init()
{
SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID);
SetIndexBuffer(0, ExtGlistoBuffer);
SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID);
SetIndexBuffer(1, ExtGlistoBuffer2);
SetIndexArrow(1,159);
SetIndexArrow(0,159);
return(0);
}
void start()
{
ExtGlistoBuffer[0] = EMPTY_VALUE;
ExtGlistoBuffer2[0] = EMPTY_VALUE;
int counted = IndicatorCounted();
if (counted < 0) return (-1);
if (counted > 0) counted--;
int limit = Bars-counted;
for (int i=limit; i >= 0; i--)
{
double ma =iSAR(NULL,0,0.02,0.2,i);
double ma1 =iSAR(NULL,0,0.02,0.2,i);
double dma;
dma=iADX(NULL, 0, 14,PRICE_MEDIAN,MODE_MAIN, i);
if (
iADX(NULL, 0, 14,PRICE_CLOSE,MODE_MAIN, i)>iADX(NULL, 0, 14,PRICE_CLOSE,MODE_MAIN, i+1)
&&
dma>25
&&
dma<40
)//
ExtGlistoBuffer[i] =iSAR(NULL,0,0.02,0.2,i) ;
if (
iADX(NULL, 0, 14,PRICE_CLOSE,MODE_MAIN, i)<iADX(NULL, 0, 14,PRICE_CLOSE,MODE_MAIN, i+1)
||
dma<25
||
dma>40
)
ExtGlistoBuffer2[i] =iSAR(NULL,0,0.1,0.5,i);
}
}
Comments