Author: Yuriy Tokman (YTG)
turn_area

The Turn Area indicator is a specialized market analysis tool designed to help traders visualize specific price dynamics by combining two of the most fundamental components of technical analysis: moving averages and relative strength. Rather than showing simple price action, this script calculates a custom value that highlights potential "turn" zones where momentum might be shifting.

How the Logic Works

The indicator functions by measuring the relationship between trend-following data and momentum oscillators. It processes information through three primary components:

1. Trend Context (Exponential Moving Average) The script utilizes an Exponential Moving Average (EMA) to establish the baseline trend of the market. Unlike a simple average, the EMA reacts more quickly to recent price changes, allowing the indicator to stay sensitive to current market shifts.

2. Momentum Measurement (Relative Strength Index) Simultaneously, the script monitors the Relative Strength Index (RSI). This is used to determine if an asset is being bought or sold aggressively. The logic specifically looks for "overextended" movements—points where the market might be reaching a limit and preparing for a reversal.

3. The Calculation Formula The unique "Turn Area" value is produced by combining these two data points into a single calculation. It takes the difference between the current moving average and a modified RSI value (adjusted by a constant factor).

By subtracting these values from one another, the indicator effectively filters out "noise" and isolates the gap between the current trend and the underlying momentum. This creates a histogram that represents the intensity of the price movement relative to its historical average.

Visual Representation

The result is displayed as a histogram in a separate window below your main price chart. By observing the height and direction of these bars, traders can get a clearer sense of whether the market is approaching a point of exhaustion or if it has enough strength to continue its current path.

Essentially, this tool acts as a "momentum filter," helping you see where the underlying pressure of the market might be starting to bend or turn.

Indicators Used
Moving average indicatorRelative strength index
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
turn_area
//+------------------------------------------------------------------+
//|                                                    Turn Area.mq4 |
//|                                               Yuriy Tokman (YTG) |
//|                                               http://ytg.com.ua/ |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman (YTG)"
#property link      "http://ytg.com.ua/"
#property version   "1.00"
#property strict
#property indicator_separate_window

#property indicator_buffers 1
#property indicator_color1 clrDarkViolet
#property indicator_width1 2
#property indicator_levelcolor clrSilver
#property indicator_levelstyle STYLE_SOLID
#property indicator_level1 0
#property indicator_level2 25
#property indicator_level3 -25
#property indicator_level4 20
#property indicator_level5 -20
#property indicator_level6 15
#property indicator_level7 -15


input int                EMA_Period   = 12;
input ENUM_MA_METHOD     EMA_Method =0;
input ENUM_APPLIED_PRICE EMA_Price =0;
input int                RSI_Period = 21;
input ENUM_APPLIED_PRICE PSI_Price =0;
//---- buffers
double ExtMapBuffer1[];
string name="";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   name = "Turn Area";
   IndicatorShortName(name);
   
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexLabel(0,name);
   SetIndexDrawBegin(0,MathMax(RSI_Period,EMA_Period));    
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   int limit=rates_total-prev_calculated;
   if(prev_calculated==0)limit--;
   else  limit++;  
   double hi=0, lo=0, ce=0;
   for( int i=0; i<limit && !IsStopped(); i++)
    { 
     ExtMapBuffer1[i] =
     ((iMA(NULL,0,EMA_Period,0,EMA_Method,EMA_Price,i) 
     - (50 - iRSI(NULL, 0, RSI_Period, PSI_Price,i))*Point)
     - iMA(NULL,0,EMA_Period,0,EMA_Method,EMA_Price,i) )
     /Point ;
    }  
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

Comments