Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issues following the script example for SystemPerformance

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

    Issues following the script example for SystemPerformance

    Hi guys, I'm pretty new to developing and am having trouble using the example from:


    For example, I am trying to practice developing by creating a basic indicator that displays my daily and weekly PNL on the chart. But, whenever I use:

    protected override void OnBarUpdate()
    {
    // Check if it's a new day
    if (Time[0].Date > lastDailyReset)
    {
    dailyProfitLoss = SystemPerformance.AllTrades.TradesPerformace.Gross Profit;
    dailyPNL = dailyProfitLoss; //Set daily PNL for the new day
    lastDailyReset = Time[0].Date;
    }
    }

    I end up getting CS0120 error. Am I supposed to create a reference to SystemPerformace?
    I'm really confused so if anyone could help I would greatly appreciate it. ​

    #2
    Hello drewclass34,

    The sample you are viewing is a strategy sample, that code can only be used in a strategy.

    Indicators don't have any associated account or know about trades or account values by default. You can use the addon framework to monitor live account values from an indicator but it would not be the same as the strategies performance values which represent the isolated trades of that individual strategy.

    To use the system performance values you would need to develop a strategy that places trades so it can populate its performance and then use that code in that strategy.

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