AbsoluteStrength_exit

Download script
Author: Kalenzo
AbsoluteStrength_exit

The AbsoluteStrength_exit tool is a specialized technical analysis indicator designed to identify precise exit points for trading positions. Rather than providing continuous trend lines, it acts as a signal generator that marks specific areas on your chart where the momentum of a move may be losing steam, suggesting it might be an appropriate time to secure profits or close a trade.

Core Logic and Operation

The indicator functions by analyzing the relationship between "Absolute Strength" values—which measure the underlying power of price movement—and their corresponding signal lines. It evaluates these values across three consecutive historical data points to ensure that the signals generated are based on a sustained shift in momentum rather than temporary market "noise."

The logic is divided into two primary detection modes:

1. Identifying Downward Momentum (Exit for Long Positions) The script monitors whether the upward strength of the market is beginning to weaken significantly compared to downward pressure. It looks for a specific mathematical "crossover" where:

  • The current upward strength remains higher than the downward strength, but is trending downward.
  • The strength has crossed below its own signal line (a trailing average).
  • When these conditions align over the recent price history, the indicator places a marker at the Low of the candle to suggest a potential exit point for those holding buy positions.

2. Identifying Upward Momentum (Exit for Short Positions) Conversely, the script monitors for signs that a downward move is losing its intensity. It identifies these points by checking if:

  • The current downward strength remains higher than the upward strength but is starting to drop.
  • The downward strength has crossed below its signal line.
  • When this occurs, the indicator places a marker at the High of the candle to suggest an exit point for those holding sell positions.

Key Customization Features

To adapt the tool to different market environments (such as Forex, Stocks, or Commodities), the script includes several adjustable parameters:

  • Method Selection: Users can choose between different mathematical models (RSI-based or Stochastic-based) to calculate the underlying strength.
  • Sensitivity Adjustments: Parameters for "Length," "Smoothing," and "Signal" allow you to control how fast or slow the indicator reacts to price changes.
  • Price Source: The tool can be configured to look at various types of pricing data, such as the closing price, opening price, or high/low extremes, to determine market strength.

Summary for the Trader

Essentially, this script acts as a "warning system." It does not tell you when to enter a trade; instead, it monitors the "exhaustion" of a move. By identifying the moment when the current trend's strength begins to curl back on itself relative to its signal line, it provides visual cues on your chart to help manage risk and capture profits effectively.

Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
AbsoluteStrength_exit
//+------------------------------------------------------------------+
//|                                        AbsoluteStrength_exit.mq4 |
//|                                        Newdigital                |
//|                                        Modified from Fisher_exit |
//|                                        created by Kalenzo        |
//|                                                  simone@konto.pl |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "simone@konto.pl"
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Magenta
extern int       Mode   =  0; // 0-RSI method; 1-Stoch method
extern int       Length = 10; // Period
extern int       Smooth =  5; // Period of smoothing
extern int       Signal =  5; // Period of Signal Line
extern int       Price  =  0; // Price mode : 0-Close,1-Open,2-High,3-Low,4-Median,5-Typical,6-Weighted
extern int       ModeMA =  3; // Mode of Moving Average
double exitL[],exitS[];

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,EMPTY,1);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,1);
   
   SetIndexBuffer(0,exitL);
   SetIndexBuffer(1,exitS);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//----
   for(int i = 0 ;i < limit ;i++)
   {
      double f1u = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,0,i);//up
      double f2u = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,0,i+1);//up
      double f3u = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,0,i+2);//up
      
      double f1us = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,2,i);//up_sig
      double f2us = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,2,i+1);//up_sig
      double f3us = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,2,i+2);//up_sig
      
      double f1ds = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,3,i);//up_sig
      double f2ds = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,3,i+1);//up_sig
      double f3ds = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,3,i+2);//up_sig
      
      
      double f1d = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,1,i);//dn
      double f2d = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,1,i+1);//dn
      double f3d = iCustom(Symbol(),0,"AbsoluteStrength_v1",Mode,Length,Smooth,Signal,Price,ModeMA,1,i+2);//dn
      
      if(f1u > f1d && f2u > f2d && f2u > f2us && f1u < f1us)
      {
         exitL[i] = Low[i];
         exitS[i] = 0.0; 
      }
      else if(f1d > f1u && f2d > f2u && f2d > f2ds && f1d < f1ds)
      {
        exitS[i] = High[i];
        exitL[i] = 0.0; 
      }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments