거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
지표

DailyHighLow Indicator for MQL5 - MetaTrader 5용 지표

조회수:
2009
평가:
(2)
게시됨:
2025.05.17 03:08
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Features and Functionality

The indicator plots two lines on the chart: one for the high price and one for the low price, calculated based on user-defined inputs. Its key features include:

  • Customizable Timeframe: Users can select a timeframe (e.g., daily, hourly) using the TimeFrame input, with a default of PERIOD_D1 (daily). The indicator ensures the selected timeframe is not smaller than the chart's current timeframe to maintain data accuracy.

  • Price Calculation Options: The Price input allows users to choose between three modes:

    • Low/High (DHL_LOWHIGH): Plots the highest and lowest prices of the specified timeframe.

    • Open/Close (DHL_OPENCLOSE): Plots the maximum of open/close prices and the minimum of open/close prices.

    • Close/Close (DHL_CLOSECLOSE): Plots the highest and lowest closing prices.

  • Previous Period Option: The Previous input (default: true) allows users to display the high/low of the previous period, aiding in historical analysis.

  • Visual Customization: The indicator uses solid silver lines for both high and low plots, with a width of 1, ensuring clear visibility without cluttering the chart.

How It Works

The indicator operates by initializing two buffers (HighBuffer and LowBuffer) to store and display the high and low price levels. During initialization (OnInit), it sets these buffers and validates the timeframe. The core logic resides in the OnCalculate function, which processes price data for each bar:

  1. Data Preparation: Arrays for time, open, close, high, and low prices are set as series for reverse indexing.

  2. Timeframe Alignment: The indicator calculates bar shifts using iBarShift to align data with the selected timeframe.

  3. Price Calculation:

    • For DHL_LOWHIGH, it directly fetches the high and low prices using iHigh and iLow.

    • For DHL_OPENCLOSE and DHL_CLOSECLOSE, it identifies the highest/lowest open or close prices within the timeframe using iHighest and iLowest.

  4. Previous Period Handling: If Previous is enabled, calculations shift to the prior period, providing historical context.

  5. Optimization: The indicator limits calculations to new or updated bars (limit) to ensure efficiency and avoid redundant processing.

Practical Applications

The DailyHighLow indicator is ideal for traders employing strategies based on key price levels, such as:

  • Support and Resistance: Identifying daily or custom timeframe high/low levels for breakout or reversal strategies.

  • Trend Analysis: Comparing current price action against previous highs/lows to gauge market direction.

  • Risk Management: Setting stop-loss or take-profit levels based on significant price points.

Usage Instructions

  1. Installation: Add the indicator to your MetaTrader 5 platform by copying the code to the MQL5/Indicators folder and compiling it.

  2. Configuration:

    • Set the desired TimeFrame (e.g., PERIOD_D1 for daily levels).

    • Choose a Price mode (DHL_LOWHIGH, DHL_OPENCLOSE, or DHL_CLOSECLOSE) based on your strategy.

    • Enable or disable the Previous option to toggle between current and previous period data.

  3. Chart Application: Attach the indicator to any chart. It will display two silver lines representing the high and low levels.

Conclusion

The DailyHighLow indicator is a simple yet powerful tool for MQL5 traders, offering flexibility in timeframe and price calculation methods. Its lightweight design and efficient processing make it suitable for both novice and experienced traders looking to enhance their technical analysis.


Feedback

If you have suggestions or encounter issues, please leave a comment on the MQL5 CodeBase page or contact me through the MQL5 community. Your feedback is valuable for improving this tool!


Contact me: MQL5 Link


Bands R-squared Bands R-squared

Simple Expert Advisor with custom R-squared optimisation function

AutoCloseOnProfitLoss Expert - Automatically Close All Positions on Profit/Loss AutoCloseOnProfitLoss Expert - Automatically Close All Positions on Profit/Loss

The AutoCloseOnProfitLoss Expert Advisor (EA) is a powerful automation tool for MetaTrader 5, designed to close all open positions when predefined profit or loss targets are reached

EquiPeak Drawdown Tracker EquiPeak Drawdown Tracker

EquiPeak Drawdown Tracker is an indicator designed to monitor and record the maximum drawdown of your trading account in real time. It is not just an alerter of current drawdown; it is especially useful for visually comparing your current drawdown with the maximum historical drawdown you expect or have previously recorded.

CTsLogger is a simple and flexible logging system CTsLogger is a simple and flexible logging system

Logger with the ability to log individual modules or code sections