• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

why is market data showing negative prices

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

    why is market data showing negative prices

    I have this simple logic to print out the market data and it shows negative prices and proper prices for Ask. I am using IB as data provider

    the data is
    123.26'5
    -9223372036854780.00'0
    -9223372036854780.00'0
    123.26'5
    -9223372036854780.00'0
    123.26'5
    -9223372036854780.00'0
    -9223372036854780.00'0
    123.26'6
    -9223372036854780.00'0
    123.26'6
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    123.26'7
    -9223372036854780.00'0
    123.26'7
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    		{
    			Print(SuperDom.Instrument.MasterInstrument.FormatPrice(marketDataUpdate.Ask));
    //            if (limitprice > 0 && marketDataUpdate.Ask < limitprice)
    //            {
    				
    //                Print(DateTime.Now + SuperDom.Instrument.FullName + limitprice + "Crossed below ask" +  String.Format("{0:0.0000}",SuperDom.Instrument.MasterInstrument.FormatPrice(marketDataUpdate.Ask)));       
    //            }
    			
    		}

    #2
    Hello,

    I believe this is caused by the syntax you are using and also by the syntax that is missing.

    Because you are not filtering what event specifically you want to print, you are printing the Ask object from Last, Ask and Bid events which it is only valid for Last events.

    I believe what you are instead looking for would be one of the following:

    Code:
    if(marketDataUpdate.MarketDataType == MarketDataType.Last)
    {
    	Print("Last: " + marketDataUpdate.Price + " Ask: " + marketDataUpdate.Ask+ " Bid: " + marketDataUpdate.Bid);
    }
    			
    if(marketDataUpdate.MarketDataType == MarketDataType.Ask)
    {
    	Print("Ask: " + marketDataUpdate.Price);
    }
    
    if(marketDataUpdate.MarketDataType == MarketDataType.Bid)
    {
    	Print("Bid: " + marketDataUpdate.Price);
    }
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by StevenNelson, Today, 12:29 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by anupsoni, Today, 12:23 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by aligator, Yesterday, 12:15 PM
    7 responses
    60 views
    0 likes
    Last Post aligator  
    Started by frankduc, Today, 11:22 AM
    3 responses
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by aslane, Today, 10:53 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X