Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Counters for Winning Trades and Losing Trades

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

    Counters for Winning Trades and Losing Trades

    I would like to add counters to a strategy for winning trades and losing trades.

    I would reset the winning counter when a losing trade occurs and reset the losing counter when a winning trade occurs.

    If someone could explain it to me like I'm 5 years old, that would be greatly appreciated.

    #2
    Below is what I have so far but they do not seem to be counting.

    if (SystemPerformance.RealTimeTrades.Count > 0)
    {
    // Check to make sure there is at least one trade in the collection
    Trade lastTrade = SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count - 1];

    // Calculate the PnL for the last completed real-time trade
    double lastProfitCurrency = lastTrade.ProfitCurrency;

    // Store the quantity of the last completed real-time trade
    double lastTradeQty = lastTrade.Quantity;

    if (lastTrade.ProfitCurrency > 0)
    {
    WinningTrades++;
    }

    else if (lastTrade.ProfitCurrency < 0)
    {
    LosingTrades++;
    }​

    Comment


      #3
      This is how I'm resetting them which may also be the problem.

      priorTrades = SystemPerformance.AllTrades.Count;

      if ((WinningTrades >= 1) && SystemPerformance.AllTrades.Count != priorTrades)
      {
      LosingTrades = 0;
      }

      if ((LosingTrades >= 1) && SystemPerformance.AllTrades.Count != priorTrades)
      {
      WinningTrades = 0;
      }​

      Comment


        #4
        "I would reset the winning counter when a losing trade occurs and reset the losing counter when a winning trade occurs."

        So that would be this if I understand you correctly:
        Code:
        if (lastTrade.ProfitCurrency > 0)
        {
              WinningTrades++;
               LosingTrades = 0;
        }
        
        else if (lastTrade.ProfitCurrency < 0)
        {
              LosingTrades++;
              WinningTrades = 0;
        }​​

        Comment


          #5
          Thanks, I appreciate that. I tried it and it worked.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          556 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X