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

Bid Volume > Ask Volume

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

    Bid Volume > Ask Volume

    I am trying to add a filter to my strategy where the bid volume is greater than the ask volume.

    I am using the strategy builder and trying to test it in the strategy analyzer. I have historical bid ask data.

    I tried simply putting Price/Bid Volume > Price Ask Volume in the Conditions and Action section that returns 0 trades. I also used fixed text to place the values on chart but nothing appeared.

    I tried to set variables to the Bid / Ask volume and use those in the logic but had the same results.

    Any help will be appreciated.

    Attached Files

    #2
    Hello sdauteuil,

    Move the drawing object to a new condition set without any conditions so that you can see the print even when the condition is not true.

    Add more text to the Draw.TextFixed() string as a label to see if the text isn't appearing or if the method or property printed is not returning a value.
    I recommend adding the time of the bar.

    https://drive.google.com/file/d/1_Bn...w?usp=drivesdk

    Typically, I recommend using prints, but what you have done works just as well, if this was in a separate condition set.
    https://ninjatrader.com/support/foru...121#post791121


    GetCurrentBidVolume() (Price > Current bid volume) / GetCurrentAskVolume() work in real-time, but returns the close volume in historical.
    https://ninjatrader.com/support/help...taskvolume.htm

    May I confirm that you are testing this in real-time and not in historical data?
    Last edited by NinjaTrader_ChelseaB; 10-13-2020, 09:08 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you that is helpful

      I didn't realize I could use the action section without a condition.

      It does work in real time. I was trying to back test with tick replay enabled but that wasn't working.

      My end goal is to get similar data as the volumetric bar into a strategy on a range or renko bar and preferably be able to back test. (I understand back testing renko is not accurate).

      Can I access this data historically with tick replay enabled?

      Is there a way to access the data from a volumetric bar but using a range or a renko bar on a live chart or would I need to create a separate indicator?

      I would like to have access to volume delta in the ribbon band at the bottom of the chart do not need the data inside of the bar.

      Comment


        #4
        Hello sdauteuil,

        Unfortunately, no. TickReplay provides the bid and ask in a specific way from OnMarketUpdate().
        See 'Accessing the current best bid and ask at the time of a trade' in the help guide.


        It does not cause GetCurrentBid() or GetCurrentAsk() to update historically.

        You can access historical data with TickReplay enabled, (the same as if it was not). TickReplay will cause OnBarUpdate to trigger for each price change or each tick when Calculate is OnEachTick or OnPriceChange.

        Order Flow Volumetric bar data is called by casting the Bars object as VolumetricBarsType.
        Below is a link to the help guide.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi, I, too, like you, tried to add a filter to my strategy where the big volume is greater than the mask volume, but nothing worked out for me. In the end, I had to turn to the service that deals with bid writing, and they helped me. However, at first, they told me that it was impossible, but later I was able to find specialists who helped me in this matter. Therefore, I advise you to do the same, my friend, find yourself people who have experience in this field and turn to them. Good luck to you; I hope I helped you at least somehow.
          Last edited by BillieMartin; 03-26-2022, 04:56 PM.

          Comment


            #6
            Welcome to the forums BillieMartin!

            GetCurrentBidVolume and GetCurrentAskVolume work with realtime data only so what sdauteuil shows in their script would only work with realtime data, and would not work with backtesting.

            If you are new to NinjaScript, I may suggest sticking with realtime processing, and to test the strategy using the Playback Connection since Playback will mimic realtime data.

            Playback - https://ninjatrader.com/support/help...l?playback.htm

            If you want to get a strategy like this working with backtesting, you may see below, but we will be using some advanced features like Tick Replay, and submitting orders to a single tick data series. This involves unlocking the code.

            Getting BuySellVolume logic working with historical processing

            You could consider using the BuySellVolume indicator, but this involves Tick Replay and the script must operate OnEachTick for the the indicator to work correctly. Also to note, since it is a Tick Replay indicator, it is technically one tick behind.

            As a starting point, you could create a simple strategy that adds some prints for BuySellVolume's plots (include the bar time with your prints,) and to test that strategy with Tick Replay enabled. You may then see the prints showing the BuySellVolume plot values with historical and realtime data, and after seeing those values, you will know how to set up conditions to use those plots.

            Then you can implement trading logic since you will know how to read and use the indicator plots.

            Note that using Tick Replay allows for intrabar logic to be processed, but with backtesting, orders are still filled based on the data series we enable the strategy against, or the data series you submit the order to. This means that in order to have historical order fills that are consistent with the strategy processing historical data intrabar with Tick Replay, you will need to unlock the code and have the orders submitted to a single tick data series.

            This is would be much more advanced than simply using Playback to test a strategy like this and sticking to realtime processing only. This will also be very resource intensive since.

            Discrepancies between realtime and backtest - https://ninjatrader.com/support/help...ime_vs_bac.htm

            Submitting orders to a single tick data series - https://ninjatrader.com/support/help...ipt_strate.htm

            Let us know if there is anything else we can do to help.
            JimNinjaTrader 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