Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to use two different bars types within the same strategy

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

    how to use two different bars types within the same strategy

    Hello everyone,
    I'm writing a strategy and I would like to check two different types of bars, the volumetric bars and the Renko bars. I can use the bars individually, but not together in the same strategy. I would like to do some checks on the ask and bid of the volumetric bars( like volumetricBarsType.Volumes[CurrentBar].GetBidVolumeForPrice(i) where i is the price of last Bar) but at the same time I would like to check the directionality of the market going to see if the bars before the moment I would like to enter the market are correct for me, using the methods Close() and Open(). Currently if I use these methods I get the values of Close() and Open of the volumetric bars even if I loaded both types of bars, and I didn’t find a way to "differentiate" the bars. I need both types of data available and manipulable within the same strategy. Is it possible to do that? And if so, how?

    Thank you!

    #2
    Hello andelvincent37,

    Thanks for your post.

    To access Order Flow Volumetric Bars values in a custom NinjaScript, such as GetBidVolumeForPrice(), please see the Order Flow Volumetric Bars help guide page linked below. This help guide page contains sample code demonstrating how to access Order Flow Volumetric Bars information like GetBidVolumeForPrice() in a custom NinjaScript.

    Order Flow Volumetric Bars: https://ninjatrader.com/support/help...tric_bars2.htm

    Further, if you are wanting to add an Order Flow Volumetric bars object to your script, AddVolumetric() would be used.

    AddVolumetric(): https://ninjatrader.com/support/help...volumetric.htm

    Adding a Renko bars object to your script for calculations would be done using the AddRenko() method.

    AddRenko(): https://ninjatrader.com/support/help...8/addrenko.htm

    To check if the current forming bar is an up bar, a condition could be created that checks if the Close[0] > Open[0]. To check if the current forming bar is a down bar, a condition could be created that checks if the Close[0] < Open[0].

    You could use the plural of Close and Open, such as Closes[1][0] and Opens[1][0], to access these values from added series in the script. The bar series index value you pass in will determine which added secondary bars object is used to get these values.

    See this help guide about using the PriceSeries collection to access price values from the primary series or secondary series: https://ninjatrader.com/support/help...riceseries.htm

    Also, it is important to review this help guide page to gain a full understanding of how to work wth multi-timeframe/multi-instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm

    Please let me know if I may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thank you, it worked!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Waxavi, Today, 02:10 AM
      0 responses
      4 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by TradeForge, Today, 02:09 AM
      0 responses
      10 views
      0 likes
      Last Post TradeForge  
      Started by Waxavi, Today, 02:00 AM
      0 responses
      2 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by elirion, Today, 01:36 AM
      0 responses
      4 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by gentlebenthebear, Today, 01:30 AM
      0 responses
      4 views
      0 likes
      Last Post gentlebenthebear  
      Working...
      X