Code for avoiding the NFP
Forums › ProRealTime English forum › ProOrder support › Code for avoiding the NFP
- This topic has 6 replies, 2 voices, and was last updated 5 years ago by
nonetheless.
-
-
04/19/2020 at 10:47 AM #126849
If I wanted to suspend a bot before and after the Non-farm Payroll announcement each month, would the following suffice?
The dates are correct for the coming months, but I don’t know how far in advance they are published. Is there any way to specify the first friday of each month indefinitely?
12345678910111213//avoiding NFP (where Ctime is an entry condition)if DATE[20200508] and time >= 130000 and time <140000 thenCtime = 0endifif DATE[20200605] and time >= 130000 and time <140000 thenCtime = 0endifif DATE[20200702] and time >= 130000 and time <140000 thenCtime = 0endif04/19/2020 at 10:52 AM #126851Try this
12345If Day<8 and DayOfWeek=5 thenNfp=1ElseNfp=0Endif1 user thanked author for this post.
04/19/2020 at 11:04 AM #126855Ottima! I assume you mean to define the Nfp time elsewhere, in addition to this?
04/19/2020 at 11:15 AM #126858Maybe you can try to add the time range there (used your times)
12345678910noEntryBefore = 140000timeEnterBefore = time > noEntryBeforeTimenoEntryAfter = 130000timeEnterAfter = time < noEntryAfterTimeIf Day<8 and DayOfWeek=5 and timEnterBefore and timeEnterAfter thenNfp=1ElseNfp=0Endif04/19/2020 at 11:37 AM #126862Yes, something like that should work, with Nfp as an entry condition.
“If Day<8 and DayOfWeek=5″ is the crucial part that I couldn’t get my head around. Should work in the majority of cases although I just saw that this year the December figures weren’t released until Jan 10. Apart from that it should almost always be Day<8
Thanks!
04/19/2020 at 12:32 PM #12687604/19/2020 at 12:58 PM #126881Yeah, as far as I can see the dates are published for the whole of each calendar year so doing it manually wouldn’t involve too much effort. Prob the only way to be sure of catching it every month.
Not such an issue with longer TFs but the wild movements that usually occur could wreak havoc with short TF scalping bots.
-
AuthorPosts
Find exclusive trading pro-tools on