No announcement yet.

Partner 728x90


Adding Daily Profit/Loss to existing strategy from NinjaTrader Ecosystem

  • Filter
  • Time
  • Show
Clear All
new posts

    Adding Daily Profit/Loss to existing strategy from NinjaTrader Ecosystem


    I am very new to coding and wanted to add a daily profit/loss target to a strategy that is in the NinjaTrader ecosystem. The link is below

    Any help would be greatly appreciated.

    Hello albert852,

    Thanks for your post and welcome to the NinjaTrader forums!

    The strategy is written in Ninjascript which is based on C# programming language. If you are unfamiliar with both of these we highly recommend that you become familiar before attempting major changes to scripts. To that end, we can provide references to help get you started learning Ninjascript however we do not provide step-by-step assistance nor do we provide programming services.

    NinjaScripts are built on C#. While we do not provide programming education services in the Support Department, there are a vast number of educational C# resources external to NinjaTrader and we do have some tutorials and tools that can assist in the learning process.

    Many users report that a good way to start before fully learning C# is to go through the NinjaTrader 7 NinjaScript tutorials in the help documentation to get a fundamental grasp on .NET framework and how it is used in NinjaScript. From there I suggest looking at the Code Breaking changes for NinjaTrader 8 to understand the differences between NinjaTrader 7 and NinjaTrader 8.

    You can view the tutorials for NinjaTrader 7 here:

    Although we do not currently provide NinjaScript tutorials like in NinjaTrader 7, we do provide in-depth help documentation on developing NinjaScripts for NinjaTrader 8. We also provide samples and a complete reference of the language. More in-depth educational resources can be found elsewhere throughout the internet.

    You can find the educational resources here:

    Once you have a basic understanding of C#, I suggest following the documented Code Breaking changes between NinjaTrader 7 and NinjaTrader 8. This page also gives an overview for NinjaScripts in NinjaTrader 8.

    You can find the Code Breaking changes here:

    Other users have written in about this information in our support forums here:

    Also available are webinars on the NinjaScript editor and the Strategy Builder. The Strategy Builder can be used to generate NinjaScript syntax for NinjaScript strategies. You may wish to create a strategy and clicking View Code after each piece of logic created in the Builder to observe the generated syntax.

    Strategy Builder 301:

    NinjaScript Editor 401:

    You can register for live webinars here:

    Our documentation will be your best friend while developing, and the complete supported NinjaScript interface can be referenced here:

    The information above is publicly available.

    Finally, we also have a vast EcoSystem of NinjaScript Consultants that would be happy to write or modify any NinjaScript at your request. If those services interest you, we can have a representative of our EcoSystem reach out with more information.

    Here is a link to the help guide section that would relate to obtaining the strategy PNL: In a strategy the PNL naturally accumulates for the duration of the strategy. If you apply the strategy to a chart with 5 days of data, your strategy will perform historical trades and will accumulate PNL over each day. You would need to create a double type variable to hold the accumulated PNl at the beginning of each trading session so your daily PNL would be the SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit minus the value you saved at the beginning of the session.

    Paul H.NinjaTrader Customer Service


    Latest Posts


    Topics Statistics Last Post
    Started by lmatiukas, Today, 07:09 PM
    0 responses
    Last Post lmatiukas  
    Started by ComfyCouch, Today, 06:04 PM
    0 responses
    Last Post ComfyCouch  
    Started by Ousher, Today, 04:35 PM
    0 responses
    Last Post Ousher
    by Ousher
    Started by Rugosoft, 11-17-2020, 08:22 AM
    3 responses
    Last Post Shansen
    by Shansen
    Started by hpolthof, Today, 03:48 PM
    0 responses
    Last Post hpolthof