Floor_Pivots_Daily

Download script
Floor_Pivots_Daily

This tool is designed to provide traders with key visual price levels known as "Floor Pivots." These levels act as psychological and technical milestones, helping market participants identify potential areas of support (where the price might stop falling) and resistance (where the price might stop rising).

Core Functionality

The script automatically calculates and plots seven specific horizontal price levels on your trading chart. These are derived from the price action of a preceding period, allowing you to see where the market is likely to react during the current session.

How the Logic Works

  1. Timeframe Monitoring: The tool is optimized for intraday analysis. It is designed to function on any timeframe smaller than 4 hours (H4). If a higher timeframe is used, the script will remain inactive to ensure data accuracy.
  2. Period Identification: You can define specific start and end times for the calculation period. The script looks at the price movement between these two points to establish the "range" for the following session.
  3. Price Data Collection: Once the designated period concludes, the script identifies three critical pieces of data:
    • The highest price reached (High)
    • The lowest price reached (Low)
    • The final closing price (Close)
  4. Mathematical Calculation: Using these three values, the script calculates the "Pivot Point" (the average center of the range) and then projects four levels above it (Resistance) and three levels below it (Support).
    • Pivot Point (P): The central balance point.
    • R1, R2, R3: Increasing levels of overhead resistance.
    • S1, S2, S3: Increasing levels of underlying support.

Visual Presentation

Instead of just providing raw numbers, the script places clear visual markers (arrows) directly on your chart at these calculated price points.

  • The markers update automatically as new data is processed.
  • Each level is assigned a specific color to help you quickly distinguish between different zones of support and resistance at a glance.

Practical Application

By using this script, you can visualize the "floor" and "ceiling" of the current market session. Traders often use these levels to:

  • Identify potential entry or exit points for trades.
  • Gauge market sentiment (e.g., if the price is struggling to break R1).
  • Set automated stop-loss or take-profit targets based on established technical milestones.
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
Floor_Pivots_Daily
//+------------------------------------------------------------------+
//|                                           Floor_Pivots_Daily.mq4 |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property link      "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 C'000,200,000'
#property indicator_color2 C'000,200,000'
#property indicator_color3 C'000,200,000'
#property indicator_color4 C'200,200,200'
#property indicator_color5 C'200,000,000'
#property indicator_color6 C'200,000,000'
#property indicator_color7 C'200,000,000'

extern string PivotStart = "22:00";
extern string PivotEnd   = "22:00";

double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double Buffer5[];
double Buffer6[];
double Buffer7[];

double LastHigh,LastLow,LastClose;
double PivR3,PivR2,PivR1, PivotPoint, PivS1,PivS2,PivS3;

int OpenBar;
    
int init()
{  SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,160);
   SetIndexBuffer(0,Buffer1);
   SetIndexLabel(0,"Pivot R3");

   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,160);
   SetIndexBuffer(1,Buffer2);
   SetIndexLabel(1,"Pivot R2");

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,160);
   SetIndexBuffer(2,Buffer3);
   SetIndexLabel(2,"Pivot R1");
   
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,167);
   SetIndexBuffer(3,Buffer4);
   SetIndexLabel(3,"Pivot Point");
   
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,160);
   SetIndexBuffer(4,Buffer5);
   SetIndexLabel(4,"Pivot S1");
   
   SetIndexStyle(5,DRAW_ARROW);
   SetIndexArrow(5,160);
   SetIndexBuffer(5,Buffer6);
   SetIndexLabel(5,"Pivot S2");
   
   SetIndexStyle(6,DRAW_ARROW);
   SetIndexArrow(6,160);
   SetIndexBuffer(6,Buffer7);
   SetIndexLabel(6,"Pivot S3");
   
   return(0); }

int deinit()
   {
	ObjectDelete("R3L");
	ObjectDelete("R2L");
	ObjectDelete("R1L");
	ObjectDelete("PPL");
	ObjectDelete("S1L");
	ObjectDelete("S2L");
	ObjectDelete("S3L");
	Comment("");
	return(0);
   }

int start()
{  if (Period() > 240) return(0);		//Chart cannot be higher than H4
   string BarTime="", LastBarTime="";         
   string BarDay="", LastBarDay="";
   int CloseBar;
          
   for(int i=Bars; i>=0; i--)
   {  BarTime = TimeToStr(Time[i], TIME_MINUTES);
      LastBarTime = TimeToStr(Time[i+1], TIME_MINUTES);
      BarDay = TimeToStr(Time[i],TIME_DATE);
      LastBarDay = TimeToStr(Time[i+1],TIME_DATE); 
      
      //need to handle if pivotrangestart/end is 00:00
      if ((PivotEnd == "00:00" && BarTime>=PivotEnd && BarDay>LastBarDay) || (BarTime>=PivotEnd && LastBarTime<PivotEnd))
      {  CloseBar = i + 1;
         
         if (OpenBar>0)
         {  calculatePivotRangeValues(OpenBar, CloseBar);  }  }
      
      if ((PivotStart == "00:00" && BarTime>=PivotStart && BarDay>LastBarDay) || (BarTime>=PivotStart && LastBarTime<PivotStart))
      { OpenBar = i; }
      
      if (OpenBar>0)
      { drawIndicators(i);  } }
   return(0);}
void calculatePivotRangeValues(int openBar, int closeBar)
{
   LastHigh = High[Highest(NULL, 0, MODE_HIGH, (openBar - closeBar + 1), closeBar)];
   LastLow = Low[Lowest(NULL, 0, MODE_LOW, (openBar - closeBar + 1), closeBar)];
   LastClose = Close[closeBar];
   PivotPoint = (LastHigh + LastLow + LastClose)/3;
   PivR3 = (2*PivotPoint)+(LastHigh-(2*LastLow));
   PivR2 = PivotPoint+(LastHigh - LastLow);
   PivR1 = (2*PivotPoint)-LastLow;
   PivS1 = (2*PivotPoint)-LastHigh;
   PivS2 = PivotPoint-(LastHigh - LastLow);
   PivS3 = (2*PivotPoint)-((2* LastHigh)-LastLow); 
}

void drawIndicators(int curBar)
{
   Buffer1[curBar]=PivR3;
   Buffer2[curBar]=PivR2;
   Buffer3[curBar]=PivR1;
   Buffer4[curBar]=PivotPoint;
   Buffer5[curBar]=PivS1;
   Buffer6[curBar]=PivS2;
   Buffer7[curBar]=PivS3;

   DoLabel("R3L", Buffer1[0], indicator_color1);
   DoLabel("R2L", Buffer2[0], indicator_color2);
   DoLabel("R1L", Buffer3[0], indicator_color3);
   DoLabel("PPL", Buffer4[0], indicator_color4);
   DoLabel("S1L", Buffer5[0], indicator_color5);
   DoLabel("S2L", Buffer6[0], indicator_color6);
   DoLabel("S3L", Buffer7[0], indicator_color7);
   return(0); }
	
void DoLabel( string dName, double dValue, color dColor )
   {
   if (ObjectFind(dName) != 0)
      {
      ObjectCreate(dName,OBJ_ARROW,0,Time[0],dValue);
      ObjectSet(dName,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
      ObjectSet(dName,OBJPROP_COLOR,dColor);  
      } 
   else
      {
      ObjectMove(dName,0,Time[0],dValue);
      }
   }
//+-----------------------------------------------------------------------------------------+
//|                                         THE END                                         |
//+-----------------------------------------------------------------------------------------+

Comments