Volume Profile Session Visible and Fixed Range MT4
- Indicators
-
Kazuma Uezono
MQL5 / MQL4 / Pine Script v6 developer and active trader.
Seller on the MQL5 Market (indicators for MT4/MT5).
Services:
- TradingView Pine Script to MT5/MT4 conversion (bar-by-bar matching, with tester report)
- MT4 to MT5 migration - Version: 1.0
Volume Profile Session Visible and Fixed Range MT4 draws a horizontal volume-by-price histogram on your MetaTrader 4 chart, with the POC (the price row with the most volume) and the value area with its upper and lower edges (VAH and VAL). Three profile types are in one indicator: sessions (day or week), the visible range of the chart, and a fixed range that you set by dragging two vertical lines. It is free.
It is a display tool. It does not trade, gives no buy or sell signals and does not predict prices. POC, VAH and VAL are a summary of past price and volume data; they are not guaranteed to act as support or resistance.
WHAT IS DIFFERENT IN THE MT4 VERSION
This is the MetaTrader 4 version. MetaTrader 4 has no tick history, no exchange volume and no semi-transparent drawing, so it works differently from the MetaTrader 5 version in these points:
- Volume is always tick volume. There is no "build from ticks" mode and no volume source input. Profiles are built from M1 bars (M5 to D1 bars for long ranges).
- When M1 history is missing, the profile is built from a coarser timeframe and a message is shown in the lower left corner of the chart (see "History" below).
- The profile is drawn with rectangle objects behind the price bars. "Opacity" is a colour mixed with the chart background colour, not real transparency. Where two profiles overlap, MetaTrader 4 mixes the colours of the filled rectangles, so the overlapping part can look inverted.
- On a chart that receives no ticks (weekend, market closed), a profile that has finished building may not appear on the screen until the next tick or until you scroll the chart or change the timeframe.
- Messages on the chart are in English only.
- 37 inputs, no input group headers (iCustom: 37 parameters).
FEATURES
- Session profiles: one profile per day or per week (weeks start on Monday). Sessions are cut at your broker's server midnight; the start can be moved by -23 to +23 hours. 1 to 200 sessions (5 by default).
- Visible range: one profile of the bars you see on the chart, rebuilt when you scroll or zoom. Placed at the right or left edge, width in % of the chart.
- Fixed range: one profile between two dashed vertical lines. Drag the lines and the profile follows. A deleted line is drawn again. Start and end times can also be set in the inputs.
- POC line, VAH and VAL lines, price labels on the latest profile, optional extension of the lines to the right edge of the chart.
- Value area 70% by default (1 to 100%). Rows inside the value area are drawn stronger than rows outside it.
- Optional up/down split of each row in two colours (an estimate, see below).
- Row size: a number of rows (24 by default, 2 to 1000) or a fixed number of points per row (if that would make more than 2,000 rows, the row size is doubled automatically).
- Completed profiles are not redrawn: once a session has ended, its profile and its POC, VAH and VAL stay the same. (Switching the timeframe or loading the indicator again builds all profiles again from the data available at that time.)
- Status text while profiles are being built (for example "loading history... 3/5").
HOW IT IS CALCULATED
- Volume: tick volume, as provided by your broker. It counts price updates, not traded lots. Tick volume differs between brokers and between the MetaTrader 4 and MetaTrader 5 data of the same broker, so the profile can differ slightly from other platforms and tools.
- Built from M1 bars: the volume of each M1 bar is spread evenly over the price range from its low to its high. The real movement inside each minute is not known, so the result can differ from a profile built from ticks.
- When a range would need more than about 200,000 M1 bars (adjustable), M5, M15, M30, H1, H4 or D1 bars are used. Coarser bars give a coarser profile.
- Up/down split (estimate): a bar that closes above its open counts as up volume and one that closes below its open as down volume (an unchanged bar is compared with the previous close, otherwise split half and half). This is not real buy and sell volume; MetaTrader does not report which side started a trade.
- POC = the row with the most volume. If several rows have the same volume, the row nearest the middle of the profile is used. The POC price is the middle of that row.
- Value area: starting from the POC, the next row above and the next row below are compared, and the larger one is added (both when they are equal), one row at a time, until the chosen percentage of the total volume is reached. VAH is the top of the highest row in the value area and VAL is the bottom of the lowest row.
HISTORY
- MetaTrader 4 often has only a short M1 history. If M1 bars do not cover the whole range, the indicator waits a moment and then uses the finest timeframe that covers it (in the end, the chart timeframe). The lower left corner of the chart shows which timeframe was used and how to load more history.
- To load M1 history: open the M1 chart of the symbol, press the Home key a few times, then switch the timeframe of your chart. The profiles are built again from M1 bars. The number of bars MetaTrader 4 keeps is limited by Tools > Options > Charts > "Max bars in history".
- A session that ends while it is built from coarser bars keeps that coarser profile until you switch the timeframe or load the indicator again.
HOW WE CHECKED IT
- Strategy Tester, 11 runs (EURUSD, USDJPY, GBPUSD, EURJPY, AUDUSD, GOLD; M1 to D1; day and week sessions; session start shift; both row size modes): every completed session was checked again on every later bar; no value changed after the session had ended. No errors in the log.
- Live charts (normal and with no ticks): no memory leaks, no runtime errors, no terminal crashes in 6 runs.
- These checks show that the calculation behaves as described. They say nothing about future prices or trading results.
ALERTS (OFF BY DEFAULT)
- Alert when the price crosses the POC, VAH or VAL (each can be switched on or off). Pop-up, sound and push notification.
- At most one alert per level per bar.
- In session mode you choose the levels of the previous (completed) session or of the current (developing) session. The levels of the current session move while the session is forming, so this choice gives more alerts. In visible range mode the levels change when you scroll; in fixed range mode, when you move the lines.
- The first price after loading or after a new session only sets the starting point and never alerts.
- An alert only reports that the price reached a level. It is not a signal to buy or sell.
- No alerts in the Strategy Tester or when the indicator is loaded through iCustom.
FOR EA AND iCUSTOM USERS
- 3 buffers (not drawn): 0 = POC, 1 = VAH, 2 = VAL. Each bar holds the levels of the profile that contains that bar; EMPTY_VALUE where there is no profile. The values of a profile that is still forming (the current session, the visible range, a fixed range that reaches the latest bar) change as new data arrives. A completed session no longer changes.
- iCustom parameters: the 37 inputs in the order of the input dialog. You can also pass no parameters to use the defaults.
- When it is loaded through iCustom it draws nothing and raises no alerts; it only calculates the buffers. On a chart, the input "Draw on chart" = false also hides the drawing (buffers and alerts keep working).
- Without a chart the visible range is the latest 100 bars (input "bars back"), and the fixed range uses the start and end time inputs (0 = the latest 100 bars).
- In the Strategy Tester the profiles are updated at most once per minute of test time.
NOTES AND LIMITS
- Session boundaries use your broker's server time, so brokers in different time zones give different daily profiles. Other platforms can use other session times; you can use the session start shift to line them up.
- Week sessions start on Monday. Sunday bars belong to the week before.
- If the chart timeframe is longer than the session (for example day sessions on a W1 chart), no profile is drawn and a message is shown.
- Rows next to each other with the same length are drawn as one rectangle. If one chart would need too many rectangles (many sessions with many rows), older profiles show only their lines and a message is shown. Use fewer sessions or fewer rows.
- If you delete a fixed range line, it is drawn again. In rare cases it is drawn again at a default position; then drag it to where you want it.
- The rectangles are hidden from the object list and cannot be selected.
- If an input is out of range, the indicator does not load and writes a message to the Experts log.
- No DLLs, no external files, no internet connection.
- A charting aid only. It does not trade and does not guarantee any trading result.
MAIN INPUTS
Profile: Profile type (Session), Session length (Day / Week), Session start shift in hours (0, -23 to 23), Number of sessions (5, 1-200), Fixed range start and end time (0 = automatic), Bars back for the automatic fixed range and for the visible range without a chart (100)
Rows and value area: Row size mode (Number of rows), Number of rows (24), Points per row (10), Value area % (70), Max source bars (200,000)
Display: Draw on chart, Up/down split, profile width, visible range width and placement, POC and VA lines, price labels, extend lines, colours, strength inside and outside the value area, line width, label size
Alerts: Alerts (off), Session mode: levels of (previous session), POC / VAH / VAL, Pop-up, Sound, Push notification
COMPATIBILITY AND SUPPORT
- MetaTrader 4, any symbol. Session profiles need a chart timeframe that is not longer than the session.
- Support through MQL5 messages: installation, settings and bug reports. Questions about market direction or individual trades are outside the support scope.
- Other tools by the same author, including the MetaTrader 5 version, are listed on my seller profile.
