Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom BarsType & OnMarketData event

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

    Custom BarsType & OnMarketData event

    Hello,
    I am trying to develop a custom type for drawing Delta Bars (Acum_BidBar - Acum_AskBar; like marketdelta.com).
    The main problem was the bid-ask data is not avaliable into BarsType.
    I tried with static fields to store the bid/ask values. It worked well.

    But, there is a new problem : the OnMarkeData event is executed AFTER of the BarsType.Add code.
    Is this a logical behaviour ?

    Thanks and regards.
    Last edited by cls71; 05-11-2009, 05:58 AM.

    #2
    cls71,

    I am not quite sure I follow you. What does OnMarketData have to do with custom bar types?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      cls71,

      I am not quite sure I follow you. What does OnMarketData have to do with custom bar types?
      Hello Josh,

      I want create a barType with bid-ask data.
      The bar Delta is equal = Math.Abs( Sum( BidVolume ticks) - Sum( AskVolume ticks) )

      In this next example, I want draw a bar when the delta greater or equal than 100.

      Time & Sales
      Price - MarketType - VolumeTick - AcumDeltaBar
      952 .... Bid ......... 10 ...... -10
      951 .... Bid ......... 20 ...... -30
      950 .... Bid ......... 40 ...... -70
      950 .... Bid ......... 20 ...... -90
      951 .... Ask ........ 10 ...... -80
      952 .... Ask ........ 10 ...... -70
      951 .... Bid ........... 5 ....... -75
      951 .... Ask ......... 10 ....... -65
      951 .... Bid .......... 30 ....... -95
      950 .... Bid .......... 10 ....... -105
      in this point must finish the current bar (because Delta = 105 is greater or equal than 100 ) and must begin a new bar.
      The procedure is very similar like Volume bars or Range bars, but using Bid-Ask instead.

      The problem is that Bid-Ask data is not available in Bar class, so bid-ask are not accesible into BarTypes.Add method.
      I have tried using static variables to store bid-ask when OnMarketData event is ran and reading these variables inside BarTypes.Add method later. But the BarTypes.Add method is ran BEFORE than OnMarketData event; so the static variables aren't updated and the reading is incorrect.

      (Sorry if my explanation is confuse. English is not my native language).

      Thanks and regard.

      Comment


        #4
        cls71,

        BarTypes are not indicators. I suggest you take a look at the Range Alt bars for an example in the file sharing section. Unfortunately we cannot offer you much more assistance on this since custom bar types are not supported.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Josh. I know.

          I'll try the bars.MarketData property inside BarsType.Add method.

          ( Do you know like I can debug types ? I didn't get the breakpoints work)

          Regards

          Comment


            #6
            Unfortunately debugging outside of NinjaTrader is unsupported and I would not be able to advise.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              I refer to the @BarsType.cs file, which is open and inside Ninjatrader.

              Comment


                #8
                Unfortunately we do not provide any support for that since it's outside of documented NinjaScript.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                656 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                371 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                109 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                574 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                579 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X