RoundPriceExpCh

Download script
Author: Copyright � 2006, HomeSoft-Tartan Corp.
RoundPriceExpCh

This tool is designed as a visual indicator for the MetaTrader platform, intended to help traders analyze price trends by creating a smoothed, filtered representation of market movements. Instead of plotting raw, volatile price data, it processes the information to identify underlying momentum and structural shifts.

Core Mechanism

The logic functions by analyzing a specific window of historical data—roughly the last 300 price bars. It takes the closing prices of these bars and subjects them to a multi-stage smoothing process. Rather than looking at just the most recent price point, it calculates a weighted average where older data points have less influence than more recent ones, allowing the indicator to "filter out" minor market noise and "shocks."

The Calculation Process

To achieve this smooth flow, the script performs several distinct mathematical layers:

  • Dynamic Weighting: The tool first establishes a weighting factor based on a user-defined period. This ensures that the sensitivity of the indicator can be adjusted to suit different trading styles (e.g., reacting faster to changes or remaining smoother over longer durations).
  • Recursive Smoothing: The script runs the price data through a series of consecutive calculations. Each step takes the result of the previous calculation and blends it with the current price. This creates a "chain" of smoothing, which prevents the resulting line from being jagged or erratic.
  • Trend Synthesis: Finally, the script combines these smoothed values using a specific mathematical formula to produce the final output. The goal of this final step is to generate a clear trend line that highlights the primary direction of the market movement.

Visual Output

The result is displayed as a gold-colored line in a separate window below the main price chart. By observing this line, traders can more easily identify the prevailing momentum. When the line moves upward or downward with stability, it suggests a sustained trend; when the line flattens or shifts direction, it provides a visual cue that the market's momentum may be changing.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
RoundPriceExpCh
//+------------------------------------------------------------------+
//|                                                        RPr-E.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, HomeSoft-Tartan Corp."
#property link      "spiky@yranskeino.ru"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Gold

extern int t3_period=21;
extern double b=0.7;


//---- buffers
double ExtMapBuffer1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double e1, e2, e3, e4, e5, e6, c1, c2, c3, c4, n, w1, w2, b2, b3;
   double dpo, t3;
   int mBar =300;

   b2=b*b;
   b3=b2*b;
   c1=-b3;
   c2=(3*(b2+b3));
   c3=-3*(2*b2+b+b3);
   c4=(1+3*b+b3+3*b2);
   n=t3_period;

   if (n<1) n=1;
   n = 1 + 0.5*(n-1);
   w1 = 2 / (n + 1);
   w2 = 1 - w1;
  
   
   
   for(int i=mBar; i>=0; i--)
   
   {
      
      dpo=Close[i];

      e1 = w1*dpo + w2*e1;
      e2 = w1*e1 + w2*e2;
      e3 = w1*e2 + w2*e3;
      e4 = w1*e3 + w2*e4;
      e5 = w1*e4 + w2*e5;
      e6 = w1*e5 + w2*e6;

      t3 = c1*e6 + c2*e5 + c3*e4 + c4*e3;
      ExtMapBuffer1[i]=t3;
   }
   
   return(0);
  }
//+------------------------------------------------------------------+

Comments