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 - OnMarketData &/or exposed indicator variable from within BarTypes code

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

    Custom Bars - OnMarketData &/or exposed indicator variable from within BarTypes code

    Hi,

    I am looking into creating a custom bar type of which I have not done before. I would like to know if it is possible to create bars by using a) OnMarketData and/or b) using an exposed variable from an indicator within BarTypes?

    If a) or b) is possible how do you access within BarTypes? Can anyone offer some suggestions?

    Considering that I am working with bid and ask data which bar type would be the best reference to use as a guide to start?

    Best regards,
    suprsnipes.

    #2
    Hello,

    Thank you for the post.

    Using OnMarketData would not be available in a BarsType and also there would not be a way to access indicators. A bar type is really intended to take a input data set and produce series of formatted bars based on the conditions defined. it is more of a framework to the visual factors like the chart style which displays Bars data in various visual ways.

    OnDataPoint does have ask and bid values passed in through its overload though: http://ninjatrader.com/support/helpG...ub=OnDataPoint

    Additionally these types are not directly associated with the charts items like indicators or strategies so there would not really be a way to communicate indicator data to a bars type. Any logic to calculate the bar would need to just go inside the bars type and use the OnDataPoint override. The available overrides and properties documented are in the sidebar of the helpguide here: http://ninjatrader.com/support/helpG.../bars_type.htm

    I am not certain of the idea that you have to really recommend a starting point or script of reference, but you can view the existing barstype code in the editor for an idea of how they work.

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

    Comment


      #3
      Thanks for your response. After spending sometime on the forum yesterday I came to this conclusion also. OnDataPoint seems like a great place to start. Regards, suprsnipes.

      Comment


        #4
        I would like to ask a few questions in relation to custom bartypes.

        Is it possible to access historical bid ask data for building bars (in NT7)?

        If so any suggestions on how to do it?

        And if not possible in NT7 how could this be achieved in NT8?

        Also would it be possible to build historical bars based on data from a .txt file?

        Regards,
        suprsnipes.
        Last edited by suprsnipes; 11-20-2016, 09:23 PM.

        Comment


          #5
          Hello,

          Thank you for the post.

          Yes it is possible to use ask or bid data, you would need to select either an Ask or Bid series from the DataSeries window when configuring your chart. There is no way for the BarsType to add other data in addition to the Input series.

          A BarsType can only use the data passed into the OnDataPoint override, this data would come based on what you select on the chart I.E. Ask, Bid, Last data.

          For building historical bars from .txt, yes this is also possible you would first need to import the data and then it could be used. You can find import instructions and guidelines here: http://ninjatrader.com/support/helpG.../importing.htm

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

          Comment


            #6
            Thanks again for the response. I was actually hoping if you could let me know (even though it would be unsupported) if it was possible to use File.ReadAllText for historical bars in custom bartype?

            Comment


              #7
              Hello,

              You can do any logic you want inside the BarsType so long as you are using the override OnDataPoint which is called for the data in the platform and coming into the platform.

              You could read a text file with the BarsType if you wanted as we are just using C#, but that would not change the actual data that is already saved or incoming data. The platform would still request the data from what is selected as the DataSeries and then the BarsType would execute the OnDataPoint for that data. How you build the bars would be up to your logic.

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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rdtdale, Today, 01:02 PM
              0 responses
              1 view
              0 likes
              Last Post rdtdale
              by rdtdale
               
              Started by alifarahani, Today, 09:40 AM
              3 responses
              15 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by RookieTrader, Today, 09:37 AM
              4 responses
              18 views
              0 likes
              Last Post RookieTrader  
              Started by PaulMohn, Today, 12:36 PM
              0 responses
              6 views
              0 likes
              Last Post PaulMohn  
              Started by love2code2trade, 04-17-2024, 01:45 PM
              4 responses
              40 views
              0 likes
              Last Post love2code2trade  
              Working...
              X