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 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 kaywai, 09-01-2023, 08:44 PM
                5 responses
                601 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                22 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                16 views
                0 likes
                Last Post Pattontje  
                Started by flybuzz, 04-21-2024, 04:07 PM
                17 responses
                230 views
                0 likes
                Last Post TradingLoss  
                Started by agclub, 04-21-2024, 08:57 PM
                3 responses
                17 views
                0 likes
                Last Post TradingLoss  
                Working...
                X