Stomach_exit_v1
Download scriptThis script is designed as a visual tool for traders to identify specific exit points in the market based on momentum shifts. It works by monitoring a specialized technical indicator (referred to internally as "Stomach") to detect when price trends are losing steam or hitting potential reversal zones.
Instead of showing a continuous line, this script places distinct markers on your chart to highlight two specific types of scenarios:
1. Downward Exit Signals (Blue) The logic looks for a situation where the trend's momentum is beginning to drop significantly. It identifies a point where the "Moving Average" component of the indicator was previously above a high threshold (70) but has started to curve downward. When this downward movement aligns with specific price action, the script places a marker at the bottom of the current candle to signal a potential area to consider closing a position or looking for a reversal.
2. Upward Exit Signals (Red) Conversely, the script monitors for signs that an upward move is exhausting. It looks for instances where the momentum was previously below a low threshold (30) but has started to trend upward. When the indicator detects this "bottoming out" behavior, it places a marker at the top of the candle to signal a potential area where the upward move might be ending.
How it works in practice:
- Trend Monitoring: The script constantly analyzes three different layers of data: the main trend line, its moving average, and a secondary signal line.
- Dynamic Thresholds: It specifically watches for movements around the 30 and 70 levels, which are common "overbought" and "oversold" zones in trading.
- Visual Feedback: By converting these complex mathematical calculations into simple blue and red markers, the script allows you to see potential "exhaustion points" directly on your price chart without having to manually interpret the raw data of the underlying indicator.
//+------------------------------------------------------------------+
//| Fisher_exit.mq4 |
//| Kalenzo |
//| simone@konto.pl |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link "simone@konto.pl"
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
extern int KPeriod=10;
extern int DPeriod=5;
extern int Slowing=5;
extern int MA_Period=13;
extern int MA_method=1;
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,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,0,i);//MA line
double f2u = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,0,i+1);//MA line
double f3u = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,0,i+2);//MA line
double f1us = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,2,i);//signal stoch line
double f2us = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,2,i+1);//signal stoch line
double f3us = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,2,i+2);//signal stoch line
double f1d = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,1,i);//main stoch line
double f2d = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,1,i+1);//main stoch line
double f3d = iCustom(Symbol(),0,"Stomach",KPeriod,DPeriod,Slowing,MA_Period,MA_method,1,i+2);//main stoch line
double d22=(0);
double d23=(30);
double d24=(70);
if(f2u < f1u && f2u < d24 && f1u > d24)
{
exitL[i] = Low[i];
exitS[i] = 0.0;
}
else if(f2u > f1u && f2u > d23 && f1u < d23)
{
exitS[i] = High[i];
exitL[i] = 0.0;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments