urovni-dou

This tool is a specialized visual indicator designed for MetaTrader 4 to help traders identify key price levels based on historical daily data. Instead of relying on standard moving averages, it calculates specific "Pivot" points—levels of potential support and resistance—by analyzing the price action of previous trading days.

Core Logic and Functionality

1. Historical Data Processing The script scans through past price candles to identify the High, Low, and Closing prices for each day. By recognizing when a new day begins, it captures these three vital statistics to create a foundation for its calculations.

2. Pivot Point Calculation Once the data for a previous day is gathered, the tool uses mathematical formulas to project several different types of levels onto the current chart:

  • The Standard Pivot (P): A central balance point calculated by averaging yesterday’s high, low, and closing prices.
  • Support and Resistance Levels: The script derives multiple primary lines (P1, C1, P2, C2, P3, and C3) using various combinations of these daily extremes. These lines act as "floors" and "ceilings" where price might stall or reverse.

3. Visual Representation The indicator automatically plots these calculated values as continuous lines on your chart. This allows you to see at a glance where the market is likely to find structural support or encounter resistance based on yesterday's volatility.

4. Dynamic Updates As new candles form during the current trading day, the script constantly monitors the highest and lowest prices reached so far. It updates its internal tracking to ensure that the projected levels remain accurate as the market moves forward in real-time.

Key Features for the User

  • Timeframe Compatibility: The tool is specifically optimized for intraday timeframes (any timeframe smaller than a Daily chart). If used on a Daily or higher timeframe, it will provide a warning to ensure accuracy.
  • Customizable History: You can choose how much historical data the indicator should process, allowing you to balance between visual clarity and deep historical analysis.
  • On-Screen Dashboard: The script includes an optional comment feature that displays real-time numerical values for the High, Low, Pivot, and Support/Resistance levels directly on your chart screen.

Summary of Use

Essentially, this tool automates the math required to predict where price might "bounce" or "break." By looking at yesterday's boundaries, it draws a roadmap of potential price zones on today's chart, helping traders identify significant areas of interest without having to perform manual calculations.

Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
urovni-dou
//+------------------------------------------------------------------+ 
//| DJ_Lines.mq4 | 
//| Copyright © 2005, MetaQuotes Software Corp. | 
//| http://www.metaquotes.net | 
//+------------------------------------------------------------------+ 
//+------------------------------------------------------------------+ 
//| HiLoClose.mq4 | 
//+------------------------------------------------------------------+ 
/* 
Name := HiLoClose 
Author := hawt 
Link := hawt77@bigmir.net 
*/ 

#property indicator_chart_window 
#property indicator_buffers 7 
#property indicator_color1 White 
#property indicator_color2 Red 
#property indicator_color3 Red 
#property indicator_color4 Yellow 
#property indicator_color5 Yellow 
#property indicator_color6 LimeGreen 
#property indicator_color7 LimeGreen 
//---- input parameters5 
extern int show_comment=1; // ðèñîâàòü ëè êîììåíòàðèé (0 - íåò, 1 - äà) 
extern int how_long=1000; // ñêîëüêî áàðîâ îáðàáàòûâàòü (-1 - âñå) 
//---- indicator buffers 
double E2[]; 
double ff[]; 
double E4[]; 
double E5[]; 
double E6[]; 
double E7[]; 
double E8[]; 



//+------------------------------------------------------------------+ 
//| Custom indicator initialization function | 
//+------------------------------------------------------------------+ 
int init() 
{ 
SetIndexBuffer(0, E2); 
SetIndexBuffer(1, ff); 
SetIndexBuffer(2, E4); 
SetIndexBuffer(3, E5); 
SetIndexBuffer(4, E6); 
SetIndexBuffer(5, E7); 
SetIndexBuffer(6, E8);  

SetIndexStyle(0, DRAW_LINE,1,2); 
SetIndexStyle(1, DRAW_LINE); 
SetIndexStyle(2, DRAW_LINE); 
SetIndexStyle(3, DRAW_LINE); 
SetIndexStyle(4, DRAW_LINE); 
SetIndexStyle(5, DRAW_LINE); 
SetIndexStyle(6, DRAW_LINE); 



return(0); 
} 

