I found most session boxes indicators buggy and confusing, so I decided to write my own. The indicator draws boxes around market sessions. Please read the readme, indicator "Inputs" tab and/or comments in the sourcecode before asking questions.
Screenshots below show a weekly H1 chart with all sessions enabled (default colours and range above the boxes), and all default settings
---::: README :::---
- all settings can be changed in "Inputs" tab when adding the indicator or in the sourcecode (check sourcecode comments)
- to disable a particular session change its colour to "None" in "Inputs" tab or to CLR_NONE in the sourcecode (permanently changes defaults)
- set "ShowRange" to "true" to show session ranges in pips ("Show object descriptions" must be enabled for this to work, check Charts -> Properties -> Show object descriptions). Set to "false" to hide range
- set MaxDays to the amount of days in which boxes should be drawn. Set to "0" to show boxes for all days visible on the whole chart
- set "Style" to desired drawing style of the box. If changing in the sourcecode, the values have to be of ENUM_LINE_STYLE type!
- set "Background" to "true" if you want the boxes filled. Set to "false" if you want only the outline of the box
- set MOD of each session in the format of [session open mod],[session close mod] to move the open/close by the desired amount of hours, i.e. shorten/lengthen session boxes. Each session is 9 hours long! Positive numbers move open/close to the right on the chart, negative numbers to the left, e.g. "LondonMod" set to "4,0" moves only the open of the London session by 4 hours (4 hours to the right), i.e. shows only the last 5 hours of the London session. "TokyoMod" set to "0,-4" moves only the close of the Tokyo session by -4 hours (4 hours to the left), i.e. shows only the first 5 hours of the Tokyo session.
---::: README :::---
Please really read the readme above before asking questions...
I tested it with local time GMT+1 (plus daylight saving, so GMT+2) and fixed broker time GMT-4 (doesn't change with DST), both during the week and on the weekends and it worked fine (my only concern is for Tokyo and Sydney users since Tokyo does not adjust to DST and Sydney is in southern hemisphere, but it should account for both automatically)
Please copy, modify, distribute as you wish, I'd appreciate some credit in the comments, though. And don't forget to send 10% via paypal if you manage to sell it
I hope it helps. Please post features it may need and bugs you found. Oh, and don't forget to read the readme
Bugs addressed from other session indicators and features: - automatically calculates open and close times depending on GMT and broker time offset; - shows the correct number of bars in a session (instead of 1 too many); - boxes include high/low of the first candle in the session if that candle sets session high/low; - does not draw buggy weekend boxes; - does not draw boxes for daily timeframe and higher; - possible to draw boxes for all the days visible on the chart (e.g. for backtesting); - redraws only the last box on new ticks instead of every box drawn on the chart; - enable/disable, set colour and drawing style for each session; - show/hide session range in pips above each box; - apply open/close MOD to shorten/lengthen boxes (i.e. show only the first/last X hours of the session). Known issues: - it is not possible to set the colour of session ranges. MT4 uses default "foreground" colour to draw object descriptions and the only workaround would be to create a separate text for each session doubling the amount of objects on the chart - not worth it resource-wise in my opinion; - when opening the MT4 platform, boxes may be misalligned. changing the timeframe or profile after opening the platform will redraw all the boxes (call init() function). Changelog: - v1.7 - small adjustment in the hours for Broker GMT Offset's algorithm when the market is closed - v1.6 - improved deinit() algorithm, de-cluttered the code, added MaxTF input to limit session boxes drawing; - v1.5 - fixed a minor bug in broker GMT offset algorithm (in some cases it was 1 hour off depending on the minute of an hour); - v1.4 - fixed drawing of first/last session of the week (depending on broker time); - v1.3 - added disabling boxes with default 'None' colour, not only 'CLR_NONE' from sourcecode; - v1.2 - rewrote time conversion to GMT-based instead of local-based, fixed weekend issue when GMT time would continue but broker time stopped, cleared up the code and added comments if someone is interested in the code itself; - v1.1 - added open/close MODs; - v1.0 - initial release