Fib Pivots(b)

Download script
Author: Limstylz
Fib Pivots(b)

This tool is designed to provide traders with automated visual support and resistance levels on their trading charts. By utilizing a specific mathematical progression, the script identifies key price zones where the market might encounter significant buying or selling pressure based on the daily opening price.

Core Logic Overview

The script operates by monitoring the market price in real-time to identify a specific "Start Hour" (which can be customized by the user). Once this specific time is reached, the script captures the market's opening price for that day. This starting price serves as the foundation for all subsequent calculations.

How the Levels are Calculated

From that daily opening price, the script projects eight distinct horizontal lines across the chart. These levels are categorized into two types:

  • Resistance Levels (Red): These are calculated by adding specific mathematical increments to the daily open price. They represent potential "ceilings" where upward momentum might stall or face selling pressure.
  • Support Levels (Lime): These are calculated by subtracting specific mathematical increments from the daily open price. They represent potential "floors" where downward momentum might find buyers.

The script uses a unique set of multipliers—derived from a Fibonacci-style sequence—to ensure that the gaps between the levels are mathematically consistent, helping traders identify organic areas of interest rather than random numbers.

Key Features for Traders

  • Automatic Detection: You do not need to manually calculate these values. The script automatically detects the correct time and performs the math instantly as soon as the new trading day begins.
  • Dynamic Labeling: When enabled, the script places text labels directly on the chart. These labels display the exact price for each level (e.g., "R7" or "S5"), allowing for quick identification without having to hover your mouse over the lines.
  • Visual Clarity: The levels are color-coded (Red for Resistance, Lime for Support) and use a distinct dashed line style to remain visible on the chart without cluttering the price action.
  • Broker Compatibility: The logic is designed to automatically adjust for different broker decimal formats (2, 3, 4, or 5 digits), ensuring that the levels are placed accurately regardless of which trading platform or currency pair you are viewing.

In summary, this tool automates the process of identifying structural price zones, providing a clear "roadmap" of potential support and resistance based on the daily opening price.

Miscellaneous
Implements a curve of type %1
17 Views
0 Downloads
0 Favorites
Fib Pivots(b)
//+------------------------------------------------------------------+
//|                                              FIB PIVOT GMT OFFSET|
//|                                                         Limstylz |
//+------------------------------------------------------------------+
#property copyright "Limstylz"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Lime
#property indicator_color6 Lime
#property indicator_color7 Lime
#property indicator_color8 Lime
#property indicator_style1 4
#property indicator_style2 4
#property indicator_style3 4
#property indicator_style4 4
#property indicator_style5 4
#property indicator_style6 4
#property indicator_style7 4
#property indicator_style8 4

//---- input parameters
extern int StartHour=6;
extern color ResColour=Red;
extern color SupColour=Lime;
extern int LineWidth=1;
extern int SRLineStyle=4;
extern bool ShowLabel=true;
extern int FontSize=10;
extern color FontColour=DarkGray;

//---- buffers

double ResLevel7[];
double ResLevel6[];
double ResLevel5[];
double ResLevel4[];
double SupLevel5[];
double SupLevel6[];
double SupLevel7[];
double SupLevel8[];

