jayy

Forex session - Opening Range- Jayy fixed updated

jayy Обновлено   
Opening Range (OR) for Forex 24 hour regular session. This is not for regular market day sessions addressed in a separate script.

This script fixes four issues:
syntax error when code compiles
messed up opening range the day after a holiday Monday
flaky plotting of the opening range and targets that required page reloading
TradingView problems with starting forex session at 1700 hours EST/EDT when using certain securities eg FX_IDC currently (Jan 2017)

Additions in his code are more options for trading range

Time compensation option for some securities that incorrectly start sessions at 1200 hrs instead of 1700 hrs NY time
- this glitch is likely temporary but present when this script update was created
More opening range time period choices

Opening Range Targets:
Opening Range Targets as per Leaf_West
Targets are set at 127% , 162%, 200 %, 262 %, 362%, 423%, 685%, 1109% and 1794% and this can be traded intraday using methods described here charts-by-leaf.com I also have some Leaf West PDFs that describe how the targets are set and how they are traded. There are others that use opening range.
The Time Session Glitch and the Fix:
The script will correctly default to 1700 hrs to 1700hrs EDT/EST session for FXCM.
Strangely some securities appear to erroneously start their session at 1200 hrs ie. My guess is that they are somehow tied to GMT+0 instead of New York time (GMT+5). See this for yourself by selecting EURUSD using the FXCM exchange (FX:EURUSD) and then EURUSD from the IDC exchange (FX_IDC:EURUSD). The FX-IDC session opening range starts 5 hours
before it actually should at 1700 hrs EDT/EST. To correct for this I have implemented an automatic fix (default) and a user selected "5 hour time shift adjust. ment needed on some securities".
There is also a 4 hour time shift button which might be necessary when New York reverts from Eastern Standard Time
to Eastern Daylight Time (1 hour difference) in March (and then back again in November). In the default auto adjust mode you will need to select the 1 hour time shift. That is if this glitch still exists at that time.
I have looked at other scripts, other than my own and where the script is available, that need to use information about the opening bar and all have the same time shift issue


What are the choices for Opening Range?
The dialogue box offers the standard TradingView options.
Also where you see Pick Opening Range 1 to 12 hours , SET TO 0 To USE LINE ABOVE TO DETERMINE OR LENGTH
As the note says a number other than 0 will override the standard options from the line above
The dialogue box below in offers choices by hours 1 to 12. A number greater than 12 will still only give
720 minutes (12 hours) for the length of Opening Range.

What sessions within the FOREX time-frame are available?
The default is 1700 hours to 1700 hours EST/EDT
Check any one (only one) of the time periods to change the opening range period to suit.
New York opens at 8:00 am to 5:00 pm EST (EDT)
Tokyo opens at 7:00 pm to 4:00 am EST (EDT)
Sydney opens at 5:00 pm to 2:00 am EST (EDT)
London opens at 3:00 am to 12:00 noon EST (EDT)

There is a build your own session (click the button to select)
The two lines for inputting session times are almost identical except that the second line starts the be the same as each other.
The default for the build your own session is 2200 hours to 2200 hours. As of the time of publishing this plots EURUSD FX-IDC just right. The GMT+5 and GMT+4 do not apply to this selection.
See my comments above on this strange aberration.

The script originated from work done by Chris Moody. It has changed significantly but there are remnants of that script lurking within.
Script is free to all - that way you can see what is inside

Cheers Jayy
Информация о релизе:
This script had recently stopped functioning correctly particularly for initiating custom settings such as the London session hours on the emini. This loss of functionality apparently coincided with the release of Pine Script Version 4. I have added a new way of initiating the opening range. I have found an odd issue in that the plot seems to be one full hour out of sync. Therefore I have added the ability to shift the opening range one hour forward or backward. This sort of issue crops up periodically - the script that this replaces had an occasional 4 or 5 hour shift when first published. I would appreciate feedback on any issues you find. I will update as needed.
Pictured here is the London session plotted over the emini (ES1!). I applied a one hour shift forward as per the dialogue box.

Jayy
Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?