Wont BUY First day of month if its a Monday
Forums › ProRealTime English forum › ProOrder support › Wont BUY First day of month if its a Monday
- This topic has 6 replies, 5 voices, and was last updated 3 years ago by Nicolas.
Tagged: last day
-
-
01/10/2021 at 4:16 AM #157164
Wont BUY First day of month if its a Monday
I noticed inconsistent proorder behaviour with the following code:
1234567if not longonmarket and month = 11 thenbuy 1 contract at marketendifif month <> 11 thensell at marketendifThe above code is intended to buy the first bar of Nov and sell after month end.
Bug: If the first bar of the month is a Monday, the signal trigger a bar late.
01/10/2021 at 5:47 AM #157167Because Month is the month when a bar closes, while OpenMonth when a bar opens.
So if Oct.31st is when market is closed there’s no bar and the beginning of the next month cannot be detected until the nexr bar closes, that is when the Monday bar closes in this case.
But it would be the same on a, say,Wednesday if the previous day markets were closed.
01/10/2021 at 7:30 AM #157168Not going to be hard for PRT to code that in . Its all known in advance . Just makes a seasonal monthly test inaccurate . i think PRT CAN solve it , its just whether they want to . Anyway now anyone knows buying month = is getting flawed results .
I did note Nicholas wrote a last trading day of month code somewhere before , will see if i can find it . Maybe a first trading day of month companion code can be written
01/10/2021 at 8:46 AM #15716901/10/2021 at 8:55 AM #15717001/10/2021 at 9:24 AM #157171Can anyone suggest 100% working code for how to buy on the open on the first day of the month?
Use MTF to get you on the market at the opening of the 2nd 1 second candle of the month.
1234timeframe (1 second)if openmonth <> openmonth[1] thenbuy 1 contract at marketendifNot tested.
1 user thanked author for this post.
01/11/2021 at 8:47 AM #157269Last day of trading of the month code snippet and explanation can be found here: https://www.prorealcode.com/topic/coding-help/#post-46525
Link to many other useful snippets: https://docs.google.com/spreadsheets/d/1rgboqj7sVwsP9ZRhOduOefye48QMWC07jWVXCl-KJPU/edit#gid=0
-
AuthorPosts
Find exclusive trading pro-tools on