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 Net_Trader, 03-15-2023, 03:17 PM
      16 responses
      179 views
      0 likes
      Last Post Net_Trader  
      Started by Vern10, Today, 10:51 AM
      4 responses
      30 views
      0 likes
      Last Post Vern10
      by Vern10
       
      Started by HalTech, Today, 02:11 PM
      2 responses
      36 views
      0 likes
      Last Post HalTech
      by HalTech
       
      Started by Gianpiero, Today, 01:41 PM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_Ray  
      Started by josh18955, Today, 11:16 AM
      1 response
      19 views
      0 likes
      Last Post Leeroy_Jenkins  
      Working...
      X