Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SystemPerformance.AllTrades not usable while running the strategy not in Chart.

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

    SystemPerformance.AllTrades not usable while running the strategy not in Chart.

    obviously I have an option to run the strategy by defining it in the Strategy tab of the control center without actually having the chart open and the strategy attached to it.
    I also have in my strategy a mechanism that changes the position qty based on the statistics of previous trades.
    I use the SystemPerformance.AllTrades to get the data of the previous trades.
    all is working well while the strategy is running on a chart, but if its running standalone , I don't get the data of the previous trades.
    I specifically load 50 days of data while defining the strategy , so in principle I should have historical trades the same way I do while running on the chart.

    Is this something known ?

    Or I really have some incorrect usage in my code ? in which case i will digg dipper .
    thanks for helping

    #2
    Hello dadarara,

    Thank you for your post.

    There is a strategy property called IncludeTradeHistoryInBacktest that is defaulted to true except for when a strategy is running on the Strategies tab of the Control Center. You will need to programmatically set this property to true in State.SetDefaults to include the trade history and have access to SystemPerformance.AllTrades when running the strategy from the Strategies tab:


    Once you have made this change, compile the script and then remove and re-add the strategy to the Strategies tab to pickup the changes.

    Please let us know if we may be of further assistance.

    Comment


      #3
      exactly what I needed ,,
      thanks

      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
      21 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
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X