Forex Factory (https://www.forexfactory.com/forum.php)
-   Platform Tech (https://www.forexfactory.com/forumdisplay.php?f=69)
-   -   'Room to move' indicator (https://www.forexfactory.com/showthread.php?t=576339)

hanover Jan 28, 2016 3:27am | Post# 1

'Room to move' indicator
 
3 Attachment(s)
NOTE: I have left Forex Factory, so don't expect replies to your posts. You can find an index to all my indicators and posts here.

Room Up/Down indicator: Terms and Conditions

 All code is supplied FREE of charge. It may NOT be sold or distributed commercially. Unless otherwise shown, no source code is available.

 Software is offered on an 'as is' basis. I'm not offering a programming or troubleshooting service.

 There is no guarantee that the software is fit for purpose, or free of errors. Download and use the indicator(s) at your own risk; I accept no liability for computer damage or financial losses.
___________________________

Overview

This MT4 indicator operates according to a simple concept. It plots two (sets of) horizontal lines, telling you how far price must move -- up and down -- from the current price, in order for today's range to reach the same number of pips as X% of a N-day ADR. By supplying a series of values for X, you can see how far price is currently away from completing, for example, 50%, 75% or 100% of the average daily range, in both the upward and downward directions. See screenshot below for an illustrated explanation. The plotted levels move dynamically as new daily highs/lows are formed. In the screenshot you can see that, so far today, price has moved around 75% of the ADR, to the upside of the daily low.Attachment 2245858
In the context of a trading strategy, after price has moved significantly more than 100% of its average daily range for today, you might decide (for example) to no longer open any new positions in that direction, or to close all currently open positions, for that pair, as the probability of price moving too much further is reduced. Or you might decide that price is now overbought or oversold for the day, and start to look for opportunities to trade back the other way.

If you have MT4's 'Show object description' option checked ON -- see the screenshot in post #12 below -- then a description showing the level number (50,75,100 etc) and the price will be plotted above each line. Otherwise, hover the mouse cursor over the line to see this information.

Disclaimer: Download and use at your own risk. All software is provided on an 'as is' basis.


Parameters

string UpLevels = "100";
Enter up to 10 levels, separated by commas. For example, if you want upside levels to be plotted at 50%, 75% and 100% of the ADR, enter 50,75,100

string DownLevels = "100";
Enter up to 10 levels, separated by commas. For example, if you want downside levels to be plotted at 50%, 75% and 100% of the ADR, enter 50,75,100
Or simply type a period (.), to make the DownLevels the same as the UpLevels.

int StartCandle = 0;
Enter the starting candle number where you want the leftmost point of the horizontal line to be plotted. 0 is the rightmost (currently forming) candle of the chart; 1 is the next candle to the left; and so on. You can also enter a negative number to have the line start plotting beyond the right hand edge of the chart.
If you enter 9999, the StartCandle is set to midnight (MT4 time 00:00) of the current day, and locked there until midnight of the next day.

(***new; beta***) string StartTime_hhmm = "0000";
Enter the MT4 time (hhmm) when you want each 24 hour interval ('day') to start. The open/high/low for each 24 hour interval will be calculated from this time. For example, if you enter 0330 then 03:30am MT4 time will be the open time of the 24 hour interval, and the high/low price for the day will be calculated by working forward from this time. This facility allows you to accommodate different broker timezones, or perhaps start your 'day' from the start of the London or New York session. The default value 0000 assumes that you simply want to start each new 'day' at MT4 midnight. Note that on a Monday, prior to your selected Start Time, the indicator simply uses the weekly open as its default starting point, until your Start Time is reached.

int LineLength = 5;
Enter the length of the horizontal line (number of candles to the right of the StartCandle). If you enter a negative number, the line will be extended all of the way to the right axis of the chart (a 'ray').

int ADRdays = 30;
The number of days (N) for the ADR calculation.

color UpLineColor = Gray;
color DownLineColor = Gray;
Colors for the upside and downside lines.

int LineWidth = 1;
Width of the lines (from 1 to 5).

int LineStyle = STYLE_SOLID;
Line style (0=solid, 1=dashed, 2=dotted, 3=dash-dot-dot, 4=dash-dot-dot-dot)

string Visibility = "M1,M5,M15,M30,H1,H4,D1,W1,MN";
Which timeframe charts the lines will be plotted on.

string RefreshPeriod = "M1";
How often the indicator will refresh itself, and the levels will be recalculated and replotted.
T=every tick. M1,M5 etc = the first tick on each M1, M5 etc candle.

bool FixFromOpen = false;
 If false (the default value), the room to move Up/Down is calculated from today's Low/High, which changes throughout the day. This way the indicator works as described in the Overview.
 If true, the room to move Up/Down is calculated from today's Open, and therefore remains fixed for the rest of the day.

string UniqueID = "0";
Creating a different UniqueID for each instance allows you to attach multiple instances of the indicator, with different settings, to the same chart.

bool UseGlobalVariables = false;
 If false (the default value), no output is made to any Global Variables.
 If true, the indicator maintains the values of three Global Variables:
1. RoomUpDown-[Unique ID][symbol ID]-UP = (current bid - today's low) x 100 / ADR, i.e. what percent of the ADR price is currently above today's low (thus far)
2. RoomUpDown-[Unique ID][symbol ID]-DN = (today's high - current bid) x 100 / ADR, i.e. what percent of the ADR price is currently below today's high (thus far)
3. RoomUpDown-[Unique ID][symbol ID]-OP = (current bid - today's open) x 100 / ADR, i.e. what percent of the ADR price is currently above/below (+/-) today's open
Provided that the indicator is attached to any chart, and is maintaining these values, the values can then be accessed by an EA, and used to make trading decisions. Or of course you could simply use the above calculations in your EA instead.

(***new; beta***) string PlotVerticalLine = "White,0,2";
This allows the automatic plotting of a vertical line to show where the new 'day' (the 24 hour interval defined by StartTime_hhmm) begins. To stop the line from plotting, simply leave this parameter setting blank. Otherwise there should be three entries, separated by commas: (1) the Line color (this may be any valid MT4 color token - e.g. SaddleBrown, LightGoldenrod, DodgerBlue - or RnnnGnnnBnnn, where R G B represent the red, green and blue components, and each nnn is a number between 0 and 255); (2) Line width, a value from 0 to 5; (3) Line style, 0=solid line, 1=dashed line, 2=dotted line etc, valid only if Line width<=1.


Installation

This indicator was written/compiled using MT4 build 509. If you want to modify the source (mq4), you must do this first, otherwise it will likely compile with a zillion errors. To avoid this problem, download only the ex4 file.
Or for a build 600+ version, you could try the one very generously contributed by pips4life in post #49.
RoomUpDown.ex4
RoomUpDown.mq4

FerruFx Jan 28, 2016 3:32am | Post# 2

Nice one. Thanks for your great work as usual!

Erebus Jan 28, 2016 4:42am | Post# 3

Looks fantastic, the FIB guys will be all over this, well 61.8% of them will be


PayTheLimit Jan 28, 2016 4:43am | Post# 4

nice handy indicator, thanks for your great work, as usual...

Thx Jan 28, 2016 8:28am | Post# 5

Thanks a lot ...

priceaction7 Jan 28, 2016 9:53am | Post# 6

Thank you sir

bobzahra Jan 28, 2016 11:46am | Post# 7

Thank you Hanover

mosiskv Jan 28, 2016 12:22pm | Post# 8

Handy indicator.

Thanks

hatemfxg Jan 28, 2016 12:29pm | Post# 9

Thank you and thank you for everything.

SoGoNe Jan 28, 2016 3:06pm | Post# 10

thank you for this nice indicator

PKOOL Jan 29, 2016 12:38pm | Post# 11

1 Attachment(s)
Hi hanover,

Thanks for this, am not getting as it is on your pix, what am i not doing right?
Click to Enlarge

Name: roomup.jpg
Size: 125 KB

hanover Jan 29, 2016 12:48pm | Post# 12

1 Attachment(s)
am not getting as it is on your pix, what am i not doing right?
Looks perfect to me, assuming you have settings of 50,75,100 for both UpLines and DownLines. See the screenshot in post #1 for the settings (colors etc) that I used. If you want the text to display above the lines, read the third paragraph of post #1, and/or see the screenshot below.

The 'up lines' and the 'down lines' can start to cross over after today's price has significantly exceeded (100% of) the ADR -- which happened with many JPY pairs yesterday after the BoJ unexpectedly introduced a negative interest rate.
Name:  PPI 116.png
Views: 6411
Size:  31 KB

bobzahra Jan 30, 2016 9:40pm | Post# 13

Dear Hanover'

Could you please add 'unique ID' to your indi so that i can add more than one indicator in one chart.. like 10ADR and 30 ADR setting

Thank you

hanover Jan 31, 2016 6:35am | Post# 14

Could you please add 'unique ID' to your indi so that i can add more than one indicator in one chart.. like 10ADR and 30 ADR setting
Not sure why anybody would want to do this, but I've made the change. Download from post #1.

bobzahra Jan 31, 2016 9:37am | Post# 15

Thank you so much Hanover

hanover Nov 4, 2016 10:42pm | Post# 16

New parameter FixFromOpen. Updated indy attached to post #1.

Rocky007 Nov 5, 2016 5:56pm | Post# 17

Thank you!

bobzahra Nov 5, 2016 7:04pm | Post# 18

Thank you so much

rajandaas Nov 5, 2016 9:50pm | Post# 19

Hi Hanover,

Thank you so much. You are very generous. May you make a lot of pips

v2vboni Nov 6, 2016 6:36am | Post# 20

Wow! a golden share
Thanks


© Forex Factory