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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    156 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    90 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    140 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    130 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X