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 bortz, 11-06-2023, 08:04 AM
    47 responses
    1,606 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    15 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X