No Trade on First Friday in Month and on each Thursday afternoon

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13150 quote
    Bolu14
    Participant
    New

    Hello,

    i try to build an Strategy System to trade the sideway Times on Market. So i need a code to avoid trade on the First Friday in Month (NFP Non Farm Payrols) and on each Thursday Afternoon, because there are many news so the market is trendy.

    My Code was:

    IF (CurrentDayofWeek = 5 and Date <= 07 and Hour >= 12) THEN
    …..
    ENDIF

    IF (CurrentDayofWeek = 4 and Hour >= 12) THEN
    …..
    ENDIF

    The second part, it seems, thats runs, but the first part does not run. There the system avoid on every Friday after 12 o`clock a trade. But it should do only on the first Friday in month. I think the Part “and Date <= 07” does not run.

    How can i realise this?

    Thanks.

    #13152 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    “Date” format is year and month and day, so date<=7 wouldn’t do what you want. You probably want to use “day” instead.

    Also, currentdayofweek is litterally the current one, so it wouldn’t work in historic data, you probably want to use dayofweek instead.

    Coding example for singling out the NFP day can be found in the following topic:

    http://www.prorealcode.com/topic/how-to-halt-strategy-during-high-volatility-news/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

No Trade on First Friday in Month and on each Thursday afternoon


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Bolu14 @bolu14 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JC_Bywan
9 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/15/2016
Status: Active
Attachments: No files
Logo Logo
Loading...