Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect Market data

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

    Incorrect Market data

    I have something strange on my strategy. Last week I was working with Euronext stocks and everything was fine. Now I work with US stocks and with the same strategy I have this trouble.

    I Open a 5 minute chart and I set the strategy. On Initialize() I add a new time frame for the main symbol and I get data from another symbol:

    Add(PeriodType.Second,5);
    Add("$EURUSD", PeriodType.Minute, 60);


    After Initialize() I retrieve market data:

    protected override void OnMarketData(MarketDataEventArgs e)
    {
    if (e.MarketDataType == MarketDataType.Ask)
    Ask = e.Price;

    if (e.MarketDataType == MarketDataType.Bid)
    Bid = e.Price;
    }


    When doing this if I Print(Bid); I get the data from the EURUSD instead of the main instrument.

    Even if I set this code I still get wrong data (in this case the value of Print(Bid); is always zero):

    protected override void OnMarketData(MarketDataEventArgs e)
    {
    if (BarsInProgress == 1)
    {
    if (e.MarketDataType == MarketDataType.Ask)
    Ask = e.Price;

    if (e.MarketDataType == MarketDataType.Bid)
    Bid = e.Price;
    }
    }


    What I'm doing wrong?

    #2
    guillembm,

    Who is your data provider?

    The use of BarsInProgress is necessary in order to be sure you are getting data for the correct instrument in multi-instrument strategies.

    Please let me know if I may assist further.
    Last edited by NinjaTrader_AdamP; 11-21-2011, 10:29 AM.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Kinetick

      The point is that when I Print(Bid); from onbarupdate with this code I get mixed data from all instruments on the strategy. To Print I set

      if (BarsInProgress == 1)
      {
      Print(Bid);
      }

      It should print only data from the main instrument in 5 second frame.

      I restarted NT and it's the same

      Comment


        #4
        I don't think you are getting bid/ask data

        Debug everything in your onmarketdata.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        8 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        61 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        24 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X