Digital PCCI filter_v1

Download script
Author: Copyright (c) 2005, Sergey Iljukhin, Novosibirsk
Digital PCCI filter_v1

The Digital PCCI Filter is a specialized technical analysis tool designed to smooth out market noise and identify underlying price trends with high precision. Unlike standard moving averages that simply average past prices, this script utilizes a digital signal processing approach to provide a cleaner interpretation of market movements.

Core Logic and Methodology

The primary function of this indicator is to isolate the "true" price action by filtering out minor fluctuations. It achieves this through the following logical steps:

  • Midpoint Calculation: The tool starts by identifying the midpoint of every price candle (the average between the high and the low). This provides a consistent baseline for analyzing the current market position.
  • Weighted Response Analysis: Instead of giving equal importance to all recent data, the script applies a specific mathematical weight to a 20-period window of historical data. Each previous midpoint is multiplied by a unique coefficient. These weights are strategically distributed to prioritize certain areas of the lookback period, allowing the filter to react more intelligently to price changes.
  • Dynamic Offset Filtering: The tool calculates a "response" value—a weighted summary of past activity. By subtracting this response from the current price midpoint, the script effectively strips away the "echoes" of previous price action.
  • Trend Visualization: The final result is plotted as a dedicated line in a separate window. This line represents the refined price signal, highlighting the fundamental direction of the market while ignoring the "jitter" that often makes it difficult for traders to see clear trends in real-time.

Practical Application

By using this digital filtering logic, traders can observe a smoother representation of market momentum. It is designed to help identify the primary trend more clearly than raw price charts allow, providing a sophisticated layer of analysis that focuses on high-probability price movement over temporary volatility.

Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
Digital PCCI filter_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                        Digital PCCI Filter                       |
//|                      Copyright (c) Sergey Iljukhin, Novosibirsk. |
//|                       email sergey[at]tibet.ru http://fx.qrz.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright (c) 2005, Sergey Iljukhin, Novosibirsk"
#property link      "http://fx.qrz.ru/"

// --- Parameters: P1=50, D1=14, A1=3
// --- P2=54, D2=51, A2=50, Ripple=0.08, Delay=11
// --- Order [Auto]=20, Calculate method=2

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red

//---- buffers
double FilterBuffer[];

//+------------------------------------------------------------------+
//| Digital filter indicator initialization function                 |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,FilterBuffer);
SetIndexDrawBegin(0,20);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Digital filter main function                                     |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
double response;
//----
if(Bars<=20) return(0);
//---- initial zero
if(counted_bars<20)
for(i=1;i<=0;i++) FilterBuffer[Bars-i]=0.0;
//----
i=Bars-20-1;
if(counted_bars>=20) i=Bars-counted_bars-1;
while(i>=0)
{
response=
// 0*((High[i+0]+Low[i+0])/2)
// 0*((High[i+1]+Low[i+1])/2)
 +0.0328596706665*((High[i+2]+Low[i+2])/2)
 +0.02766391536906*((High[i+3]+Low[i+3])/2)
 +0.0372462661561*((High[i+4]+Low[i+4])/2)
 +0.0471931369620*((High[i+5]+Low[i+5])/2)
 +0.0569044599702*((High[i+6]+Low[i+6])/2)
 +0.0657924462253*((High[i+7]+Low[i+7])/2)
 +0.0730704081225*((High[i+8]+Low[i+8])/2)
 +0.0782920581838*((High[i+9]+Low[i+9])/2)
 +0.0809776383446*((High[i+10]+Low[i+10])/2)
 +0.0809776383446*((High[i+11]+Low[i+11])/2)
 +0.0782920581838*((High[i+12]+Low[i+12])/2)
 +0.0730704081225*((High[i+13]+Low[i+13])/2)
 +0.0657924462253*((High[i+14]+Low[i+14])/2)
 +0.0569044599702*((High[i+15]+Low[i+15])/2)
 +0.0471931369620*((High[i+16]+Low[i+16])/2)
 +0.0372462661561*((High[i+17]+Low[i+17])/2)
 +0.02766391536906*((High[i+18]+Low[i+18])/2)
 +0.0328596706665*((High[i+19]+Low[i+19])/2);
FilterBuffer[i]=(High[i]+Low[i])/2-response;

i--;
}
return(0);
}

Comments