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

Discrepency between T&S and indicator

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

    Discrepency between T&S and indicator

    Hi there,

    I have a question regarding the T&S window and what I read tick by tick.

    In my indicator, I check it's a buy at ask, or sell at bid with this code (which is pretty common in many indicator), and just print it to the output window:

    if (Close[0] >= GetCurrentAsk())
    {
    buys += tradeVol;
    Print(Time[0].ToString("HH:mm:ss") + " BUY "+tradeVol+" at ask:"+GetCurrentAsk());
    }
    else if (Close[0] <= GetCurrentBid())
    {
    sells -= tradeVol;
    Print(Time[0].ToString("HH:mm:ss") + " SELL "+tradeVol+" at bid:"+GetCurrentBid());
    }

    In T&S, just use color to tell it's a buy or sell.

    I found when the tape moves FAST, these is a clear discrepency between these two result (please see attachment). I'm thinking when the tape moves quick (bid and ask price change quickly). Either T&S or getCurrentBid()/getCurrentAsk() cannot follow the pace.

    This is really an big issue as it may give the opposite reading of block trade.

    Please kindly check which one is right.

    Thanks!
    Dixie
    Attached Files

    #2
    Hi dixie,

    From the Time & Sales window it isn't possible to tell for sure if the order is a buy or a sell order.

    If the order is at the ask price the order is likely a buy order. If the order is at the bid price the order is likely a sell order.

    I'll need to see a screenshot of your parameters window to see if what colors you are using for the price levels.

    Please right-click your T&S -> select Properties... -> take a screenshot.

    To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

    For detailed instructions please visit the following link
    http://take-a-screenshot.org/
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Attached please find the T&S parameters.

      Is it because I set the "display update interval" to.25 sec? Maybe that's why T&S cannot follow when tick flood in ?

      Please kindly double check.
      Attached Files

      Comment


        #4
        Seems changing the update interval to 0 still doesn't solve the problem

        Comment


          #5
          Hi dixie,

          The issue is very likely the GetCurrentAsk() and GetCurrentBid() calls.

          These have a delay and in a very fast moving market these can become inaccurate.

          Instead, we can set the ask and bid prices using the actual market data.

          Attached is a sample I put together that should resolve this for you.
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thanks for your code.

            I have one more question regarding the volume of MarketDataEventArgs e in OnMarketData().


            For example this is the code in alphabetical_reference.htm

            protected override void OnMarketData(MarketDataEventArgs e)
            {
            // Print some data to the Output window
            if (e.MarketDataType == MarketDataType.Last)
            Print("Last = " + e.Price + " " + e.Volume); <- i guess is the last trade. Volume is the trade volume of last trade happening at e.Price?

            else if (e.MarketDataType == MarketDataType.Ask)
            Print("Ask = " + e.Price + " " + e.Volume); <- what is volume for ask? The new level I size at the ask side?
            else if (e.MarketDataType == MarketDataType.Bid)
            Print("Bid = " + e.Price + " " + e.Volume); <- what is volume for bid? The new level I size at the bid side?
            }

            Comment


              #7
              Hi dixie,

              MarketDataType.Last -> e.Volume = volume of trades in that print

              MarketDataType.Ask -> e.Volume = number of orders sitting at the ask price on the exchange

              MarketDataType.Bid -> e.Volume = number of orders sitting at the bid price on the exchange
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by AttiM, 02-14-2024, 05:20 PM
              12 responses
              212 views
              0 likes
              Last Post DrakeiJosh  
              Started by cre8able, 02-11-2023, 05:43 PM
              3 responses
              237 views
              0 likes
              Last Post rhubear
              by rhubear
               
              Started by frslvr, 04-11-2024, 07:26 AM
              8 responses
              116 views
              1 like
              Last Post NinjaTrader_BrandonH  
              Started by stafe, 04-15-2024, 08:34 PM
              10 responses
              47 views
              0 likes
              Last Post stafe
              by stafe
               
              Started by rocketman7, Today, 09:41 AM
              3 responses
              11 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X