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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    173 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    91 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    130 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    209 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    186 views
    0 likes
    Last Post CarlTrading  
    Working...
    X