//---- variables
int limit, cur_day, barChangeDay;
double DailyOpen,RL4,RL5,RL6,RL7,SL5,SL6,SL7,SL8,point;
datetime LabelShiftTime;
int LabelShift =0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
   SetIndexBuffer(0,ResLevel7);
   SetIndexStyle(1,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
   SetIndexBuffer(1,ResLevel6);
   SetIndexStyle(2,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
   SetIndexBuffer(2,ResLevel5);
   SetIndexStyle(3,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
   SetIndexBuffer(3,ResLevel4);
   SetIndexStyle(4,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
   SetIndexBuffer(4,SupLevel5);
   SetIndexStyle(5,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
   SetIndexBuffer(5,SupLevel6);
   SetIndexStyle(6,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
   SetIndexBuffer(6,SupLevel7);
   SetIndexStyle(7,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
   SetIndexBuffer(7,SupLevel8);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
ObjectsDeleteAll(0,OBJ_TEXT);

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

int counted_bars=IndicatorCounted();
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
  
limit=Bars-counted_bars;
//---- 
   for(int i=limit; i>=0; i--)
      {
        
        cur_day = TimeDay(Time[i]);
        
        if  (
            TimeHour(Time[i]) == StartHour &&
            TimeMinute(Time[i]) == 0
            )
            {
            barChangeDay = i;
            DailyOpen = Open[i];
            
            if (Digits == 5) point= Point*10;
            if (Digits == 4) point= Point;
            if (Digits == 3) point= Point*10;
            if (Digits == 2) point= Point;
           
            RL4 = DailyOpen+(144*point);
            RL5 = DailyOpen+(233*point);
            RL6 = DailyOpen+(377*point);
            RL7 = DailyOpen+(610*point);
            SL5 = DailyOpen-(233*point);
            SL6 = DailyOpen-(377*point);
            SL7 = DailyOpen-(610*point);
            SL8 = DailyOpen-(987*point);
            }
            
           ResLevel6[i]=RL6; 
           ResLevel5[i]=RL5; 
           ResLevel4[i]=RL4; 
           ResLevel7[i]=RL7; 
           SupLevel5[i]=SL5; 
           SupLevel6[i]=SL6;
           SupLevel7[i]=SL7; 
           SupLevel8[i]=SL8;

      if (ShowLabel){
      LabelShiftTime = Time[LabelShift]+1200;
      ObjectCreate("Daily R7", OBJ_TEXT, 0, LabelShiftTime, 0);
      ObjectSetText("Daily R7", "                                 R7 " +DoubleToStr(RL7,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(0, "Daily R7");
      ObjectCreate("Daily R6", OBJ_TEXT, 0, LabelShiftTime, 0);
      ObjectSetText("Daily R6", "                                 R6 " +DoubleToStr(RL6,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(1, "Daily R6");
      ObjectCreate("Daily R5", OBJ_TEXT, 0, LabelShiftTime, 0);
      ObjectSetText("Daily R5", "                                 R5 " +DoubleToStr(RL5,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(2, "Daily R5");
      ObjectCreate("Daily R4", OBJ_TEXT, 0, LabelShiftTime, 0);   
      ObjectSetText("Daily R4", "                                 R4 " +DoubleToStr(RL4,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(3, "Daily R4");
      ObjectCreate("Daily S5", OBJ_TEXT, 0, LabelShiftTime, 0);
      ObjectSetText("Daily S5", "                                 S5 " +DoubleToStr(SL5,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(4, "Daily S5");
      ObjectCreate("Daily S6", OBJ_TEXT, 0, LabelShiftTime, 0);
      ObjectSetText("Daily S6", "                                 S6 " +DoubleToStr(SL6,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(5, "Daily S6");
      ObjectCreate("Daily S7", OBJ_TEXT, 0, LabelShiftTime, 0);
      ObjectSetText("Daily S7", "                                 S7 " +DoubleToStr(SL7,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(6, "Daily S7");
      ObjectCreate("Daily S8", OBJ_TEXT, 0, LabelShiftTime, 0);
      ObjectSetText("Daily S8", "                                 S8 " +DoubleToStr(SL8,Digits),FontSize,"arial ",FontColour);
      SetIndexLabel(7, "Daily S8");
      ObjectMove("Daily R7", 0, LabelShiftTime,RL7);
      ObjectMove("Daily R6", 0, LabelShiftTime,RL6);
      ObjectMove("Daily R5", 0, LabelShiftTime,RL5);
      ObjectMove("Daily R4", 0, LabelShiftTime,RL4);      
      ObjectMove("Daily S6", 0, LabelShiftTime,SL6);
      ObjectMove("Daily S5", 0, LabelShiftTime,SL5);
      ObjectMove("Daily S8", 0, LabelShiftTime,SL8);
      ObjectMove("Daily S7", 0, LabelShiftTime,SL7);
      
      }
           
}
           
   return(0);
  }
//+------------------------------------------------------------------+

Comments