Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to check if the current trading date

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

    How to check if the current trading date

    I want to run a check with my strategy. I want to make an if statement that checks to see if today's date is later than 1/20/2022, if so return true, else, false and disable strategy.

    Could you help me with this?

    #2
    Hello digo098,

    Code:
    if (Core.Globals.Now >= new DateTime(2022, 1, 20))
    {
    }
    else
    {
    CloseStrategy();
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Can you use the strategy name, it's calling for a string when I try this.

      Comment


        #4
        Hello Conceptzx,

        Thanks for your notes.

        The CloseStrategy() method has a string signalName parameter that would be passed in. A signalName is used for entry/exit orders, and this is not the strategy name.

        From the CloseStrategy() help guide:

        The signalName will be used to identify the closing order. If no signal name exists or is null, "Close" will be substituted instead.

        See the help guide documentation below for more information and sample code.

        CloseStrategy(): https://ninjatrader.com/support/help...=CloseStrategy
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        63 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X