RoundPriceNE_pips

Author: Copyright � 2006, MetaQuotes Software Corp.
RoundPriceNE_pips

This script functions as a customized technical analysis tool designed to provide traders with a smoothed visualization of price action on a trading chart. Rather than showing raw, volatile price movements, it applies a sophisticated mathematical filter to help identify underlying trends more clearly.

Core Logic and Methodology

The script operates by processing historical price data—specifically the closing prices of assets—through a multi-layered smoothing process. Here is a breakdown of how it achieves this:

1. Data Weighting and Smoothing The tool begins by calculating specific "weights" based on a user-defined time period. These weights determine how much influence the most recent price data has compared to older data. By balancing these values, the script ensures that the resulting line reacts naturally to market movements without being overly sensitive to minor "noise" or temporary price spikes.

2. Multi-Stage Filtering Unlike a basic moving average that might only look at one level of smoothing, this logic utilizes a cumulative sequence. It takes the price data and passes it through several successive stages of calculation. Think of this as running the price data through a series of filters; each layer refines the data further, removing irregularities and emphasizing the consistent direction of the market.

3. Dynamic Polynomial Calculation The script uses a specialized mathematical formula (based on specific coefficients) to aggregate these filtered layers. This final calculation produces a singular, cohesive line on the chart. The goal of this specific mathematical approach is to produce a curve that remains "tight" to the actual price action while maintaining a smooth flow, allowing for a clearer distinction between short-term fluctuations and long-term momentum.

Visual Representation

The result of these calculations is plotted directly on your main trading window as a red line. Because it filters out the "jitter" of live markets, it serves as a visual guide to help identify whether the current price trend is strengthening or weakening. By observing the path of this line, traders can better perceive the underlying momentum of an asset at a glance.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
RoundPriceNE_pips
//+------------------------------------------------------------------+
//|                                                        SmCCI.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red

//---- input parameters


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;

   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=Bars; 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