Fisher Transform for CCO, COGO or RVI

Author: Copyright � 2006, Luis Guilherme Damiani
Fisher Transform for CCO, COGO or RVI

This technical indicator is designed to provide traders with a visual representation of market momentum and price behavior by combining two distinct mathematical layers: an oscillator selection system and a "Stochastic Fisher" transformation.

Core Logic Overview

The script functions by analyzing price data through the following multi-step process:

1. Underlying Oscillator Selection The tool is versatile because it allows the user to choose which primary market sentiment indicator to use as its foundation. Depending on your selection, the script pulls raw data from one of four different sources:

  • Cyber Cycle Oscillator
  • Center of Gravity (CG) Oscillator
  • Relative Vigor Index (RVI)
  • Relative Strength Index (RSI)

2. Stochastic Normalization Once the primary oscillator is chosen, the script looks at a specific window of recent price bars (determined by the user's "Length" setting). It identifies the highest and lowest values within that window and calculates where the current price sits relative to those extremes. This essentially "normalizes" the data into a standard range, making it easier to identify overextended movements.

3. Weighted Smoothing To reduce market "noise" and prevent the indicator from reacting too erratically to minor price fluctuations, the script applies a weighted moving average to the normalized data. It gives more importance to the most recent price points while still considering the immediate past. This ensures that the resulting trend line remains fluid rather than jagged.

4. The Fisher Transformation The final and most unique step is the application of a logarithmic transformation (similar to a Fisher Transform). This mathematical process converts the smoothed momentum data into an indicator that emphasizes sharp turning points. By applying this, the script aims to highlight significant changes in price direction more clearly than a standard oscillator would.

Visual Output

The result is displayed in a separate window below your main chart as two distinct lines:

  • Primary Line: Represents the final transformed momentum.
  • Secondary Line: Acts as a slight offset or shadow, helping traders visualize the immediate trajectory of the current price action.

By combining these layers, the script seeks to provide a clearer picture of whether a market trend is gaining strength, losing steam, or preparing for a significant reversal based on the specific oscillator you choose to prioritize.

Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
7 Views
0 Downloads
0 Favorites
Fisher Transform for CCO, COGO or RVI
//+------------------------------------------------------------------+
//|                                                                  |
//|                         Copyright © 2006, Luis Guilherme Damiani |
//|                                      http://www.damianifx.com.br |
//|
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Luis Guilherme Damiani"
#property link      "http://www.damianifx.com.br"

#property indicator_buffers 2
#property indicator_separate_window
//#property indicator_chart_window

#property indicator_color1 Yellow
#property indicator_color2 Blue
#property indicator_maximum 0.8
//#property indicator_color3 Purple

//---- input parameters
extern int length=8;
extern int    maxbars=1000;
extern bool mean_signal=false;
extern string Base_Oscillator_Choice="0= Cyber Cycle, 1= CG, 2= RVI, other= RSI(12) ----------------";
extern int Osc_Choice=0;

//---- buffers
double ind1[];
double ind2[];
//double ind3[];
//double AuxBuffer[]; //Smooth

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ind1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ind2);
//   SetIndexStyle(2,DRAW_LINE);
 //  SetIndexBuffer(2,ind3);
   SetLevelValue(0,0.0);
//   SetLevelValue(1,-0.8);
   ArrayInitialize(ind1,0.0);
   ArrayInitialize(ind2,0.0);
//   ArrayInitialize(ind3,0.0);
///   ArrayResize(AuxBuffer,maxbars+3);
 //  ArrayInitialize(AuxBuffer,0.0);
 switch(Osc_Choice)
 {
 case 0: IndicatorShortName("StochFisher of Cyber Cycle     ");break;
 case 1: IndicatorShortName("StochFisher of CG Oscillator     ");break;
 case 2: IndicatorShortName("StochFisher of Relative Vigor Index      ");break;
 default: IndicatorShortName("StochFisher of RSI(12)        ");break;
 
 }  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
  {//1
   
      int    counted_bars=IndicatorCounted();
      double num=0,denom=0;
      double indw[];
      double stoch[];
      double mstoch;
      ArrayResize(indw,length);
      ArrayInitialize(indw,0);  
      ArrayResize(stoch,Bars);
      ArrayInitialize(stoch,0);  
      //---- check for possible errors
      if(counted_bars<0) return(-1);
      int limit=Bars-2*length-counted_bars;
      if(limit>maxbars)limit=maxbars;      
      //if (limit>Bars-1)limit=Bars-1;   
      //---- 
      for (int i = limit; i>=0;i--)
      {//2
         for(int j=0;j<length;j++)
         {
            switch(Osc_Choice)
            {
             case 0: indw[j]=iCustom(NULL,0,"Cyber Cycle Oscillator",0,i+j);break;
             case 1: indw[j]=iCustom(NULL,0,"Center Of Gravity Oscillator",0,i+j);break;
             case 2: indw[j]=iCustom(NULL,0,"Relative Vigor Index",0,i+j);break;
             default:indw[j]=iRSI(NULL,0,12,PRICE_MEDIAN,i+j);break;
            } 
  	      }
  	      
  	      double max=indw[ArrayMaximum(indw)];
  	      double min=indw[ArrayMinimum(indw)];
  	      stoch[i]=(indw[0]-min)/(max-min);
  	      
  	      mstoch=(4*stoch[i]+3*stoch[i+1]+2*stoch[i+2]+stoch[i+3])/10;
  	      ind1[i]=0.5*(MathLog((1+0.98*(mstoch-0.5))/(1-0.98*(mstoch-0.5))));
         
         ind2[i]=ind1[i+1];	          
    //     ind3[i]=(4*ind1[i]+3*ind1[i+1]+2*ind1[i+2]+ind1[i+3])/10;
       }//2
      
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments