Ignore sunday bar
Forums › ProRealTime English forum › ProOrder support › Ignore sunday bar
- This topic has 22 replies, 5 voices, and was last updated 7 years ago by
Derek.
-
-
08/15/2017 at 10:12 PM #4322408/15/2017 at 10:22 PM #4322708/15/2017 at 10:59 PM #43230
This seems to be the good one (on Eur/Usd, DAILY, on Dax it still opens trades on Sunday, occasionally):
12345678910111213Defparam cumulateorders = false// LongIF CurrentDayOfWeek = 4 AND close < open THEN //On Friday we test Thursday's closeBuy 1 contract at market //and a new trade should be opened immediately (onENDIF //Friday).// ShortIF CurrentDayOfWeek = 0 AND close[1] > open[1] THEN //On Monday we need to test the Fridays'closure, sincesellshort 1 contract at market //there is Sunday in the middle.ENDIF//GRAPH CurrentDayOfWeek AS "cDoW"// Stop e target in pipsSET TARGET pPROFIT 75SET STOP pLOSS 35The strategy tests Thursday to open a new trade on Friday and Friday (on Sunday BAR) to open a new trade on Monday, if conditions are met.
1 user thanked author for this post.
08/16/2017 at 10:41 AM #43244When testing daily bar, you should use OpenDayOfWeek
2 users thanked author for this post.
08/16/2017 at 11:20 AM #43253Still Nicolas, I need to know some (unknown to me) details: “when are DayOfWeek, CurrentDayOfWeek and OpenDayOfWeek best used?”.
Because, as you can see from the screenshot (EurUsd daily), on Thursday DoW is 5 while the other two are both 4, on Friday all the three retain value 5 and on Monday DoW is 2 while the other two are both 1. It appears that DoW is always one day ahead, but on Friday! What’s the logic behind this?
08/20/2017 at 7:29 PM #44256Hello robertogozzi,
take a look a the attached screenshot for this code:
12345dow = DayOfWeekCDow = CurrentDayOfWeekODow = OpenDayOfWeekreturn dow as "dow", CDow as "CDow", ODow as "ODow"“CDow” is always referring to the same day which is Friday and not the actual Sunday of the day when I took the screenshots. Trying CDow on a IG Market that actually trades on Sundays did not change the observation.
Dow” is counting from 1 on Sundays to 5 on Thursday and remains 5 on Friday.
ODow is working properly.
I guess this helps to decide which function to use.
08/20/2017 at 7:36 PM #44259The good news is: All three are working fine on the intraday timerframes. The screenshot shows an hourly t-bond futures chart.
Here currentdayofweek switches to the new day faster. The rest of the day currentdayofweek and opendayofweek are identical,
08/21/2017 at 5:53 PM #44321And I have to correct myself:
On intraday timeframes currentdayofweek works just the same as on longer timeframes.
It’s dayofweek that switches to the new day on the first intraday bar. Openday of week waits for the first bar to close, before returning the next day’s value.
Sorry for the confusion.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on