Announcement

Collapse
No announcement yet.

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
    }

    Comment


      #3
      Paul,

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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      48 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      38 views
      0 likes
      Last Post CarlTrading  
      Working...
      X