Pivot_only_H1
Download scriptThis tool is designed to provide traders with a visual map of historical price levels, specifically focusing on "Pivot Points" on a 1-hour timeframe. By plotting these key values directly on your chart, it helps identify significant areas of support and resistance where the market has historically shown interest.
Core Functionality
The script automatically scans back through a massive amount of historical data (up to 1,000 days) to calculate specific price points for every hour. It takes the price movement from previous hours and condenses it into a single "Pivot" value.
To determine these values, the logic looks at three key pieces of information from each preceding hour:
- The highest price reached (High)
- The lowest price reached (Low)
- The final price at the end of that hour (Close)
By averaging these three components, the script generates a mathematical "Pivot" level. This represents a balanced price point for that specific hour, providing a clearer picture of where the market's "center of gravity" was situated.
Visual Representation
Once the calculations are complete, the tool draws horizontal lines across your trading chart.
- Visual Style: The lines are rendered in yellow with a distinct thickness to ensure they remain visible against the background price action.
- Non-Intrusive Display: The lines are set to appear in the background of the chart, allowing you to see the current price movement clearly without the indicators cluttering your view.
- Automatic Cleanup: The script is designed to be efficient; every time the chart refreshes or updates, it clears out old drawings and redraws the levels to ensure that the data remains accurate and aligned with the most recent market movements.
Practical Application
For a trader, this tool serves as a historical "blueprint." Instead of guessing where the market might turn, you can see exactly where previous hours established their price floors and ceilings. It allows you to identify recurring zones where prices have reacted in the past, helping you make more informed decisions on where to enter or exit trades based on historical behavior.
//+------------------------------------------------------------------+
//| Pivot_only_H1.mq4 |
//| upgrade by Darkkiller |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| AllPivots_v1.mq4 |
//| Copyright © 2006, Forex-TSD.com |
//| Written by IgorAD,igorad2003@yahoo.co.uk |
//| http://finance.groups.yahoo.com/group/TrendLaboratory |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Forex-TSD.com "
#property link "http://www.forex-tsd.com/"
#property indicator_chart_window
extern int CountDays=1000;
datetime time1;
datetime time2;
double open,close,high,low;
double P;
int shift, num;
void ObjDel()
{
for (;num<=CountDays;num++)
{
ObjectDelete("Pivot H1["+num+"]");
}
}
void PlotLine(string name,double value,double line_color,double style)
{
ObjectCreate(name,OBJ_TREND,0,time1,value,time2,value);
ObjectSet(name, OBJPROP_WIDTH, 2);
ObjectSet(name, OBJPROP_STYLE, style);
ObjectSet(name, OBJPROP_RAY, false);
ObjectSet(name, OBJPROP_BACK, true);
ObjectSet(name, OBJPROP_COLOR, line_color);
}
int init()
{
return(0);
}
int deinit()
{
ObjDel();
Comment("");
return(0);
}
int start()
{
int i;
ObjDel();
num=0;
for (shift=CountDays-1;shift>=0;shift--)
{
time1=iTime(NULL,PERIOD_H1,shift);
i=shift-1;
if (i<0)
time2=Time[0];
else
time2=iTime(NULL,PERIOD_H1,i)-Period()*60;
high = iHigh(NULL,PERIOD_H1,shift+1);
low = iLow(NULL,PERIOD_H1,shift+1);
close = iClose(NULL,PERIOD_H1,shift+1);
P = (high+low+close)/3.0;
time2=time1+PERIOD_H1*60;
num=shift;
PlotLine("Pivot H1["+num+"]",P,Yellow,0);
}
return(0);
}
//+------------------------------------------------------------------+
Comments