dailybreak4h

Download script
Author: Bill Sica
dailybreak4h

This script is designed to assist traders by identifying and visually highlighting significant price boundaries over a specific timeframe. By automating the calculation of historical price extremes, it helps users identify potential "breakout" levels where the market might shift direction.

Core Functionality

The primary purpose of this tool is to scan through the previous 5 days of trading data to determine the highest and lowest prices reached during that period. Instead of requiring a trader to manually look back at past charts to find these points, the script calculates them automatically and projects them onto the current chart as clear visual markers.

How the Logic Works

The script follows a structured three-step process to provide this information:

1. Data Collection The tool looks specifically at 4-hour price candles to gather historical data. It focuses on the "High" (the peak price) and the "Low" (the bottom price) for each of the past 5 trading periods.

2. Extremes Calculation Once it has gathered the data for those 5 days, the logic performs a comparison:

  • Highest High: It scans all five days to find the single highest price point reached.
  • Lowest Low: It scans all five days to find the single lowest price point reached.

3. Visual Mapping After identifying these two critical numbers, the script performs two actions on your trading screen:

  • On-Screen Labels: It displays the exact numerical values of the 5-day high and low in a comment area on your chart for quick reference.
  • Horizontal Lines: It draws two solid, aqua-colored horizontal lines across your current view. These lines represent the "ceiling" (the 5-day high) and the "floor" (the 5-day low).

Trading Context

By providing these visual boundaries, the script helps traders see where the market has established its recent range. This allows for a clearer understanding of price action: when the current price approaches or moves beyond these aqua lines, it often signals a significant structural shift in the market, such as a breakout from a consolidation zone.

8 Views
0 Downloads
0 Favorites
dailybreak4h
//+------------------------------------------------------------------+
//|                                                 5dayBreakout.mq4 |
//|                                                        Bill Sica |
//|                                         http://www.tetsuyama.com |
//+------------------------------------------------------------------+
#property copyright "Bill Sica"
#property link      "http://www.tetsuyama.com"

#property indicator_chart_window
//---- input parameters
extern int       DAYS=5;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
  {
//---- indicators

//---- indicators

   

//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double daily_high[20];
   double daily_low[20];
   double yesterday_close;
   double phigh,plow;
   int i=1;

//---- TODO: add your code here
ArrayResize(daily_high,DAYS);
ArrayResize(daily_low,DAYS);
ArrayInitialize(daily_high,0);
ArrayInitialize(daily_low,0);

ArrayCopySeries(daily_low, MODE_LOW, Symbol(), PERIOD_H4);
ArrayCopySeries(daily_high, MODE_HIGH, Symbol(), PERIOD_H4);

/* initialise */
plow=daily_low[1];
phigh=daily_high[1];

for(i=1;i<DAYS;i++)
{
   if(plow>daily_low[i])
   {
      plow =daily_low[i];
   }
}

for(i=1;i<DAYS;i++)
{
   if(phigh<daily_high[i])
   {
      phigh =daily_high[i];
   }
}

Comment("\n5dayH ",phigh,"\n5dayL ",plow);

ObjectDelete("5dayHigh");
ObjectDelete("5dayLow");

ObjectCreate("5dayHigh", OBJ_HLINE,0, CurTime(),phigh);
ObjectSet("5dayHigh",OBJPROP_COLOR,Aqua);
ObjectSet("5dayHigh",OBJPROP_STYLE,STYLE_SOLID);

ObjectCreate("5dayLow", OBJ_HLINE,0, CurTime(),plow);
ObjectSet("5dayLow",OBJPROP_COLOR,Aqua);
ObjectSet("5dayLow",OBJPROP_STYLE,STYLE_SOLID);

ObjectsRedraw();

   return(0);
  }
//+------------------------------------------------------------------

Comments