This tool is designed to provide visual clarity on your trading charts by automatically identifying and drawing key price boundaries based on historical daily data. Instead of requiring you to manually trace out previous price levels, the script handles the mathematical heavy lifting to highlight significant "highs" and "lows" from past sessions.
Core Functionality
The logic focuses on analyzing a specific number of previous days (customizable by the user) to establish visual zones on your current chart. It operates under the requirement that the chart be set to a 1-hour timeframe, ensuring that the calculations are consistent and accurate across different assets.
How the Logic Works:
- Data Retrieval: The script looks back at previous daily candles to identify their opening and closing prices.
- Peak & Trough Detection: For each day in the selected history, the tool scans the price action to find the exact highest point (maximum) and the lowest point (minimum) reached during that period.
- Visual Mapping: Once these key points are identified, the script draws four distinct trend lines for every day analyzed:
- Upper Boundaries: It connects the opening price to the daily high, and then from the high to the closing price. These are rendered in Blue and Red, helping you visualize the upper range of previous price action.
- Lower Boundaries: It connects the opening price to the daily low, and then from the low to the closing price. These are rendered in Lawn Green and Blue, highlighting the floor of previous trading activity.
Key Features for the User:
- Automatic Cleanup: The script is designed to manage your chart cleanly; whenever it refreshes or is deactivated, it automatically removes its previous drawings to keep your workspace uncluttered.
- Customizable Visibility: You can adjust the thickness of the lines through the settings, allowing you to make the boundaries more prominent or subtle depending on your personal viewing preference.
- Timeframe Synchronization: To ensure the integrity of the geometric shapes, the script includes a built-in check that alerts you if you are not on the 1-hour timeframe, ensuring that the "High" and "Low" points align correctly with the daily data.
By using this tool, you can quickly see where the market has struggled to break through or fall below in previous days, providing a visual "map" of historical price behavior directly on your active trading screen.
//+------------------------------------------------------------------+
//| VR---FIGURA |
//| |
//| http://www.trading-go.ru |
//+------------------------------------------------------------------+
#property copyright " Trading-go "
#property link " www.trading-go.ru "
#property indicator_chart_window
extern int Days = 20 ;
extern int WIDTH = 3 ;
int deinit ()
{ for(int x=1;x<=Days;x++)
{
ObjectDelete("opma"+x);
ObjectDelete("opmu"+x);
ObjectDelete("opmq"+x);
ObjectDelete("opms"+x);
}
}
int start()
{
int timup=0;
int timdw=0;
if (Period()!=60)
{
Comment("SET THE TIME PERIOD 1H ");
for(int P=1;P<=Days;P++)
{
ObjectDelete("opma"+P);
ObjectDelete("opmu"+P);
ObjectDelete("opmq"+P);
ObjectDelete("opms"+P);
}
return(0);}
for(int x=1;x<=Days;x++)
{
double opp = NormalizeDouble(iOpen (Symbol(),1440,x-1),Digits);
double cl = NormalizeDouble(iOpen (Symbol(),1440,x ),Digits);
int timcl = iTime(Symbol(),1440,x);
int timop = timcl+86400;
double max=0;
double min=0;
int t =24*x;
for(int i=t-24+Hour();i<=t+Hour();i++)
{
if (High[i]>max)
{
max =High[i];
timup=Time[i];
}
if (min==0||Low[i]<min)
{
min=Low[i];
timdw=Time[i];
}
}
if (Period()==60){
ObjectCreate("opma"+x,OBJ_TREND,0,timop,opp,timup,max);
ObjectSet ("opma"+x,OBJPROP_RAY,false);
ObjectSet ("opma"+x,OBJPROP_COLOR,Blue);
ObjectSet ("opma"+x,OBJPROP_WIDTH,WIDTH);
ObjectCreate("opmu"+x,OBJ_TREND,0,timup,max,timcl,cl);
ObjectSet ("opmu"+x,OBJPROP_RAY,false);
ObjectSet ("opmu"+x,OBJPROP_COLOR,Red);
ObjectSet ("opmu"+x,OBJPROP_WIDTH,WIDTH);
ObjectCreate("opmq"+x,OBJ_TREND,0,timop,opp,timdw,min);
ObjectSet ("opmq"+x,OBJPROP_RAY,false);
ObjectSet ("opmq"+x,OBJPROP_COLOR,LawnGreen);
ObjectSet ("opmq"+x,OBJPROP_WIDTH,WIDTH);
ObjectCreate("opms"+x,OBJ_TREND,0,timdw,min,timcl,cl);
ObjectSet ("opms"+x,OBJPROP_RAY,false);
ObjectSet ("opms"+x,OBJPROP_COLOR,Blue);
ObjectSet ("opms"+x,OBJPROP_WIDTH,WIDTH);
}
}
}
Comments