//+------------------------------------------------------------------+ 
//| Custom indicator deinitialization function | 
//+------------------------------------------------------------------+ 
int deinit() 
{ 
Comment(""); 
return(0); 
} 

int start() 
{ 
int cnt=0; // ñ÷åò÷èê áàðîâ 
int begin_bar=0; // áàð, ñ êîòîðîãî íà÷èíàåò ðàáîòó èíäèêàòîð 
int prev_day, cur_day; // èäåíòèôèêàòîðû òåêóùåãî è ïðåäûäóùåãî äíÿ 
double day_high=0; // äíåâíîé high 
double day_low=0; // äíåâíîé low 
double yesterday_high=0; // íàèáîëüøàÿ öåíà ïðåäûäóùåãî äíÿ 
double yesterday_low=0; // íàèìåíüøàÿ öåíà ïðåäûäóùåãî äíÿ 
double yesterday_close=0; // öåíà çàêðûòèÿ ïðåäûäóùåãî äíÿ 
double P, S, R, P1, P2, P3, C1, C2, C3; 

// ïðàâèëüíûå òàéìôðåìû äëÿ íàøåãî èíäèêàòîðà - âñå, ÷òî ìåíüøå D1 
if (Period() >= PERIOD_D1) { 
Comment("WARNING: Invalid timeframe! Valid value < D1."); 
return(0); 
} 

// ðåøàåì ñ êàêîãî áàðà ìû íà÷íåì ñ÷èòàòü íàø èíäèêàòîð 
if (how_long == -1) { 
begin_bar = Bars; 
} else { 
begin_bar = how_long; 
} 

// îáõîäèì áàðû ñëåâà íàïðàâî (0-é áàð òîæå èñïîëüçóåì, ò.ê. èç íåãî ìû áåð¸ì òîëüêî high è low) 
for (cnt = begin_bar; cnt >= 0; cnt--) { 
cur_day = TimeDay(Time[cnt]); 
if (prev_day != cur_day) { 
yesterday_close = Close[cnt+1]; 
yesterday_high = day_high; 
yesterday_low = day_low; 
P = (yesterday_high + yesterday_low + yesterday_close) / 3; 
R = yesterday_high; 
S = yesterday_low; 
P1 = 2 * P - S; 
C1 = 2 * P - R; 
P2 = P + (P1 - C1); 
C2 = P - (P1 - C1); 
P3 = R + (2 * (P - S)); 
C3 = S - (2 * (R - P)); 

// ò.ê. íà÷àëñÿ íîâûé äåíü, òî èíèöèèðóåì ìàêñ. è ìèí. òåêóùåãî (óæå) äíÿ 
day_high = High[cnt]; 
day_low = Low[cnt]; 

// çàïîìíèì äàííûé äåíü, êàê òåêóùèé 
prev_day = cur_day; 
} 

// ïðîäîëæàåì íàêàïëèâàòü äàííûå 
day_high = MathMax(day_high, High[cnt]); 
day_low = MathMin(day_low, Low[cnt]); 

// ðèñóåì pivot-ëèíèþ ïî çíà÷åíèþ, âû÷èñëåííîìó ïî ïàðàìåòðàì â÷åðàøíåãî äíÿ 
E2[cnt] = P; 
ff[cnt] = P1; 
E4[cnt] = C1; 
E5[cnt] = P2; 
E6[cnt] = C2; 
E7[cnt] = P3; 
E8[cnt] = C3; 
// ðèñóåì ëèíèè ñîïðîòèâëåíèÿ è ïîääåðæêè óðîâíÿ 1,2 èëè 3 
} 

if (show_comment == 1) { 
P = (yesterday_high + yesterday_low + yesterday_close) / 3; 
R = yesterday_high; 
S = yesterday_low; 
P1 = 2 * P - S; 
C1 = 2 * P - R; 
P2 = P + (P1 - C1); 
C2 = P - (P1 - C1); 
P3 = R + (2 * (P - S)); 
C3 = S - (2 * (R - P)); 

Comment("Current H=", R, ", L=", S, ", HLÑ/3=", P, " C2=", C2, ", H-L=", (R-S)/Point ); 
} 
return(0); 
} 
//+-----------------------------------------------------------------

Comments