Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

the account balance in the back test

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

    the account balance in the back test

    I want to adjust the trade quantity based on either the account balance or the realized profit/loss. Here is my code

    Account myAccount = Account.All.First(t => t.Name == "Sim101");
    AcctBalance = myAccount.Get(AccountItem.NetLiquidation, Currency.UsDollar);
    RealizePL = myAccount.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar);

    However, during the back test, the account balance is constant and the realized profit/loss is zero. How to track these two numbers during the back test?​

    #2
    I believe the reason for this is because during a backtest, the account it not named "Sim 101". Mine shows the account is named "Playback101".

    Comment


      #3
      Hello Playdc,

      Thank you for your post.

      There is no account used when backtesting a strategy in the Strategy Analyzer so you will see a value of zero print out when calling Account.Get() on any value.

      This is because there is no backtest account in the Strategy Analyzer to get this information from. The Strategy Analyzer simply runs the strategy on historical data to see how that strategy might have worked on that past data.

      You could consider using the Playback connection which does use an account (Playback101) when testing the script instead. ​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      43 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      65 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X