Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Trades being counted prior to strategy being enabled . . .

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

    Trades being counted prior to strategy being enabled . . .

    I have a Strategy that is set to only place trades during specific times and limits the number of trades per day. I have found that when I start the strategy after
    the scheduled start time that when the strategy is enabled that if the strategy would have placed orders prior to when it was started that it counts those trades
    as real trades.

    How do I get around this?

    #2
    Hello ATMtrader0001,

    Thanks for your post.

    If you are using your own trade counter variable, you could use a bool that you create and set to true by default and compare that bool along with comparing the State to State.Realtime and when both are true to then reset your trade counter and set the bool to false to prevent further resets. For example:

    if (State == State.Realtime && myBool)
    {
    myTradeCounter = 0; // reset for real time
    myBool = false; // prevent further resets
    }

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Paul,

      As always, thank you. You are a wealth of knowledge.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by llanqui, Today, 10:29 AM
      0 responses
      2 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by llanqui, Today, 08:32 AM
      1 response
      8 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by lollers, Yesterday, 03:26 AM
      1 response
      53 views
      0 likes
      Last Post lollers
      by lollers
       
      Started by Salahinho99, 05-05-2024, 04:13 AM
      7 responses
      62 views
      0 likes
      Last Post Salahinho99  
      Started by knighty6508, 05-10-2024, 01:20 AM
      4 responses
      30 views
      0 likes
      Last Post knighty6508  
      Working...
      X