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

Problem with High/Low on 1 Tick Charts

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

    Problem with High/Low on 1 Tick Charts

    There seems to be something wierd going on with the High and Low functions when used on a 1 tick chart of $AUDUSD. Generate a new indicator (with CalculateOnBarClose = false) and insert the following line:

    Print(CurrentBar.ToString() + " Ask " + GetCurrentAsk().ToString() + " Bid " + GetCurrentBid().ToString() + " high " + High[0].ToString() + " Low " + Low[0].ToString());

    When connected to the simulator with 0 delays, I get output results like the following:

    300 Ask 1.0009 Bid 1.0008 high 1.0008 Low 1.0008
    301 Ask 1.0009 Bid 1.0008 high 1.0008 Low 1.0008
    302 Ask 1.0009 Bid 1.0008 high 1.0008 Low 1.0008
    303 Ask 1.0009 Bid 1.0008 high 1.0009 Low 1.0009
    304 Ask 1.0009 Bid 1.0008 high 1.0009 Low 1.0009
    305 Ask 1.001 Bid 1.0009 high 1.0009 Low 1.0009
    306 Ask 1.0011 Bid 1.001 high 1.001 Low 1.001
    307 Ask 1.0011 Bid 1.001 high 1.001 Low 1.001
    308 Ask 1.0011 Bid 1.001 high 1.001 Low 1.001
    309 Ask 1.001 Bid 1.0009 high 1.001 Low 1.001
    310 Ask 1.001 Bid 1.0009 high 1.001 Low 1.001
    311 Ask 1.001 Bid 1.0009 high 1.001 Low 1.001
    312 Ask 1.0011 Bid 1.001 high 1.0011 Low 1.0011
    313 Ask 1.0011 Bid 1.001 high 1.0011 Low 1.0011
    314 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    315 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    316 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    317 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    318 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    319 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    320 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    321 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    322 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    323 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    324 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    325 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    326 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    327 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    328 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    329 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    330 Ask 1.0012 Bid 1.0011 high 1.0012 Low 1.0012
    331 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    332 Ask 1.0013 Bid 1.0012 high 1.0012 Low 1.0012
    333 Ask 1.0013 Bid 1.0012 high 1.0013 Low 1.0013
    334 Ask 1.0014 Bid 1.0013 high 1.0013 Low 1.0013
    335 Ask 1.0013 Bid 1.0012 high 1.0013 Low 1.0013
    336 Ask 1.0013 Bid 1.0012 high 1.0013 Low 1.0013
    337 Ask 1.0015 Bid 1.0014 high 1.0014 Low 1.0014
    338 Ask 1.0014 Bid 1.0013 high 1.0014 Low 1.0014
    339 Ask 1.0015 Bid 1.0014 high 1.0014 Low 1.0014
    340 Ask 1.0016 Bid 1.0015 high 1.0015 Low 1.0015
    341 Ask 1.0016 Bid 1.0015 high 1.0015 Low 1.0015
    342 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    343 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    344 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    345 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    346 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    347 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    348 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    349 Ask 1.0015 Bid 1.0014 high 1.0015 Low 1.0015
    350 Ask 1.0016 Bid 1.0015 high 1.0016 Low 1.0016
    351 Ask 1.0017 Bid 1.0016 high 1.0017 Low 1.0017
    352 Ask 1.0018 Bid 1.0017 high 1.0017 Low 1.0017
    353 Ask 1.0018 Bid 1.0017 high 1.0017 Low 1.0017
    354 Ask 1.0018 Bid 1.0017 high 1.0017 Low 1.0017
    355 Ask 1.0017 Bid 1.0016 high 1.0017 Low 1.0017
    356 Ask 1.0019 Bid 1.0018 high 1.0018 Low 1.0018
    357 Ask 1.002 Bid 1.0019 high 1.0019 Low 1.0019
    358 Ask 1.0019 Bid 1.0018 high 1.0019 Low 1.0019
    359 Ask 1.002 Bid 1.0019 high 1.0019 Low 1.0019
    360 Ask 1.0019 Bid 1.0018 high 1.0019 Low 1.0019
    361 Ask 1.002 Bid 1.0019 high 1.0019 Low 1.0019
    362 Ask 1.002 Bid 1.0019 high 1.0019 Low 1.0019
    363 Ask 1.0019 Bid 1.0018 high 1.0019 Low 1.0019
    364 Ask 1.0019 Bid 1.0018 high 1.0019 Low 1.0019
    365 Ask 1.0019 Bid 1.0018 high 1.0019 Low 1.0019
    366 Ask 1.0019 Bid 1.0018 high 1.0019 Low 1.0019
    367 Ask 1.0019 Bid 1.0018 high 1.0018 Low 1.0018
    368 Ask 1.0019 Bid 1.0018 high 1.0018 Low 1.0018
    369 Ask 1.0019 Bid 1.0018 high 1.0018 Low 1.0018
    370 Ask 1.0018 Bid 1.0017 high 1.0018 Low 1.0018
    371 Ask 1.0019 Bid 1.0018 high 1.0019 Low 1.0019
    372 Ask 1.002 Bid 1.0019 high 1.002 Low 1.002
    373 Ask 1.0021 Bid 1.002 high 1.0021 Low 1.0021
    374 Ask 1.0021 Bid 1.002 high 1.0021 Low 1.0021


    Doesn't quite make sense does it?

    #2
    This is expected. A 1 tick chart has only 1 price point thus open == high == low == close.
    RayNinjaTrader Customer Service

    Comment


      #3
      Sure, but althought the high and low are always the same, they don't consistently match either the bid or the ask.

      For example, on bar 302 the High and Low appear to match the bid/ask at 1.0008/1.0009. However, on the next bar the High and Low have moved up to 1.0009, despite the fact that the bid/ask remains unchanged at 1.0008/1.0009.

      Similarly, from bar 314 to 332 the High and Low remain at a constant 1.0012, despite the fact that the bid/ask has fluctuated several times over this period (the bid jumping back and forth between 1.0011 and 1.0012).
      Last edited by beastment; 12-20-2008, 09:05 PM.

      Comment


        #4
        There is no guarantee that the bid/ask will correlate to the OHLC price.
        RayNinjaTrader Customer Service

        Comment


          #5
          What? Why wouldn't it? You said yourself that on a 1 tick chart:

          open = close = high = low

          I understand that the ask price is generally not reflected in most functions, but why wouldn't:

          bid = open = close = high = low ?

          it's all the same tick isn't it?

          Comment


            #6
            In most our FX adapter, OHLC is derrived from bid yes which is NOT the same as the current bid. When you ask for the current bid, this is an asynchronous call meaning, there could be 20 bid change events that have not yet been processed as trade events and you may be processing the 1st bid event in OnBarUpdate() yet getting the current bid known which is the 20th event. I am using the value 20 just to demonstrate my point.
            RayNinjaTrader Customer Service

            Comment


              #7
              So are you saying that on a 1-tick chart a new tick indicates a new trade event, but there may be many bid change events within a trade event, i.e. the quoted bid price is fluctuating at the marketmaker's discretion despite the fact that no underlying trades have been made?

              Comment


                #8
                No, that's not what I am saying.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Okay. So, are you saying that OnBarUpdate() is not necessarily triggered by a bidchange event? In that case, what exactly is a bar on a 1-tick chart?
                  Last edited by beastment; 12-22-2008, 01:58 PM.

                  Comment


                    #10
                    What we are saying is that GetCurrentBid/Ask is not guaranteed to be in line or in sync with OnBarUpdate().
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      I think I see,

                      So, there is essentially a 'stack' (to use an old programming term) of known bidchange events waiting to be processed, each of which will in turn trigger a call to OnBarUpdate(). The reason I'm getting these results then is that GetGurrentBid() retrieves the top (most recent) bid from the stack whereas OnBarUpdate() is still working on the bottom bid from the stack?

                      Comment


                        #12
                        That would be a way to describe it.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Cool. Thanks guys, I appreciate the help.

                          Comment


                            #14
                            Sorry to keep dragging this on, but...

                            Will OnBarUpdate() eventually work through every bid change event, or will it just start from the most recent one available and skip those have occurred since it was last executed?

                            Comment


                              #15
                              You will receive an OnBarUpdate() event for each one.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Rapine Heihei, 04-23-2024, 07:51 PM
                              2 responses
                              30 views
                              0 likes
                              Last Post Max238
                              by Max238
                               
                              Started by Shansen, 08-30-2019, 10:18 PM
                              24 responses
                              943 views
                              0 likes
                              Last Post spwizard  
                              Started by Max238, Today, 01:28 AM
                              0 responses
                              9 views
                              0 likes
                              Last Post Max238
                              by Max238
                               
                              Started by rocketman7, Today, 01:00 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post rocketman7  
                              Started by wzgy0920, 04-20-2024, 06:09 PM
                              2 responses
                              28 views
                              0 likes
                              Last Post wzgy0920  
                              Working...
                              X