Market Profile MetaTrader indicator — is a classic Market Profile implementation that can show the price density over time, outlining the most important price levels, value area, and control value of a given trading session. This indicator can be attached to timeframes between M1 and D1 and will show the Market Profile for daily, weekly, monthly, or even intraday sessions. Lower timeframes offer higher precision. Higher timeframes are recommended for better visibility. It is also possible to use a free-draw rectangle session to create a custom market profile on any timeframe. Six different color schemes are available to draw the profile's blocks. Drawing profiles as a plain color histogram is also possible. Alternatively, you may choose to color the profile based on bullish/bearish bars. This indicator is based on bare price action and does not use any standard MetaTrader indicators. It is available for both MetaTrader 4 and MetaTrader 5 platforms.
- Session (default = Daily) — trading session for market profile: Daily, Weekly, Monthly, Intraday, and Rectangle. For a rectangle session to get calculated, a rectangle chart object with the name starting with MPR should be added to the chart.
- StartFromDate (default = __DATE__) — if StartFromCurrentSession is false, then the indicator will start drawing profiles from this date. It draws to the past. For example, if you set it 2018-01-20 and SessionsToCount is 2, then it will draw the profiles for 2018-01-20 and 2018-01-19.
- StartFromCurrentSession (default = true) — if true, then the indicator starts drawing from today, else — from the date given in StartFromDate.
- SessionsToCount (default = 2) — for how many trading sessions to draw the market profiles.
Looks and colors
- ColorScheme (default = Blue to Red) — color scheme for profile's blocks:
- blue to red
- red to green
- green to blue
- yellow to cyan
- magenta to yellow
- cyan to magenta
- SingleColor (default = clrBlue) — if ColorScheme is set to Single Color, this color will be used to draw market profiles.
- ColorBullBear (default = false) — if true, the color of the profile blocks depends not on the age of the origin bar but on its direction.
- MedianColor (default = clrWhite) — the color of the control value (median).
- ValueAreaSidesColor (default = clrWhite) — the color of the value area side borders.
- ValueAreaHighLowColor (default = clrWhite) — the color of the value area top and bottom borders.
- ShowValueAreaRays (default = None) — can be set so that the value area's High and Low price levels are projected to the right side of the chart. Can be set to previous session, current, previous and current, all previous, or all.
- ShowMedianRays (default = None) — can be set so that the median is projected to the right side of the chart. Can be set to previous session, current, previous and current, all previous, or all.
- RaysUntilIntersection (default = Stop_No_Rays) — defines the way median and value area rays will be cut off when they meet the next trading session's price range:
- Stop_No_Rays — no rays are stopped anywhere.
- Stop_All_Rays — all rays are stopped at an intersection with the price of another session.
- Stop_All_Rays_Except_Prev_Session — all rays except the previous session's rays are stopped at an intersection with the price of another session.
- Stop_Only_Previous_Session — only rays of the previous session are stopped at an intersection with the price of another session.
- TimeShiftMinutes (default = 0) — time shift for the sessions, in minutes. Positive value will move the session start to the left; negative — to the right.
- ShowKeyValues (default = true) — if true, Value Area High, Value Area Low, and Point of Control are displayed on the left of the market profile.
- KeyValuesColor (default = clrWhite) — color for Value Area High, Value Area Low, and Point of Control printout.
- KeyValuesSize (default = 8) — font size for Value Area High, Value Area Low, and Point of Control printout.
- ShowSinglePrint (default = No) — can be set to Leftside or Rightside and will mark the single print profile — a part of the profile, which is only one TPO wide.
- SinglePrintColor (default = clrGold) — color for single print marking if ShowSinglePrint isn't set to No.
- ProminentMedianColor (default = clrYellow) — color for the prominent median (PPOC) if ProminentMedianPercentage is set to 100 or less.
- RightToLeft (default = false) — if true, the current session's market profile has its histogram drawn from right to left. In case Session is set to Rectangle, market profiles of all sessions are drawn right-to-left.
- PointMultiplier (default = 0) — the higher it is, the wider are the profile's price boxes and the fewer are the chart objects. You can use it to reduce the indicator's load on CPU. When the value is zero, an adaptive multiplier is used — the indicator attempts to calculate the optimal value automatically.
- ThrottleRedraw (default = 0) — a delay in seconds that will be applied before each redraw of the profiles. You can use it to reduce the indicator's load on CPU.
- DisableHistogram (default = false) — if true, no market profile histogram is drawn, but Value Area and Median are still marked. This makes indicator work extremely fast, but is less useful for thorough market analysis.
- EnableIntradaySessionN (default = true) — if true and Session is set to Intraday, then the indicator will attempt to drawn the intraday market profile #N on the chart.
- IntradaySessionNStartTime (default = "HH:MM") — start time in HH:MM format for the intraday session #N.
- IntradaySessionNEndTime (default = "HH:MM") — end time in HH:MM format for the intraday session #N.
- IntradaySessionNColorScheme (default = Blue_to_Red) — color scheme for the intraday session #N.
- SaturdaySunday (default = Normal sessions) — how to treat Saturday and Sunday sessions:
- Normal sessions — Saturday and Sunday will be treated as normal sessions with their own daily and intraday sessions.
- Ignore Saturday and Sunday — Saturday and Sunday candlesticks will be ignored.
- Append Saturday and Sunday — Saturday candlesticks will be appended to the Friday session; Sunday candlesticks will be appended to the Monday session.
- DisableAlertsOnWrongTimeframes (default = false) — if true, no pop-up alerts will appear on using Market Profile with wrong timeframe/session combination.
- ProminentMedianPercentage (default = 101) — percentage of TPOs out of all possible that should occur inside a median for it to be considered prominent (PPOC). For example, if you set it to 50%, a median will be marked as prominent if it contains at least 24 TPOs in a daily session on M30 timeframe. If it is set to 101, no prominent median is possible.
The chart screenshot shows market profiles calculated and displayed for two daily Forex trading sessions. The timeframe is M30 and the right-hand daily session is still in progress. The earliest prices are blue and the latest prices are red. The medians and the value areas are marked with the white lines and display the most important price areas. Traders tend to return to those areas if the volume of the breakout movement is not too high. High-volume breakout out of these areas signifies a real breakout. You can read more about Market Profile in this short e-book: Book on Market Profile.
The example below demonstrates how the Market Profile can be colored according to the direction of each bar in the session rather than its age. This is done when ColorBullBear is set to true.
This example demonstrates how the indicator can display a market profile based on the rectangle chart objects freely drawn by a trader. For this to work, a rectangle object's name has to start with MPR and the Session input parameter has to be set to Rectangle.
Market Profile indicator can also draw histogram from right to left. Unlike the traditional left-to-right display, it can be helpful to focus on the current trading session, without obscuring its chart. You can see how this works on the chart screenshot below.
Downloads (ver. 1.16, 2020-12-07)
MarketProfile indicator is being developed via a dedicated GitHub repository. You are encouraged to actively participate in the improvement of this indicator by submitting your own features via pull-requests and reviewing existing suggestions, changes, fixes, and so on.
Market Profile for MetaTrader 4 in .zip
Market Profile for MetaTrader 4 in .mq4
Market Profile for MetaTrader 5 in .zip
Market Profile for MetaTrader 5 in .mq5
Do you have any suggestions or questions regarding this indicator? You can always discuss Market Profile with the other traders and MQL programmers on the indicators forums.
1.16 — 2020-12-07
- Added an input parameter (DisableHistogram) to prevent the indicator from drawing profile histograms (TPO's). Value area and point of control are still drawn in this mode.
- Added an input parameter (RightToLeft) for right-to-left histogram display. Works for the current trading session for non-Rectangle session types, and for all trading sessions for Rectangle session type.
- Added adaptive point multiplier option via setting the PointMultiplier input parameter to 0 (which is now default).
1.15 — 2020-07-14
- Added Rectangle session type to display market profile based on rectangle objects added to the chart. It works on any timeframe. A rectangle should have a name starting with MPR to be detected by the indicator.
- Added single print highlighting (ShowSinglePrint and SinglePrintColor input parameters).
- Added prominent median (PPOC) highlighting (ProminentMedianPercentage and ProminentMedianColor input parameters).
1.14 — 2020-01-26
- Replaced ValueAreaColor input parameter with two separate parameters: ValueAreaSidesColor and ValueAreaHighLowColor to provide more control over how the value area is shown on the chart.
- Changed RaysUntilIntersection input parameter to provide more control over which value area or point of control (median) rays are cut off at intersection with other sessions.
- Fixed a rounding error in MT5 version, which resulted in value areas being biased towards higher prices.
- Fixed a bug in MT5 version, which resulted in profile blocks being displayed in white color rather than not displayed at all when Single_Color scheme is used and SingleColor parameter is set to
- Bypassed a coloring bug in MT4 version that would cause the chart discoloring and blinking along with visible gaps showing in the profile.
1.13 — 2019-10-18
- Added ColorBullBear input parameter to color the market profile according to bars' directions.
- Added DisableAlertsOnWrongTimeframes input parameter to disable popup alerts when Market Profile is applied to a wrong timeframe.
- Added optional printouts for Value Area High, Value Area Low, and Point of Control rates for each profile.
- Added grouping for input parameter in MT5 version of the indicator.
1.12 — 2019-03-27
- Added RaysUntilIntersection input parameter, which helps to hide the rays of the previous sessions' median and value area that have already been violated by newer trading sessions.
- Fixed a bug with TPO display when the symbol's
TickSize is higher than
_Point × PointMultiplier.
1.11 — 2019-01-20
- Fixed a bug when empty holes could appear in the profile when the current session was built.
- Fixed a bug that prevented current session profile from drawing from the first bar.
- Fixed some potential 'array out of range' errors.
1.10 — 2018-12-25
- Fixed potential array out of range error when old chart with Market Profile indicator is reopened.
1.09 — 2018-12-24
- Added two alternative options for dealing with Saturday and Sunday candlesticks.
- Added more flexibility to displaying Median and Value Area rays.
- Changed Median to draw as a single line inside the value area.
- Reduced the size of the working arrays significantly, which should make MP calculation on some trading instruments faster.
1.08 — 2018-05-28
- Added smart color graduation depending on timeframe and session type.
- Added an option to project the Median (Point of Control) of the previous session to the right side of the chart.
- Added single color scheme.
- Added PointMultiplier input parameter to allow traders to set wider profile box, helping with indicator's performance.
- Added ThrottleRedraw input parameter to delay indicator's display updates, helping to reduce its load on the CPU.
- Fixed a potential bug when incorrect chart object naming routine could cause glitchy display of the market profile.
- Changed hard initialization failure to a soft one — this will prevent input parameters from resetting when incorrect timeframe and session type combination is used.
1.07 — 2018-02-06
- Added support for up to four intraday sessions.
- Added three new color schemes for drawing the market profile.
- Some minor code tweaks and improvements.
1.06 — 2017-11-30
- Added proper object cleanup when Market Profile is used with chart templates.
1.05 — 2017-11-23
- Added optional display for the previous session's Value Area High/Low lines.
- Added time shift input parameter to move the sessions across time zones.
1.04 — 2016-11-07
- Fixed "Array out of range" errors.
1.03 — 2016-01-25
- Added support for three sessions: daily, weekly, and monthly.
- Fixed chart object deletion to only delete indicator's own objects.
- Optimized execution speed.
- Increased the range of supported timeframes.
- Added inline indicator description.
- Improved interface (enumerated input parameters).
- Fixed some potential "Array out of range" errors.
- Code rewritten completely to comply with the current MQL4 and MQL5 standards.
1.01 — 2011-12-11
- Fixed compatibility issues due to new coding conventions in MQL5.
1.00 — 2010-07-23
- Original version of Market Profile released for MT4 and MT5.