Author: Weld

This tool is a specialized technical analysis indicator designed to help traders visualize price momentum and volatility by calculating a smoothed relationship between current price actions and historical movement. Instead of simply tracking the price, it uses a mathematical approach to identify how "stretched" or "weighted" the recent price trends are relative to their underlying history.

Core Functionality

The logic operates by analyzing a specific window of time (defined by the user as the "Depth"). Rather than looking at every single tick of data, it groups price movements to filter out minor market noise and highlight more significant trends.

Here is how the logic breaks down into plain English:

1. Data Selection The script allows you to choose exactly what type of price information you want to analyze. You can set it to follow the standard closing prices, the high and low extremes, or even a custom combination of these values (such as the sum of the day's highs and lows). This flexibility ensures the tool can be adapted to different trading styles, whether you prefer following "fair value" or extreme volatility.

2. The Calculation Process The indicator performs three primary calculations simultaneously across the chosen time window:

  • Movement Tracking: It measures the absolute difference between price points to understand the "distance" traveled by the market.
  • Weighting: It applies a weighted calculation to these differences, giving more significance to recent data than older data within the chosen window.
  • Moving Average Comparison: It tracks a running sum of prices to provide a baseline for comparison.

3. The Final Result The final output (the line you see on your chart) is derived by comparing the current weighted price movement against its historical average.

  • When the current movement is significantly different from the historical weight, the indicator reacts accordingly.
  • By dividing the current "stretch" by the historical "weight," it produces a normalized value that helps traders see if the market is currently over-extended or moving in a steady, balanced rhythm.

Summary for the User

In simple terms, this script tells you how much the price is currently deviating from its recent weighted behavior. It acts as a smoothing mechanism that translates raw, jagged price movements into a clearer line, helping you identify when the market's current velocity is consistent or beginning to shift away from its established trend.

10 Views
0 Downloads
0 Favorites
JCFBaux_v2
//+------------------------------------------------------------------+
//|                                                                  |
//|                 Copyright © 2000-2007, MetaQuotes Software Corp. |
//|                                         http://www.metaquotes.ru |
//+------------------------------------------------------------------+
#property copyright "Weld"
#property link "http://weld.torguem.net"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Magenta
//---- input parameters
extern int Depth=15;
extern int Input_Price_Customs=2;
//Âûáîð öåí, ïî êîòîðûì ïðîèçâîäèòñÿ ðàñ÷¸ò èíäèêàòîðà 
//(0-"Close", 1-"Open", 2-"High+Low", 3-"High", 4-"Low", 5-"Open+High+Low+Close", 6-Open+Close", ïî óìîë÷àíèþ-2.) 
//---- buffers
double JCFBaux[];
double @Series[];
//----
int    Bar,jrc07,Tnew,T0,T1,x;
double jrc04,jrc05,jrc06,jrc08,jrc03,jrc13,JRC04,JRC05,JRC06,Value;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   int draw_begin;draw_begin=Depth;
   SetIndexDrawBegin(0,draw_begin);
   SetIndexStyle (0,DRAW_LINE);
   IndicatorBuffers(2);
   SetIndexBuffer(0,JCFBaux);
   SetIndexBuffer(1,@Series);
   SetIndexLabel (0,"JCFBaux");
   IndicatorShortName ("JCFBaux");
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if (counted_bars<0) return(-1);
   int limit=Bars-counted_bars-1;
//----
   Tnew=Time[limit+1];
//--- âîññòàíîâëåíèå ïåðåìåííûõ
   if((Tnew!=T0)&&(limit!=Bars-1))if (Tnew==T1){jrc04=JRC04; jrc05=JRC05; jrc06=JRC06;}else return(-1);
//--- 
   switch(Input_Price_Customs)
     {
//---- Âûáîð öåí, ïî êîòîðûì ïðîèçâîäèòñÿ ðàñ÷¸ò èíäèêàòîðà
      case   0:for(x=limit; x>=0; x--)@Series[x]=Close[x];break;
      case   1:for(x=limit; x>=0; x--)@Series[x]=Open [x];break;
      case   2:for(x=limit; x>=0; x--)@Series[x]=High [x]+Low  [x];break;
      case   3:for(x=limit; x>=0; x--)@Series[x]=High [x];break;
      case   4:for(x=limit; x>=0; x--)@Series[x]=Low  [x];break;
      case   5:for(x=limit; x>=0; x--)@Series[x]=Open [x]+High [x]+Low[x]+Close[x];break;
      case   6:for(x=limit; x>=0; x--)@Series[x]=Open [x]+Close[x];break;
      default :for(x=limit; x>=0; x--)@Series[x]=High [x]+Low  [x];break;
//----
     }
   for(Bar=limit;Bar>=0;Bar--)
     {
//----
      if(Bar>=Bars-Depth*2)
        {
         jrc04=0.0;jrc05=0.0;jrc06=0.0;
//----
         for(jrc07=Depth-1;jrc07>=0;jrc07--)
           {
            jrc04=jrc04 + MathAbs(@Series[Bar+jrc07] - @Series[Bar+jrc07+1]);
            jrc05=jrc05 + (Depth + jrc07) * MathAbs(@Series[Bar+jrc07] - @Series[Bar+jrc07+1]);
            jrc06=jrc06 + @Series[Bar+jrc07+1];
           }
        }
      if(Bar<Bars-Depth*2)
        {
         jrc03=MathAbs(@Series[Bar] - @Series[Bar+1]);
         jrc13=MathAbs(@Series[Bar+Depth] - @Series[Bar+Depth+1]);
         jrc04=jrc04 - jrc13 + jrc03;
         jrc05=jrc05 - jrc04 + jrc03 * Depth;
         jrc06=jrc06 - @Series[Bar+Depth+1] + @Series[Bar+1];
        }
      jrc08=MathAbs(Depth * @Series[Bar] - jrc06);
      if (jrc05==0.0) Value=0.0;else Value=jrc08/jrc05;
      JCFBaux[Bar]=Value;
//---- Ñîõðàíåíèå ïåðåìåííûõ
      if (Bar==1){T1=Time[1];T0=Time[0];JRC04=jrc04; JRC05=jrc05; JRC06=jrc06;}
//---- 
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments