The Fibo-Average indicator is designed to provide traders with a smoothed, customized view of price action by combining specific historical data points with technical moving averages. Instead of simply calculating an average of the most recent prices, this tool uses a unique selection logic to identify key trends on the trading chart.
How the Logic Works
The indicator operates through a two-step process to transform raw market data into a readable trend line:
1. Weighted Price Selection (The "Fibo" Component) Unlike standard indicators that look at every single candle equally, this script identifies 11 specific points in time relative to the current price. These points are selected based on a non-linear sequence (specifically looking back at intervals such as 1, 2, 3, 5, 8, 13, 21, 34, and 55). This logic is inspired by mathematical sequences that often appear in nature and market structures. By averaging these specific "milestone" prices together, the indicator filters out minor market noise and focuses on more significant structural movements.
2. Moving Average Smoothing (The "Average" Component) Once the indicator has calculated the average of those specific historical points, it applies a second layer of processing. It takes that resulting data and runs it through a customizable Moving Average (MA). This step smooths out any remaining sharp fluctuations, resulting in a cleaner line on your chart.
Key Features for the User
- Flexible Price Inputs: You can choose which price type the indicator should track—such as the standard Closing price, the High/Low extremes, or even weighted averages like the "Median" or "Typical" prices.
- Customizable Smoothing: Users can adjust the length and type of the Moving Average (e.g., Simple, Exponential, etc.) to determine how "reactive" or "smooth" the final line appears on the screen.
- Visual Clarity: The script produces two distinct lines on the chart: a primary trend line and a dotted secondary line, helping you visualize the relationship between the raw smoothed data and the processed average.
In summary, this tool is built for traders who want to see a "filtered" version of the market—one that ignores the small jitters of the moment and highlights the broader structural trend by focusing on mathematically significant price points.
/*------------------------------------------------------------------+
| Fibo-Average.mq4 |
| Copyright © 2011 |
| basisforex@gmail.com |
+------------------------------------------------------------------*/
#property copyright "Copyright © 2011"
#property link "basisforex@gmail.com"
//----------------------------------
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Yellow
//+------------------------------------------------------------------+
extern int nAppliedPrice = 0;// PRICE_CLOSE=0; PRICE_OPEN=1; PRICE_HIGH=2; PRICE_LOW=3; PRICE_MEDIAN=4; PRICE_TYPICAL=5; PRICE_WEIGHTED=6;
extern int maPeriod = 55;
extern int maMethod = 0;// MODE_SMA=0; MODE_EMA=1; MODE_SMMA=2; MODE_LWMA=3;
//----
double BBPBuffer[];
double TempBuffer[];
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, BBPBuffer);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(1, TempBuffer);
SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
return(0);
}
//+------------------------------------------------------------------+
int start()
{
int i, j, nCountedBars;
nCountedBars = IndicatorCounted();
i = Bars - nCountedBars;
//----
while(i >= 0)
{
BBPBuffer[i] = (AppliedPrice(nAppliedPrice, i + 0) + AppliedPrice(nAppliedPrice, i + 1) + AppliedPrice(nAppliedPrice, i + 1)
+ AppliedPrice(nAppliedPrice, i + 2) + AppliedPrice(nAppliedPrice, i + 3) + AppliedPrice(nAppliedPrice, i + 5)
+ AppliedPrice(nAppliedPrice, i + 8) + AppliedPrice(nAppliedPrice, i + 13) + AppliedPrice(nAppliedPrice, i + 21)
+ AppliedPrice(nAppliedPrice, i + 34) + AppliedPrice(nAppliedPrice, i + 55)) / 11;
i--;
}
i = Bars - nCountedBars;
while(i >= 0)
{
TempBuffer[i] = iMAOnArray(BBPBuffer, 0, maPeriod, 0, maMethod, i);
i--;
}
//----
}
//+------------------------------------------------------------------+
double AppliedPrice(int nAppliedPrice, int nIndex)
{
double aPrice;
switch(nAppliedPrice)
{
case 0: aPrice = Close[nIndex]; break;
case 1: aPrice = Open[nIndex]; break;
case 2: aPrice = High[nIndex]; break;
case 3: aPrice = Low[nIndex]; break;
case 4: aPrice = (High[nIndex]+Low[nIndex]) / 2.0; break;
case 5: aPrice = (High[nIndex]+Low[nIndex] + Close[nIndex]) / 3.0; break;
case 6: aPrice = (High[nIndex]+Low[nIndex] + 2 * Close[nIndex]) / 4.0; break;
default: aPrice = 0.0;
}
return(aPrice);
}
//+------------------------------------------------------------------+
Comments