Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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

    This is a conversion of the AutoTrend with Historical and Signaling as originally developed by derekphelps here on the forum. Please refer to the original author for inquiries or comments on the strategy or indicator.


    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 terofs, Yesterday, 04:18 PM
    1 response
    21 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by CommonWhale, Today, 09:55 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by Gerik, Today, 09:40 AM
    2 responses
    7 views
    0 likes
    Last Post Gerik
    by Gerik
     
    Started by RookieTrader, Today, 09:37 AM
    2 responses
    13 views
    0 likes
    Last Post RookieTrader  
    Started by alifarahani, Today, 09:40 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X