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

bartype

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

    bartype


    I want to create a bar. It has no tick time but operations. seeing the timesale I see the volumes of every single transaction. I want the transaction bar. how you do it?

    #2
    Hello bebbus, thanks for your note.

    The T&S window gets this info from the OnMarketData method. Overriding this will provide an order type (buy or sell), the quantity, and the volume for every tick of the market.

    Please let us know if we can assist any further.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      I want to create a type of bar. the other platforms have many types of contract and delta bars, etc. here always everything to buy from programmers.

      Comment


        #4
        Hello bebbus,

        Thanks for your reply.

        If you want to create a bar type yourself, please see the help guide here: https://ninjatrader.com/support/help...?bars_type.htm You may want to create the bars type using the Ninjascript wizard to ensure you have the structure needed (unless you want to copy and modify an existing bar type), here is a link to the wizard help guide: https://ninjatrader.com/support/help...?ns_wizard.htm

        Your NinjaTrader8 comes with a number of bars types and their source code is available for you if you want to see what the structure is like through the Ninjascript editor (BarTypes folder).

        Alternatively, if you would rather have this created for you, we can provide references to 3rd party providers of that service.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          have you ever wondered what other platforms do? it is the slowest platform on the market, you don't have the agressor, all the serious things you buy from the programmers you have to forget to be a platform "count bars" the modern trader wants more

          Comment


            #6
            Hello meweini,

            Welcome to the forums.

            Could you let us know what difficulties you are having when creating your custom BarsType so we can provide further insight? The information Paul has provided in post 4 will provide direction for creating a new BarsType and how you can reference the existing BarsTypes to help you in the development process.

            We look forward to assisting.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello,

              Interesting conversation. What is a newbar?
              I am looking to create a simulation from calculations i made.

              Does
              AddBar(bars,open,high,low,close,time,(long)Math.Min(volumeTmp,bars.BarsPeriod.Value));

              would allow me to create new bars beyong the scope of
              ChartBars.ToIndex?

              Lets say i have a for loop that goes from
              ChartBars.FromIndex to
              ChartBars.ToIndex and there is 100 bars but i want to predict the future and need to add 50 bars in the for loop with each containing close and volume, can AddBar do that or its completly unrelated?

              Ty

              Comment


                #8
                Hello frankduc,

                AddBar would not be used in the use case you described, this cannot be used from within an indicator or other script. AddBar is specific to a BarsType and would be unrelated to your description. If you are making a BarsType specifically and your calculation is based solely on the market data, you could execute your plan from there to generate bars as needed. You cannot use indicators from a BarsType so your calculation would need to completely reside in the BarsType if that is what your goal is.

                please let me know if I may be of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  That would be more like a simulation. Lets say i have a for loop: with 100 bars

                  Code:
                  for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
                  I can use highPrice = Bars.GetHigh(barIndex) to get for exemple all the Highs in the for loop.

                  Lets say i want to add 10 bars (those bars dont exist in the chart i create them with my own values i have calculated) to make it 110 bars.

                  If i do
                  Code:
                  [LEFT][COLOR=#4D4D4D][FONT=Helvetica]for ([/FONT][/COLOR][/LEFT][LEFT][COLOR=#4D4D4D][FONT=Helvetica][SIZE=13px]int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex + 10; barIndex++)[/SIZE][/FONT][/COLOR][/LEFT]
                  Will it mean there is 110 bars in my loop?

                  How could i include close and volume for each 10 bars i am adding?

                  TY.

                  Comment


                    #10
                    Hello frankduc,

                    My prior reply still applies to your new statement.

                    Before we continue with any further questions, what is your specific goal and what type of script are you trying to execute that goal from?

                    Are you specifically trying to build a BarsType?

                    AddBar only relates to a BarsType, if you are not making a BarsType your question is not relevant to this post. The loop you have displayed is used for OnRender to gather the currently visible bars, this has no relevance in a BarsType.

                    If you want further information about BarsTypes and how they work, please explore one of the existing BarsTypes in the NinjaScript editor.


                    Please let me know if I may be of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Jesse,

                      Like you said i dont think bartype is relevant to my goal. I am still trying to figure out what i want to do and how to do it. So i gather info.

                      Regarding bartype from what i understand it allow a user to create a certain type of bars like a minute bar, volume bar, etc.

                      I dont have access to thick data so i cant get overnight volume chart. Would it be possible to use bartype to create a bar that would convert minute volume into bar volume equal to the volume of a minute?
                      Lets say there is a minute bar at 5 am with a 1000 volumes. Could it be converted into 5 bars candle of 200 contracts?

                      ty

                      Comment


                        #12
                        Hello frankduc,

                        I dont have access to thick data so i cant get overnight volume chart. Would it be possible to use bartype to create a bar that would convert minute volume into bar volume equal to the volume of a minute?
                        Lets say there is a minute bar at 5 am with a 1000 volumes. Could it be converted into 5 bars candle of 200 contracts?
                        Sure, for this question I would suggest taking a look at the existing Volume bars and how they work. The volume bars are based on tick data but you could change the BuiltFrom To Minute to use Minute data instead. How you then form the bars past that point would be up to your logic. OnDataPoint would be called for the minute data points and then you could use AddBar/UpdateBar/RemoveLastBar to modify the series. If you wanted to experiment with a BarsType I would suggest using this process to generate a new type:
                        • In the NS editor right click on BarsType and click new
                        • Click Generate
                        • Find the line which looks like this and copy it: BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 15, Value = 1 };
                        • Close the file without saving
                        • Open the Volume BarsType
                        • Right click -Save As and give it a name
                        • Paste over the existing BarsPeriod = line with what you copied, also replace the Name with a string instead of the Custom.Resource line.

                        Code:
                        Name            = "TestVolume";
                        BarsPeriod        = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 15, Value = 1 };
                        That would generate a BarsType based off of the existing one which you can then experiment with, this will work just like the existing bars type until you make changes.




                        Please let me know if I may be of additional assistance.




                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          You're a genius
                          Thanks Jesse

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by DJ888, 04-16-2024, 06:09 PM
                          4 responses
                          12 views
                          0 likes
                          Last Post DJ888
                          by DJ888
                           
                          Started by terofs, Today, 04:18 PM
                          0 responses
                          7 views
                          0 likes
                          Last Post terofs
                          by terofs
                           
                          Started by nandhumca, Today, 03:41 PM
                          0 responses
                          6 views
                          0 likes
                          Last Post nandhumca  
                          Started by The_Sec, Today, 03:37 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post The_Sec
                          by The_Sec
                           
                          Started by GwFutures1988, Today, 02:48 PM
                          1 response
                          9 views
                          0 likes
                          Last Post NinjaTrader_Clayton  
                          Working...
                          X