Hi_Low_Indicator_v1

Author: Copyright � 2006, Cartwright Software Corp.
Hi_Low_Indicator_v1

This tool is designed to provide traders with clear visual benchmarks on their trading charts by identifying key price levels from previous market activity. Specifically, it automatically locates and displays the highest and lowest price points reached during a specific look-back period.

How the Logic Works

Data Identification The script scans historical price data based on a user-defined timeframe (the "BarsBack" setting). Instead of looking at a simple single candle, it looks back at a specific number of hourly candles to determine the extreme boundaries of the market's movement.

Visual Representation Once the script identifies these two critical levels—the peak (High) and the floor (Low)—it draws horizontal lines directly onto your current chart:

  • The High Line: Represented as a red dashed line, marking the upper resistance level.
  • The Low Line: Represented as a green dashed line, marking the lower support level.

Smart Visibility Rules To keep the chart clean and organized, the script includes built-in logic to manage its own visibility:

  • Automatic Cleanup: If you switch to a Daily chart or higher, the lines will automatically disappear so they do not clutter your view.
  • Dynamic Updating: The script constantly refreshes these lines to ensure they stay accurate relative to the most recent price action.
  • Clean Exit: When the indicator is removed from the chart, it includes a "cleanup" command that ensures all drawn lines are deleted, leaving your workspace exactly as you found it.

Key Benefits for Traders

By highlighting these specific boundaries, the tool helps traders quickly identify potential areas of support and resistance. It removes the manual work of scrolling back through history to find previous price peaks, allowing for faster decision-making during live market sessions.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
12 Views
2 Downloads
0 Favorites
Hi_Low_Indicator_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                Pivots_Hi_Low.mq4 |
//|                      Copyright © 2006, Cartwright Software Corp. |
//|                                        http://www.cartwright.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Cartwright Software Corp."
#property link      "http://www.cartwright.net"

#property indicator_chart_window

extern int BarsBack=8;    // (Set to 0 GMT) IBFX=GMT FXDD=GMT+3 5pm-17:00(PST)
extern bool ShowLines=true;
double yesterday_high, yesterday_low;


int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
ObjectDelete("Yesterdays Low line");   
ObjectDelete("Yesterdays High line");      
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

//----
yesterday_high=iHigh(NULL, PERIOD_H1,Highest(NULL, PERIOD_H1, MODE_HIGH, BarsBack, 0)); 
yesterday_low=iLow(NULL, PERIOD_H1,Lowest(NULL, PERIOD_H1, MODE_LOW, BarsBack, 0));     

if (ShowLines==true && Period() < PERIOD_D1) {  
ObjectDelete("Yesterdays Low line");
ObjectCreate("Yesterdays Low line",OBJ_HLINE, 0, Time[0], yesterday_low);
ObjectSet("Yesterdays Low line", OBJPROP_STYLE, STYLE_DASH);
ObjectSet("Yesterdays Low line", OBJPROP_COLOR, Green);

ObjectDelete("Yesterdays High line");
ObjectCreate("Yesterdays High line",OBJ_HLINE, 0, Time[0], yesterday_high);
ObjectSet("Yesterdays High line", OBJPROP_STYLE, STYLE_DASH);
ObjectSet("Yesterdays High line", OBJPROP_COLOR, Red);      
}   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments