Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Script to tell a strategy not to trade during certain hours

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

    Script to tell a strategy not to trade during certain hours

    As part of an IF statement in a strategy, is it possible to instruct the strategy to not look for trades during certain hours. Essentially the code would still be enabled, but the script would instruct it not to trade.

    I'm working a forex strategy, and I don't want the strategy to trade between 3:50pm - 5pm CDT. Is it possible to write something like this into the code?

    #2
    Hello CMillz,

    Yes, this would be possible using a time filter. You could say, if time was outside of this range, return;

    Please see the following reference example,


    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    34 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X