Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I clear the Max Consecutive Loser/Winner?

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

    How do I clear the Max Consecutive Loser/Winner?

    I'm using a sim101 account. I'm printing the max consecutive losers. Even though I've reset the sim acct several times, it still says that the max consecutive loser is '4' in the Output window.

    ALSO, when I run my method call "CheckForLoserCount();" It places a long trade at candle close. I have no logic that tells the strategy to place any trade. I want it to close the strategy.


    Code:
    Print(SystemPerformance.AllTrades.TradesPerformance.MaxConsecutiveLoser);
    
    
    private void CheckForLoserCount()
    {
            if (SystemPerformance.AllTrades.TradesPerformance.Max ConsecutiveLoser == LoserCount)
           {
                 CloseStrategy("StochMomentumStrat");
    
                /* if (PositionAccount.MarketPosition == MarketPosition.Long && PositionAccount.Quantity == ContractAmount)
                   {
                         ExitLong(ContractAmount);
                         CloseStrategy("StochMomentumStrat");
                   }
    
                  else if (PositionAccount.MarketPosition == MarketPosition.Short && PositionAccount.Quantity == ContractAmount)
                  {
                          ExitShort(ContractAmount);
                         CloseStrategy("StochMomentumStrat");
                   }*/
          }
    }

    #2
    Hello jamestrader21x,

    Thank you for your post.

    Could you provide a reduced example strategy that demonstrates this behavior?

    CloseStrategy would be expected to submit an order to close a position if the strategy thinks one is open. Are any manual trades being taken on the same instrument and account while the strategy is running, or are any other strategies running on the same account and instrument combination?

    Thanks in advance; I look forward to assisting you further.

    Comment

    Latest Posts

    Collapse

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