Extreme weekend gaps
Forums › ProRealTime English forum › ProOrder support › Extreme weekend gaps
- This topic has 6 replies, 2 voices, and was last updated 3 years ago by Vonasi.
-
-
03/08/2021 at 12:25 PM #163433
Hi Nicolas,
Trying to see if I can figure out what happens on weekend gaps? Battling to define the Friday close and Monday open. Want to use it in a hourly timeframe as a filter to either trade the Monday or not depending on the gap…
Weekend Gap12345678910111213141516171819Timeframe(daily,updateonclose)If dayofweek = 5 Thengapclose = closeElsif dayofweek = 1 Thengapopen = openEndifIf dayofweek = 1 ThenIf (gapopen-gapclose)>100 Thengapweekup=1Elsegapweekup=0EndifEndifTimeframe(default)If gapweekup=1 and Average[5](close) crosses under Average[15](close) ThenSellshort 1 contract at marketEndifSET STOP pLOSS 100SET TARGET pPROFIT 10003/08/2021 at 12:29 PM #163435Strategy code is run at the close of a candle so with UPDATEONCLOSE your strategy cannot know until the close of a daily candle what the open value was for that candle – so you will need to use a faster time frame or DEFAULT if you want to catch the Monday opening price and place orders based on it at the market open.
03/08/2021 at 1:04 PM #163439Thanks Vonasi,
I tried the following on the hourly tf…but it does not register the Friday close and Monday open correctly any suggestions?
Weekend Gap123456789101112If dayofweek = 5 and time = 230000 Thengapclose = closeElsif dayofweek = 1 and time = 10000 Thengapopen = openEndifIf dayofweek = 1 and time = 10000 ThenIf (gapopen-gapclose)>100 Thengapweekup=1Elsegapweekup=0EndifEndif03/08/2021 at 1:13 PM #16344303/08/2021 at 1:52 PM #163448A candle can be identified by two reference times.
TIME = the closing time of the candle (which is also the same as the opening time of the following candle).
OPENTIME = the opening time of the candle (which is also the same as the closing time of the previous candle).
So the hourly candle that opens at 010000 will close at 020000 and can be referenced as either OPENTIME = 010000 or TIME = 020000
It is similar with OPENDAYOFWEEK and DAYOFWEEK.
1 user thanked author for this post.
03/09/2021 at 10:20 AM #163571Hi Vonasi, thought I had did but I just don’t seem to get it right for the code to take the close on a Friday at 230000 and compare it to the open on the Monday at 10000. Any suggestions either as a indicator or strategy on a hourly timeframe?
03/09/2021 at 4:00 PM #163632If you add this indicator to your chart it can help to clarify things:
1return opendayofweek as "opendayofweek", dayofweek as "dayofweek", time as "time", opentime as "opentime"It would appear that the candle that closes at 010000 is classified as opening at 000000 on Sunday. So you should be looking for dayofweek = 0 and time = 10000.
1 user thanked author for this post.
-
AuthorPosts