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 Bar Approach?

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

    Custom Bar Approach?

    Hello,

    i am wondering what the best approach to program a custom bar would be?
    Let say i would like to build a bar that would keep bid/ask volume separated and that would respect diagonal prices from the market (not that horizontal stuff that is offered across the platform).
    In the OnDataPoint() ( http://ninjatrader.com/support/helpG...ndatapoint.htm ) reference i can only get the total volume of bid/ask. It looks like i would need to build two bars, one for bid and one for ask, and connect them somehow. Maybe via the Multi- Time Frame & Instruments Method ( http://ninjatrader.com/support/helpG...nstruments.htm ) .
    Does not seem very convenient to me after all.

    What would be the best way to get this done?

    Thanks for your help.

    Regards,

    JenZi

    #2
    Hello JenZi,

    The AddBar() method is able to set the open, high, low, close, time, and volume of the bar.

    Trying to hold two sets of information for a bar and display this would not be possible.

    Instead, you would need two different bar types each holding the 1 set of information for that bar.

    Any information you would want to save from OnDataPoint() could be saved in a custom array or list.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ChelseaB,

      since the two bars should influence each other (e.g. one reaches a certain price to close both), can they run simultaneously somehow?
      If visualization is not neccessary at all, would it be possible to accomplish that in an indicator? Add the two data streams, separate them into the two bars, calculate and save the needed information and pass it on to a strategy (therefore making the underlying chart minute, range, tick, etc. redundant).

      Comment


        #4
        Hello JenZi,

        Multiple series can be added to an indicator or a strategy using the AddDataSeries() method. You can make any calculations you would like using as many instruments or intervals as you would like in these two types of scripts.

        Bars types cannot have two series. A bar type creates a (single) series.

        Below is a link to an official reference sample that demonstrates how to add intra-bar granularity.
        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


        As well as a link to the help guide on the AddDataSeries() method.


        A link to the help guide on BarsInProgress.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,266 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X