Author: Copyright 2002, Finware.ru Ltd.
PCCI_v1

This technical indicator is designed to provide traders with a visual representation of market sentiment by calculating the relationship between current price action and a weighted historical average. Unlike standard moving averages that treat all recent data points with equal importance, this script employs a sophisticated mathematical model to identify specific trends.

Core Operational Logic

1. Weighted Historical Analysis The heart of this indicator is a complex weighting system that analyzes the closing prices of the previous 40 candles. Rather than simply averaging these prices, the script assigns a unique numerical weight to each specific day or period in the lookback range. Some past prices are given significant positive importance (contributing to the upward trend), while others are given negative weights, allowing the indicator to react more dynamically to nuances in price fluctuations.

2. Price Mean Calculation For every new candle that appears on your chart, the script performs a calculation to determine a "reference value." It sums up all those weighted historical prices to create a customized benchmark. This benchmark represents a filtered view of where the price "should" be based on the specific mathematical model provided by the developer.

3. The Variance Gap The final visual output on your chart is not the weight itself, but rather the difference (or variance) between two specific data points:

  • Current Market Reality: The midpoint of the current candle (the average of the High and Low prices).
  • The Mathematical Benchmark: The weighted reference value calculated in the previous step.

By subtracting the weighted benchmark from the current price midpoint, the indicator generates a line that shows how far the current market is deviating from its historical "weighted" path.

Summary for Traders

In practical terms, this tool helps you visualize the "momentum gap." When the line on your chart moves in a specific direction, it is signaling that the current price is pulling away from its weighted historical average. This allows traders to see whether the market is currently overextended, following a trend, or reacting to new information by comparing real-time price action against a deeply calculated historical baseline.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
PCCI_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+ 
//| PCCI.mq4 
//| 
//+------------------------------------------------------------------+ 
#property copyright "Copyright 2002, Finware.ru Ltd." 
#property link "http://www.finware.ru/" 

#property indicator_separate_window 
#property indicator_buffers 1 
#property indicator_color1 Blue 


//---- buffers 
double PCCIBuffer[]; 

//+------------------------------------------------------------------+ 
//| Custom indicator initialization function | 
//+------------------------------------------------------------------+ 
int init() 
{ 
string short_name; 
//---- indicator line 
SetIndexStyle(0,DRAW_LINE); 
SetIndexBuffer(0,PCCIBuffer); 
SetIndexDrawBegin(0,39); 
//---- 
return(0); 
} 
//+------------------------------------------------------------------+ 
//| PCCI | 
//+------------------------------------------------------------------+ 
int start() 
{ 
int i,counted_bars=IndicatorCounted(); 
double value1; 
//---- 
if(Bars<=38) return(0); 
//---- initial zero 
if(counted_bars<39) 
for(i=1;i<=0;i++) PCCIBuffer[Bars-i]=0.0; 
//---- 
i=Bars-39-1; 
if(counted_bars>=39) i=Bars-counted_bars-1; 
while(i>=0) 
{ 
value1 = 
0.36423990*Close[i+0] 
+0.33441085*Close[i+1] 
+0.25372851*Close[i+2] 
+0.14548806*Close[i+3] 
+0.03934469*Close[i+4] 
-0.03871426*Close[i+5] 
-0.07451349*Close[i+6] 
-0.06903411*Close[i+7] 
-0.03611022*Close[i+8] 
+0.00422528*Close[i+9] 
+0.03382809*Close[i+10] 
+0.04267885*Close[i+11] 
+0.03120441*Close[i+12] 
+0.00816037*Close[i+13] 
-0.01442877*Close[i+14] 
-0.02678947*Close[i+15] 
-0.02525534*Close[i+16] 
-0.01272910*Close[i+17] 
+0.00350063*Close[i+18] 
+0.01565175*Close[i+19] 
+0.01895659*Close[i+20] 
+0.01328613*Close[i+21] 
+0.00252297*Close[i+22] 
-0.00775517*Close[i+23] 
-0.01301467*Close[i+24] 
-0.01164808*Close[i+25] 
-0.00527241*Close[i+26] 
+0.00248750*Close[i+27] 
+0.00793380*Close[i+28] 
+0.00897632*Close[i+29] 
+0.00583939*Close[i+30] 
+0.00059669*Close[i+31] 
-0.00405186*Close[i+32] 
-0.00610944*Close[i+33] 
-0.00509042*Close[i+34] 
-0.00198138*Close[i+35] 
+0.00144873*Close[i+36] 
+0.00373774*Close[i+37] 
+0.01047723*Close[i+38] 
-0.00022625*Close[i+39]; 

PCCIBuffer[i]=(High[i]+Low[i])/2-value1; 

i--; 
} 
return(0); 
} 
//+------------------------------------------------------------------+ 

Comments