This script is a custom technical analysis tool designed for the MetaTrader platform. It functions as a visual aid to help traders identify trends and potential turning points in market price action by processing historical data into smooth, readable signals.
Core Logic and Operation
The tool operates by transforming standard market momentum data into a more nuanced set of visual lines. Here is how it processes information step-by-step:
1. Data Foundation (The Stochastic Input) At its core, the script looks at "Stochastic" data. In trading, this usually measures where the current price sits relative to its recent range. The script takes this raw momentum and normalizes it—essentially smoothing out the "noise" of minor price flickers to focus on the broader direction of the move.
2. The Smoothing Process (The Auxiliary Layer) Instead of jumping directly from the market data to a final signal, the script creates an intermediate "Auxiliary" value. It blends current market momentum with the previous period's data. This prevents the indicator from reacting too violently to sudden price spikes, ensuring that the resulting lines move in a more fluid, continuous motion.
3. The Mathematical Transformation (The "Fisher" Effect) The script then applies a logarithmic calculation to that smoothed data. By using a logarithmic approach, the tool effectively "expands" small movements and "compresses" large ones. This helps in visualizing the intensity of a trend; it highlights when momentum is accelerating or decelerating in a way that is often harder to see on a standard price chart.
4. Final Signal Generation The final output consists of three distinct lines:
- The Main Trend Line: This represents the primary calculation, showing the current smoothed momentum.
- The Signal Line: This acts as a "shadow" or a trailing version of the main line (representing the previous value). When the main line crosses this signal line, it suggests a potential shift in market direction.
- Visual Thresholds: The tool is calibrated with specific horizontal boundaries (levels). These act as visual markers to help traders identify extreme conditions where the market might be overextended.
User Experience
For a trader, this means the script provides a cleaner view of market "mood." Rather than looking at jagged price lines, you see smooth curves that highlight the underlying flow of the market, making it easier to identify when a trend is gaining strength or beginning to lose steam.
//+------------------------------------------------------------------+
//| RAVI FX Fisher.mq4 |
//| Copyright © 2005, Luis Guilherme Damiani |
//| http://www.damianifx.com.br |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Luis Guilherme Damiani"
#property link "http://www.damianifx.com.br"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Yellow
//---- input parameters
extern int lenth=10;
extern int maxbars=2000;
//---- buffers
double FishBuffer[];
double SignalBuffer[];
double AuxBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,FishBuffer);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,SignalBuffer);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,AuxBuffer);
SetLevelValue(0,0.8);
SetLevelValue(1,-0.8);
ArrayInitialize(FishBuffer,0);
ArrayInitialize(SignalBuffer,0);
ArrayInitialize(AuxBuffer,0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
Comment(Bars," ", counted_bars);
//double Normalized=0;
//double Fish=0;
//---- check for possible errors
if(counted_bars<0) return(-1);
int limit=Bars-counted_bars;
if(limit>maxbars)limit=maxbars;
if (limit>Bars-lenth-1)limit=Bars-lenth-1;
//----
for (int shift = limit; shift>=0;shift--)
{
AuxBuffer[shift]=0.5*(iStochastic(NULL,0,lenth,2,1,MODE_SMA,0,MODE_MAIN,shift)/100-0.5)*2+0.5*AuxBuffer[shift+1];
FishBuffer[shift]= 0.25* MathLog((1+AuxBuffer[shift])/(1-AuxBuffer[shift]))+0.5*FishBuffer[shift+1];
SignalBuffer[shift]=FishBuffer[shift+1];
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments