Author: Copyright � 2006, Nick A. Zhilin
FP

This custom indicator for MetaTrader is designed to provide traders with a visual representation of market structure by identifying key price levels based on historical volatility and recent closing averages. Rather than relying on a single data point, it uses a multi-layered mathematical approach to generate three distinct lines on your chart.

Core Logic Overview

The tool functions by analyzing a specific window of recent price history (determined by the user-defined period). It looks at three primary components:

  1. The Highest High reached during that timeframe.
  2. The Lowest Low reached during that timeframe.
  3. The Average Closing Price over the three most recent candles.

By combining these three elements, the script calculates a "central" anchor point and then derives two supporting levels around it.

Data Outputs Explained

The indicator populates your chart with three specific visual lines:

  • Pivot (Yellow Line): This represents the primary equilibrium of the market for the chosen period. It is calculated by taking the average of the highest high, the lowest low, and the recent closing price average. It serves as the "heart" of the current price action.
  • Upper Level (Red Line): This represents a projected upper boundary. It calculates a specific ratio between the primary Pivot and the market's recent lows. In practical terms, it helps identify where the market might face resistance or overextension based on its current momentum.
  • Lower Level (Aqua Line): This represents a projected lower boundary. It focuses on the relationship between the primary Pivot and the market's recent highs. It helps traders visualize potential support zones or "floor" levels where price might stabilize.

Summary for Traders

Essentially, this script takes the extreme boundaries of your chosen timeframe (the ceiling and the floor) and blends them with the most recent actual closing prices. This creates a balanced view of where the market is currently "balanced." By watching how the price interacts with these three lines—the Pivot and its two supporting levels—traders can better visualize whether the market is leaning toward a trend or searching for a consolidation point.

Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
FP
//+------------------------------------------------------------------+
//|                                                           FP.mq4 |
//|                                 Copyright © 2006, Nick A. Zhilin |
//|                                              rebus@dialup.etr.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Nick A. Zhilin"
#property link      "rebus@dialup.etr.ru"
//----
extern int IPeriod=100;
//----
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_color3 Aqua
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("Float Pivot");
//---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexLabel(0, "Pivot");
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexLabel(1, "HL1");
   SetIndexStyle(2, DRAW_LINE);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexLabel(2, "HL2");
//----
   Comment("FloatPivot(" + IPeriod + ")");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Float Pivot                                                      |
//+------------------------------------------------------------------+
int start()
  {
   int i, counted_bars=IndicatorCounted();
//----
   i=Bars - counted_bars - 1;
   while(i>=0)
     {
      double max=High[Highest(NULL, 0, MODE_HIGH, IPeriod, i)];
      double min=Low[Lowest(NULL, 0, MODE_LOW, IPeriod, i)];
      double pivot=(Close[i+1] + Close[i+2] + Close[i+3])/3;
      // Pivot
      ExtMapBuffer1[i]=(max + min + pivot)/3;
      // (R1 - Pivot) / 2
      ExtMapBuffer2[i]=((2*(max + min + pivot)/3 - min) +
                          (max+min+pivot)/3)/2;
      // (Pivot - S1) / 2
      ExtMapBuffer3[i]=((max + min + pivot)/3 +
                          (2*(max + min + pivot)/3 - max))/2;
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments