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

Create new Bar type

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

    Create new Bar type

    Hi,
    I want to develop custom bars type. I want to modify the bundled renko for additional calculation. I found the barstype file at
    "~Documents\NinjaTrader 8\bin\Custom\BarsTypes\@RenkoBarsType.cs"
    Please help me by answering following questions.
    1) Can I modify replica of the file in the same folder and keep both (original and modified) running?
    2) Can I reference indicator in the file?
    3) Do I need to modify any other file except this file?
    4) Where can I find file where renko data is saved created by the modified bartype (for historical bars reference)?
    5) I searched and found https://ninjatrader.com/support/foru...r-please/page2 comment #18 The given renko file generates renko from the instant it is applied but historical bars are not available on chart. Can you suggest what component/ reference is missing in it?

    #2
    Have you downloaded and studied the UniRenko bar type?

    Comment


      #3
      Hello vkrmvv,

      1) Can I modify replica of the file in the same folder and keep both (original and modified) running?
      Yes you can use the existing types as a starting point. The easiest way is to generate a new BarsType using the NinjaScript editor, that will generate a new ID in the types OnStateChange. From there you could open one of the existing types and do a Right click -> Save AS. Copy the ID from the new type you created into the file you generated from the Save AS then delete the new type you created.
      2) Can I reference indicator in the file?
      Indicators cannot be used in a BarsType.

      3) Do I need to modify any other file except this file?
      A BarsType is contained in a single file, the only other item wich may be relevant would be a ChartStyle if you need to display the bars in a custom way.

      4) Where can I find file where renko data is saved created by the modified bartype (for historical bars reference)?
      The BarsTypes don't create data files generally, the type will calculate point by point to generate bars.

      5) I searched and found https://ninjatrader.com/support/foru...r-please/page2 comment #18 The given renko file generates renko from the instant it is applied but historical bars are not available on chart. Can you suggest what component/ reference is missing in it?
      I couldn't really suggest anything here, potentially you are missing historical tick data? If you are using the script from that post and seeing a problem I would suggest to provide those details in that post.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        Hello vkrmvv,


        Yes you can use the existing types as a starting point. The easiest way is to generate a new BarsType using the NinjaScript editor, that will generate a new ID in the types OnStateChange. From there you could open one of the existing types and do a Right click -> Save AS. Copy the ID from the new type you created into the file you generated from the Save AS then delete the new type you created.
        Indicators cannot be used in a BarsType.


        A BarsType is contained in a single file, the only other item wich may be relevant would be a ChartStyle if you need to display the bars in a custom way.


        The BarsTypes don't create data files generally, the type will calculate point by point to generate bars.


        I couldn't really suggest anything here, potentially you are missing historical tick data? If you are using the script from that post and seeing a problem I would suggest to provide those details in that post.
        Thanks for the reply. It's very helpful. I also want to reference 1 minute dataseries of the same instrument to find ATR and some other calculations. But in Ninjascript guide I found that AddDataSeries(Data.BarsPeriodType.Minute, 1) can only be used in State.Configure. But the calculations and bar formation is done prior to State.Configure. So the bars formed will be irrelevant. Could you tell me
        1) If I can reference another bar type (1 minute candlestick data) or MinuteBarsType in or before OnDataPoint()? How to declare and in which method?
        2) If there are any other ways and resources that could save my time to write another method which are readily available in Ninjascript to shorten my code, could you share that?

        Comment


          #5
          Hello vkrmvv,

          AddDataSeries is only for Indicators and strategies, for a BarsType you cannot reference other pre calculated data. If you need 1 minute bars in a BarsType you would have to calculate 1 minute bars in the BarsType logic. A BarsType is generally only able to use a single series, you would not necessarily be able to make a dual period type because it only has a single set of properties to return its bars.

          If you need multiple timeframes then the best bet is to use a indicator or strategy and then use OnRender if you need custom visualization of the data.


          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Perr0Grande, Today, 08:16 PM
          0 responses
          2 views
          0 likes
          Last Post Perr0Grande  
          Started by elderan, Today, 08:03 PM
          0 responses
          4 views
          0 likes
          Last Post elderan
          by elderan
           
          Started by algospoke, Today, 06:40 PM
          0 responses
          10 views
          0 likes
          Last Post algospoke  
          Started by maybeimnotrader, Today, 05:46 PM
          0 responses
          9 views
          0 likes
          Last Post maybeimnotrader  
          Started by quantismo, Today, 05:13 PM
          0 responses
          7 views
          0 likes
          Last Post quantismo  
          Working...
          X