Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding Daily Profit/Loss to existing strategy from NinjaTrader Ecosystem

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

    Adding Daily Profit/Loss to existing strategy from NinjaTrader Ecosystem

    Hello,

    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

    https://ninjatraderecosystem.com/use...-autotrendh-2/

    Any help would be greatly appreciated.

    #2
    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: https://ninjatrader.com/support/help...?tutorials.htm

    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: http://ninjatrader.com/support/helpG..._resources.htm

    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: http://ninjatrader.com/support/helpG...ng_changes.htm

    Other users have written in about this information in our support forums here: https://ninjatrader.com/support/foru...d.php?p=488807

    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: https://www.youtube.com/watch?v=HCyt90GAs9k

    NinjaScript Editor 401: https://www.youtube.com/watch?v=K8v_2ONBbqI

    You can register for live webinars here: https://ninjatrader.com/PlatformTraining

    Our documentation will be your best friend while developing, and the complete supported NinjaScript interface can be referenced here: http://ninjatrader.com/support/helpGuides/nt8/en-us/

    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: https://ninjatrader.com/support/help...?cumprofit.htm 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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by lmatiukas, Today, 07:09 PM
    0 responses
    3 views
    0 likes
    Last Post lmatiukas  
    Started by ComfyCouch, Today, 06:04 PM
    0 responses
    12 views
    0 likes
    Last Post ComfyCouch  
    Started by Ousher, Today, 04:35 PM
    0 responses
    4 views
    0 likes
    Last Post Ousher
    by Ousher
     
    Started by Rugosoft, 11-17-2020, 08:22 AM
    3 responses
    38 views
    0 likes
    Last Post Shansen
    by Shansen
     
    Started by hpolthof, Today, 03:48 PM
    0 responses
    7 views
    0 likes
    Last Post hpolthof  
    Working...
    X