• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


OHLC times

  • Filter
  • Time
  • Show
Clear All
new posts

    OHLC times

    In NT7, is it possible to get the times at which the last bar made its open, high, low, and close? How about those times N bars back? Or an average of, say, C - O? Once I have these numbers, there are many studies I would like to make, but so far I can't get by this first step. It seems there must be a way to do it in C#, but that is even farther out of this non-coder's reach.


    Hello PBreen,
    Thanks for your post.

    There would not be a simple NinjaScript method or property to give you the time of the OHLC. You would need to do this with your won custom logic. You can get the timestamp of the current bar using Time[0]. You can get an average of the current Close-Open by doing (Close[0]-Open[0])/2

    Perhaps using multiple time frames could be helpful here. Either way I suggest familiarizing yourself with the basic NinjaScript items as you have a few concepts that need to be implemented here. Let me know if you would like some training materials.

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
    Josh G.NinjaTrader Customer Service


      Many thanks. I thought that was the case, but it seemed worth making sure I had not missed something.

      It's not the average values I need, thanks, but Time[C[n]] - Time[O[n]]. Looks like I will have to learn C# coding or buy some time from someone who already knows how to do it.

      As for training materials, yes, definitely. The answer to that question is always affirmative, no matter the topic.

      Thanks again.




        If you would like to take on learning NinjaScript, we have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.
        A link to our Help Guide with set of specific tutorials for creating conditions in the NinjaTrader 8 Strategy Builder in the NinjaTrader 8 help guide:

        The entire Alphabetical Reference can be found with the following link:

        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 proving 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 - https://www.youtube.com/watch?v=HCyt...We0Nf&index=10
        NinjaScript Editor 401 - https://www.youtube.com/watch?v=BA0W...ZmVnauWXkWe0Nf

        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 help guide first:

        I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript:

        We also have a few tutorials in our NinjaTrader 7 help guide for both Indicators and Strategies.

        You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
        Click here to see our NinjaScript Reference Samples: http://www.ninjatrader.com/support/f...splay.php?f=30
        Click here to see our NinjaScript Tips: http://www.ninjatrader.com/support/f...ead.php?t=3229

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

        As always feel free to ask any other questions you may have.
        Josh G.NinjaTrader Customer Service


          Thanks again.



          Latest Posts


          Topics Statistics Last Post
          Started by emuns, Today, 12:00 PM
          0 responses
          1 view
          Last Post emuns
          by emuns
          Started by smf2005, Today, 11:51 AM
          0 responses
          Last Post smf2005
          by smf2005
          Started by cpabiz20k, Today, 11:45 AM
          0 responses
          Last Post cpabiz20k  
          Started by NtFan, Today, 11:00 AM
          3 responses
          Last Post NinjaTrader_PatrickG  
          Started by Bionian, Today, 11:29 AM
          0 responses
          Last Post Bionian
          by Bionian