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

Custom Bars Type

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

    Custom Bars Type

    Hello, I was looking for some insight as to how I would add a custom BarType to my dropdown. I'm typing to create a Renko bar type that has the Open at the previous bars Close, and the size of the Renko's are a % of the total price instead of a set renko brick size. I used it successfully back in NT7 but am having issues migrating it to 8. The error that keeps returning is "Multiple Bartypes with the same BarsPeriodType were found. Ignoring NinjaTrader.NinjaScript.BarsTypes.RenkoBarsType" I imagine that is because I'm not updating the enum to make this its own bar type but I'm not sure.

    Attached is the NT7 version that worked successfully and the NT8 version that's causing issues.

    RaddiRenkoCrypto2BarsType.cs
    RaddiRenkoCrypto8BarsType.cs

    Any insight would be appreciated.

    #2
    Hello magnatauren,

    Thank you for the post.

    You are correct about the error, if you make a new bars type you need to define a custom ID. The most simple way to make a new id is to use the NinjaScript editor -> Right click on BarsType folder and click new BarsType. Click Generate and then check the OnStateChange for the ID generation code. You can delete this file after you copy the syntax. Its just:

    Code:
    BarsPeriod                                    = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 16, Value = 1 };
    The 16 in this code is the id, that would be any unique integer that's not taken. You can just use a random longer number like 102934.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      That was exactly it. Thankyou!

      Comment


        #4
        Originally posted by magnatauren View Post
        That was exactly it. Thankyou!
        Please, could you post a screenshot of your RaddiRenkoCrypto8BarsType and a typical setting ? Is the chart designed for "Cryptos" only ?

        Omololu
        Last edited by omololu; 07-13-2020, 11:00 PM.

        Comment


          #5
          Originally posted by omololu View Post

          Please, could you post a screenshot of your RaddiRenkoCrypto8BarsType and a typical setting ? Is the chart designed for "Cryptos" only ?

          Omololu
          Sure, attached is the updated version, it's a renko type that's bases each bar on the current price and adjusts itself to change the renko brick size to a percentage of the current price. 1000 is my default setting since that basically says each renko is 1% of the price, but If I were running it on forex I'd run that somewhere closer to 20.(since I use 50-1 leverage in forex)

          It's not finished but it's working. I still get issues where it will fill in bars with 0 volume during gaps where i'd rather it gap instead. If anyone has an idea of how to get it to gap if the close is greater than 3 standard bricks(or 1 and a half reversal bricks) that would be amazing and would really help me out.

          In the screenshot below of KODK this week you can see earlier in the day the bricks were smaller and more numerous while it was beginning its breakout but as it moved through the day the bricks became larger. At 6:11 you can actually see a change in brick size. This helps me in 2 ways, it allows me to backtest, and trade on 2 things with vastly different prices as if they were the same, and it also allows me to gauge how much is left in whatever breakout run may be occurring.

          Click image for larger version

Name:	RaddiRenkoSnip.PNG
Views:	936
Size:	180.7 KB
ID:	1112455

          Comment


            #6
            Thanks for this latest version. I'll give it a study.

            Omololu

            Comment


              #7

              magnatauren,

              Please, what chart setting do you recommend for Crude Oil (CL), Nasdaq (NQ) and Dow (YM) futures.

              Regards.

              Omololu

              Comment


                #8
                The same rules would apply, RaddiRenko is designed to behave the same on every instrument. The size of the bricks change based on the price vs the % of the current price you want it to move before forming a brick.

                That's what is unique about it, it's a renko that changes its brick size without you needing to change anything yourself.

                Comment


                  #9
                  Originally posted by magnatauren View Post
                  The same rules would apply, RaddiRenko is designed to behave the same on every instrument. The size of the bricks change based on the price vs the % of the current price you want it to move before forming a brick.

                  That's what is unique about it, it's a renko that changes its brick size without you needing to change anything yourself.
                  Mag,

                  I don't seem to be getting the same chart experience on CL(Crude Oil), such as yours on KODK(a Stock instrument, I suspect). Could you please post a screenshot of CL(Crude Oil).

                  Regards.

                  Omololu

                  Comment


                    #10
                    Originally posted by magnatauren View Post

                    Sure, attached is the updated version, it's a renko type that's bases each bar on the current price and adjusts itself to change the renko brick size to a percentage of the current price. 1000 is my default setting since that basically says each renko is 1% of the price, but If I were running it on forex I'd run that somewhere closer to 20.(since I use 50-1 leverage in forex)

                    It's not finished but it's working. I still get issues where it will fill in bars with 0 volume during gaps where i'd rather it gap instead. If anyone has an idea of how to get it to gap if the close is greater than 3 standard bricks(or 1 and a half reversal bricks) that would be amazing and would really help me out.

                    In the screenshot below of KODK this week you can see earlier in the day the bricks were smaller and more numerous while it was beginning its breakout but as it moved through the day the bricks became larger. At 6:11 you can actually see a change in brick size. This helps me in 2 ways, it allows me to backtest, and trade on 2 things with vastly different prices as if they were the same, and it also allows me to gauge how much is left in whatever breakout run may be occurring.
                    Hello,

                    I'm trying to create a custom Renko bar as well. By any chance have you completed the code? I'm wanting to have the bars like below.

                    Many Thanks, Caesar.

                    Click image for larger version

Name:	Screenshot 2022-10-06 131630.jpg
Views:	407
Size:	18.6 KB
ID:	1218393

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by frankthearm, Today, 09:08 AM
                    5 responses
                    14 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    43 views
                    0 likes
                    Last Post jeronymite  
                    Started by yertle, Today, 08:38 AM
                    5 responses
                    15 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by adeelshahzad, Today, 03:54 AM
                    3 responses
                    19 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by bill2023, Yesterday, 08:51 AM
                    6 responses
                    27 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Working...
                    X