1_Fish
Download scriptThis tool is designed as a visual market indicator that helps traders identify momentum and potential trend reversals by analyzing price action over a specific timeframe. Rather than looking at simple price movements, it processes the data to smooth out "noise" and highlight the underlying strength of the market.
How the Logic Works
1. Data Collection and Range Analysis The script first looks at a predefined window of time (the period). Within this window, it identifies the highest high and the lowest low reached by the price. By comparing where the current price sits relative to these extremes, the tool determines if the market is leaning toward a "peak" or a "valley."
2. Momentum Calculation The script calculates a value based on that relative position. It uses a weighted approach, combining the current momentum with the momentum from the previous calculation. This prevents the indicator from reacting too wildly to single, erratic price ticks, ensuring that the resulting movement is fluid and representative of a sustained trend.
3. Normalization and Logarithmic Smoothing To make the data readable and consistent, the script "normalizes" the values (keeping them within a specific boundary). It then applies a logarithmic calculation to convert these fluctuations into a distinct oscillator. This translates raw price movement into a clear visual representation of intensity.
4. Trend Visualization (The Colors) The final part of the logic determines how the information is displayed on your screen:
- Trend Detection: The script compares the current value of the indicator to its previous value to determine if the momentum is rising or falling.
- Visual Mapping:
- When the momentum is trending in a specific direction (positive), it highlights the data in Lime.
- When the momentum shifts or turns downward (negative), it switches the display to Red.
Summary for the User
In plain terms, this script acts as a "momentum filter." It takes messy market price data, smooths it out to see the true direction of the move, and then paints a visual history on your chart. When you see a change in color, it is signaling that the underlying momentum has shifted, helping you stay aligned with the current trend of the market.
//+------------------------------------------------------------------+
//| |
//| Copyright © 2000-2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Yura Prokofiev"
#property link "Yura.prokofiev@gmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Black
#property indicator_color2 Lime
#property indicator_color3 Red
//----
extern int period=10;
//----
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
IndicatorDigits(Digits+1);
//
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
//
IndicatorShortName("Fisher_Yur4ik");
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
//int period=10;
int limit;
int counted_bars=IndicatorCounted();
double prev,current,old;
double Value=0,Value1=0,Value2=0,Fish=0,Fish1=0,Fish2=0;
double price;
double MinL=0;
double MaxH=0;
//----
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i=0; i<limit; i++)
{ MaxH=High[Highest(NULL,0,MODE_HIGH,period,i)];
MinL=Low[Lowest(NULL,0,MODE_LOW,period,i)];
price=(High[i]+Low[i])/2;
Value=0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;
Value=MathMin(MathMax(Value,-0.999),0.999);
ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;
Value1=Value;
Fish1=ExtBuffer0[i];
}
bool up=true;
for(i=limit-2; i>=0; i--)
{
current=ExtBuffer0[i];
prev=ExtBuffer0[i+1];
//----
if (((current<0)&&(prev>0))||(current<0)) up= false;
if (((current>0)&&(prev<0))||(current>0)) up= true;
if(!up)
{
ExtBuffer2[i]=current;
ExtBuffer1[i]=0.0;
}
else
{
ExtBuffer1[i]=current;
ExtBuffer2[i]=0.0;
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments