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

Clock

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

    Clock

    Hello, first I apologize for my English, I have helped myself with the Google translator.
    I would like someone's help to program an indicator, to show me the duration of the open trade, that is, how much time has elapsed since the opening of the trade.
    It must be live, that is, count the time as long as the trade is open, when you close the trade, stop counting. Thank you.

    #2
    Hello lordv,

    Thank you for your post.

    This would be possible in a custom strategy; however, If you want to use an indicator to do this for manual orders that wouldn't be supported.

    You could get the time stamp of when the orders are submitted and then track how long its been since then for a strategy.

    Here is a reference sample on using DateTime objects: https://ninjatrader.com/support/foru...bjects?t=19292

    You may also want to take a look at the code for the BarTimer indicator that comes built in with the platform. You can open this code in a NinjaScript Editor window.

    While we on the Scripting Support team cannot create, modify or debug a script for you, we can offer general guidance and educational resources.

    We do have resources to help you begin creating NinjaScript Strategies/Indicators. All links below are publicly available.

    The best way to begin learning NinjaScript is to use the Strategy Builder. With the Strategy Builder you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.

    I'm also providing a link to a pre-recorded set of videos 'Strategy Builder 301' and 'NinjaScript Editor 401' for you to view at your own convenience.

    Strategy Builder 301
    NinjaScript Editor 401

    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our NT7 help guide first:

    Basic Programming Concepts

    For general C# education I have personally found Dot Net Perls to be a great reference site with easy to understand examples.

    Browse examples for many languages, with explanations and code side by side for easy understanding.


    We also have great resources in relation to Strategy Development on our Support Forum. There is a very active developer community in our support forum that supplements the responses provided by NinjaTrader support staff providing all users with an exceptional support experience.

    Take me to your support forum!

    There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under New -> NinjaScript Editor -> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)
    We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:

    Click here to see our NinjaScript Reference Samples
    Click here to see our NinjaScript Tips

    These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

    Also, below I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript.



    Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.

    Alphabetical Reference

    And our Educational Resources in the NinjaTrader 8 help guide.

    Educational Resources

    A set of specific tutorials for creating conditions in the NinjaTrader 8 Strategy Builder in the NinjaTrader 8 help guide.

    Condition Builder

    You can also contact one of our professional NinjaScript Consultants or Educators who would be eager to create or modify this script at your request or assist you with your script. Please let me know if you would like a list of professional NinjaScript Consultants or Educators who would be happy to create or modify any script at your request or assist you in learning NinjaScript.

    Please let me know if I may be of further assistance.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you NinjaTrader_Kate, Your detailed response has helped me out!

      Cheers!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by RookieTrader, Today, 09:37 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by kulwinder73, Today, 10:31 AM
      0 responses
      5 views
      0 likes
      Last Post kulwinder73  
      Started by terofs, Yesterday, 04:18 PM
      1 response
      23 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by CommonWhale, Today, 09:55 AM
      1 response
      4 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
       
      Working...
      X