Digital_PCCI_filter

Download script
Author: Copyright (c) 2005, Sergey Iljukhin, Novosibirsk
Digital_PCCI_filter

The Digital PCCI Filter is a specialized technical analysis tool designed to smooth out market noise and reveal underlying price trends. Unlike standard moving averages that might lag significantly or react too sharply to minor fluctuations, this script employs a sophisticated mathematical approach to isolate significant price movements from "market jitter."

Core Logic Overview

The primary objective of this indicator is to provide a refined view of the price action by applying a digital filtering process. It does not simply look at the current price in isolation; instead, it analyzes a specific window of historical data—specifically the last 20 bars—to calculate a weighted "response."

How It Works

  1. Midpoint Calculation: The tool first identifies the midpoint of each candle by averaging the high and low prices. This serves as the baseline for the analysis, ensuring that the filter reacts to the center of the price action rather than just the extremes.
  2. Weighted Analysis: The script looks back at the previous 20 candles. Each of these historical points is assigned a unique mathematical weight. These weights are not uniform; they are distributed in a specific pattern (a "bell-curve" style distribution) where the most recent past data and the older history are weighted differently to balance accuracy with responsiveness.
  3. Response Subtraction: The indicator calculates a cumulative "response" based on these 20 weighted historical points. It then subtracts this calculated response from the current price midpoint.
  4. Resulting Output: The final result is a smoothed line displayed in a separate window. This line represents the "filtered" signal of the market. By removing the statistical noise through this weighted subtraction, the indicator helps traders see the cleaner trajectory of the price flow.

Summary for Traders

Essentially, this tool acts as a sophisticated sieve. It takes the raw, volatile movements of the market and passes them through a mathematical filter that weighs the importance of recent history against older trends. The resulting line is intended to provide a clearer, more stable visual representation of market momentum, helping users identify the true direction of price movement without being misled by temporary spikes or minor fluctuations.

Miscellaneous
Implements a curve of type %1
14 Views
1 Downloads
0 Favorites
Digital_PCCI_filter
//+------------------------------------------------------------------+
//|                        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