FX Fish_v2
Download scriptThis script is a technical analysis tool designed to help traders visualize market momentum and identify specific entry or exit points based on price fluctuations. Instead of looking at raw prices alone, it transforms price action into a visual "oscillator" that sits in a separate window below your main trading chart.
How the Logic Works
1. Data Collection and Customization The tool starts by analyzing specific price data from the market. It can be configured to look at various types of price points, such as the opening price, closing price, highs, lows, or a calculated average of these values. By selecting different price sources, users can tailor the sensitivity of the indicator to their preferred trading style.
2. Trend Momentum Calculation The core logic identifies the "High" and "Low" peaks over a set period of time. It then calculates where the current price sits relative to those peaks. This information is processed through a series of mathematical filters to smooth out "noise"—those small, insignificant price flickers that can often mislead a trader. The result is a smooth momentum value represented by two distinct colors:
- Lime (Green): Indicates positive upward momentum.
- Red: Indicates negative downward momentum.
3. Signal Identification The script monitors how quickly the momentum is shifting. It isn't just looking for "up" or "down"; it is looking for significant shifts in velocity.
- Buy Signals: When the momentum value exceeds a specific positive threshold and shows a sharp increase compared to previous movements, the script marks a potential "BUY" opportunity.
- Sell Signals: Conversely, when the momentum drops below a negative threshold and shows a sharp decrease relative to recent history, it marks a potential "SELL" opportunity.
4. Visual Indicators and Exits To make the data actionable for the user, the script does more than just draw bars; it can also place text labels directly on your price chart.
- Trade Alerts: If enabled, it will automatically place "BUY" or "SELL" labels at specific prices where the momentum shift is strongest.
- Exit Points: The logic also tracks "momentum crossovers." When the momentum flips from positive to negative (or vice versa), the script can identify an "EXIT" point, suggesting that the current trend has lost its strength and it may be time to close a position.
Summary for the User
In simple terms, this tool acts as a momentum speedometer. It filters out market noise to show you the true direction of the trend. When the speed (momentum) hits a certain intensity, it highlights potential entries; when that speed begins to reverse or stall, it suggests potential exit points to help manage risk and capture profits.
//+------------------------------------------------------------------+
//| |
//| Copyright © 2000-2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Kiko Segui"
#property link "webtecnic@terra.es"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_level1 0
#property indicator_level2 0.30
#property indicator_level3 -0.30
//----
double buffer1[];
double buffer2[];
//----
extern int period=10;
extern int price=0;
extern bool Mode_Fast= False;
extern bool Signals= False;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2,Lime);
SetIndexBuffer(0,buffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2,Red);
SetIndexBuffer(1,buffer2);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
int i;
double tmp;
//----
for(i=0;i<Bars;i++)
{
ObjectDelete("SELL SIGNAL: "+DoubleToStr(i,0));
ObjectDelete("BUY SIGNAL: "+DoubleToStr(i,0));
ObjectDelete("EXIT: "+DoubleToStr(i,0));
}
return(0);
}
double Value=0,Value1=0,Value2=0,Fish=0,Fish1=0,Fish2=0;
//----
int buy=0,sell=0;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i;
int barras;
double _price;
double tmp;
double MinL=0;
double MaxH=0;
double Threshold=1.2;
//----
barras=Bars;
if (Mode_Fast)
barras=100;
i=0;
while(i<barras)
{
MaxH=High[Highest(NULL,0,MODE_HIGH,period,i)];
MinL=Low[Lowest(NULL,0,MODE_LOW,period,i)];
//----
switch(price)
{
case 1: _price=Open[i]; break;
case 2: _price=Close[i]; break;
case 3: _price=High[i]; break;
case 4: _price=Low[i]; break;
case 5: _price=(High[i]+Low[i]+Close[i])/3; break;
case 6: _price=(Open[i]+High[i]+Low[i]+Close[i])/4; break;
case 7: _price=(Open[i]+Close[i])/2; break;
default: _price=(High[i]+Low[i])/2; break;
}
Value=0.33*2*((_price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;
Value=MathMin(MathMax(Value,-0.999),0.999);
Fish=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;
//----
buffer1[i]= 0;
buffer2[i]= 0;
//----
if((Fish<0) && (Fish1>0))
{
if (Signals)
{
ObjectCreate("EXIT: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("EXIT: "+DoubleToStr(i,0),"EXIT AT "+DoubleToStr(_price,4),7,"Arial",White);
}
buy=0;
}
if ((Fish>0) && (Fish1<0))
{
if (Signals)
{
ObjectCreate("EXIT: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("EXIT: "+DoubleToStr(i,0),"EXIT AT "+DoubleToStr(_price,4),7,"Arial",White);
}
sell=0;
}
if (Fish>=0)
{
buffer1[i]=Fish;
}
else
{
buffer2[i]=Fish;
}
tmp=i;
if ((Fish<-Threshold) &&
(Fish>Fish1) &&
(Fish1<=Fish2))
{
if (Signals)
{
ObjectCreate("SELL SIGNAL: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("SELL SIGNAL: "+DoubleToStr(i,0),"SELL AT "+DoubleToStr(_price,4),7,"Arial",Red);
}
sell=1;
}
if ((Fish>Threshold) &&
(Fish<Fish1) &&
(Fish1>=Fish2))
{
if (Signals)
{
ObjectCreate("BUY SIGNAL: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("BUY SIGNAL: "+DoubleToStr(i,0),"BUY AT "+DoubleToStr(_price,4),7,"Arial",Lime);
}
buy=1;
}
Value1=Value;
Fish2=Fish1;
Fish1=Fish;
i++;
}
return(0);
}
//+------------------------------------------------------------------+
Comments