jayy

Forex session - Opening Range- Jayy fixed updated

jayy Pro+ Telah dikemaskini   
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
Catatan Pelepasan: 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.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?