LC_FibonacciDaily

Download script
Author: Copyright � 2005, Live Charts
LC_FibonacciDaily

This tool is designed to automatically identify and plot key price levels on your trading chart based on daily market activity. It simplifies technical analysis by calculating specific structural benchmarks that help traders visualize potential areas of support and resistance.

Core Logic and Functionality

The script operates by analyzing the price action of the previous trading day. Specifically, it looks at three primary pieces of data from the prior 24-hour cycle:

  • The High: The highest price reached during the day.
  • The Low: The lowest price reached during the day.
  • The Close: The final price at which the market ended for that day.

Key Calculations

Once the script gathers this data, it performs a series of mathematical operations to generate seven distinct horizontal levels on your current chart:

1. The Pivot Point (PP) The script first calculates a central "balance" point for the previous day by taking the average of the High, Low, and Close prices. This acts as the anchor for all other levels.

2. Fibonacci-Based Support and Resistance Using the range of the previous day (the distance between the High and the Low), the script applies three specific ratios: 0.382, 0.618, and 1.000.

  • Support Levels (S1, S2, S3): These are calculated by subtracting these ratios from the Pivot Point. They represent areas where buying interest might increase to prevent the price from falling further.
  • Resistance Levels (R1, R2, R3): These are calculated by adding these ratios to the Pivot Point. They represent "ceilings" where selling pressure may increase, potentially preventing the price from rising further.

Visual Representation

The script automatically draws these seven lines across your chart. It identifies them clearly with labels (S1 through S3 for Support and R1 through R3 for Resistance) so you can easily see how the current market price relates to yesterday's historical boundaries.

By using daily data to project these levels onto your current trading window, the tool helps you anticipate where the market might struggle to break through (Resistance) or find a floor (Support) based on established daily volatility.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
LC_FibonacciDaily
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/


#property copyright "Copyright © 2005, Live Charts"
#property link      "http://www.livecharts.co.uk"

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 OrangeRed
#property indicator_color3 Yellow
#property indicator_color4 Aqua
#property indicator_color5 Yellow
#property indicator_color6 OrangeRed
#property indicator_color7 Red



extern bool S1_R1 = true;
extern bool S2_R2 = true;
extern bool S3_R3 = true;



bool sr[3];

int lastShift = -1;
double PP, S[4], R[4];

double PP_Buffer[];

double S1_Buffer[];
double S2_Buffer[];
double S3_Buffer[];

double R1_Buffer[];
double R2_Buffer[];
double R3_Buffer[];



int init()
{
   
   int i;

   IndicatorShortName("Fibonacci Daily");

   IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));


   sr[0] = S1_R1;
   sr[1] = S2_R2;
   sr[2] = S3_R3;
   
   for(i=0; i<3; i++)
   {
      int style;
      
      if(sr[i]==true) 
         style = DRAW_LINE;
      else   
         style = DRAW_NONE;
      
      SetIndexStyle(2-i, style);
      SetIndexStyle(i+4, style);
   }
   
            
   SetIndexBuffer(0, S3_Buffer);
   SetIndexBuffer(1, S2_Buffer);
   SetIndexBuffer(2, S1_Buffer);
   SetIndexBuffer(3, PP_Buffer);
   SetIndexBuffer(4, R1_Buffer);
   SetIndexBuffer(5, R2_Buffer);
   SetIndexBuffer(6, R3_Buffer);
   
      
   string indexLabels[] = {"S3", "S2", "S1", "Pivot", "R1", "R2", "R3"};
   
   for(i=0; i<7; i++)
   {
      SetIndexLabel(i, indexLabels[i]);
   }
   
}



int deinit()
{

}



int start()
{

   int counted_bars = IndicatorCounted();    
   int nBars = (Bars - counted_bars) - 1;
   
   
   for(int i=0; i<nBars; i++)
   {
      int shift = iBarShift(NULL, PERIOD_D1, Time[i]) + 1;

      
      if(shift!=lastShift)
      {
         lastShift = shift;
         
         double H = iHigh(NULL, PERIOD_D1, shift);
         double L = iLow(NULL, PERIOD_D1, shift);
         double C = iClose(NULL, PERIOD_D1, shift);
      
         GetFibonacciLevels(H, L, C, PP, S, R);      
      }
      
      
      PP_Buffer[i] = PP;

      S1_Buffer[i] = S[0];
      S2_Buffer[i] = S[1];
      S3_Buffer[i] = S[2];

      R1_Buffer[i] = R[0];
      R2_Buffer[i] = R[1];
      R3_Buffer[i] = R[2];   
   }
      
}



void GetFibonacciLevels(double H, double L, double C, double& PP, double& S[], double& R[])
{

   double k[3];
   
   k[0] = 0.382;
   k[1] = 0.618;
   k[2] = 1.000;
   
   double range = H - L;
   
   PP = (H + L + C)/3;
   
   for(int i=0; i<3; i++)
   {
      S[i] = PP - range*k[i];
      R[i] = PP + range*k[i];
   }

}

Comments