Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

News Filter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    News Filter

    I am going to code a news filter but would like some advice on the best way to implement this. I am guessing an indicator that can be called from a strategy, does that sound best?

    So basically using a historical calendar to exclude trading during NFP, FED and possibly other events I will have to code times and dates for these events and set a flag to true at these times.
    i.e. if(ToTime(Time[0]) == 083000){newsFilter == true;}
    and then using something for the actual date of the event.

    From there how do I get flat and exclude the current trade entry based on an upcoming event, i.e. and event that occurs at 8:30 am on Friday (NFP) before that time even if trading on 60 minute timeframe? Specifically looking at ideas pertaining to the times not lining up exactly as I can handle the trade exit and not entering a new trade.

    Ideas are appreciated as I am working on this now as a strategy that avoids the news give very inaccurate performance statistics when testing without filtering these events.

    Cheers - CableTrader007

    #2
    Hello CableTrader007,

    Thank you for your post.

    For real-time you could use DateTime.Now, however in backtesting this would pull the system time instead of a time stamp. So you may wish to add in a secondary time frame to check the Time[0] against, such as a 1 minute bar series.

    To check a certain time before you could use AddMinutes(). For example:
    Code:
    if(ToTime(Time[0].AddMinutes(60)) > = ToTime(83000))
    {
    // current bar timestamp is one hour or less before 8:30 AM
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sjsj2732, 03-23-2026, 04:31 AM
    0 responses
    73 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    313 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    310 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    148 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    111 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X