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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      144 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      71 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      125 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      79 views
      0 likes
      Last Post PaulMohn  
      Working...
      X