dailybreakm30
Download scriptThis script is designed to help traders identify key price levels by automatically tracking the highest and lowest prices reached over a specific period. Specifically, it focuses on identifying "breakout" zones based on historical price action.
How it Works
The logic follows a straightforward process to simplify technical analysis:
- Historical Data Collection: The script looks back at the price movements over a set timeframe (defaulting to 5 days). It scans through this period to identify every price point reached.
- Identifying Extremes: It systematically compares all the high and low prices within that window. It "filters" through these numbers to find two specific values: the absolute highest price (the peak) and the absolute lowest price (the valley) achieved during that time.
- Visual Mapping: Once these two extreme values are identified, the script automatically draws two horizontal lines on your trading chart. These lines act as visual boundaries, clearly marking the "ceiling" and the "floor" of the recent market range.
- Real-Time Updates: The tool is designed to refresh its calculations as new data comes in, ensuring that the horizontal lines always represent the most current 5-day highs and lows.
Practical Use for Traders
The primary goal of this logic is to provide a clear visual reference for price action. By identifying where the market has peaked and bottomed out over the last few days, traders can more easily spot "breakouts." When the current market price moves significantly above or below these Aqua-colored lines, it signals that the price is moving outside of its recent established range, which is often a key signal for new trading opportunities.
//+------------------------------------------------------------------+
//| 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_M30);
ArrayCopySeries(daily_high, MODE_HIGH, Symbol(), PERIOD_M30);
/* 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