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 mattdowns1234, Today, 06:57 PM
        0 responses
        5 views
        0 likes
        Last Post mattdowns1234  
        Started by dgee949, Today, 06:26 PM
        0 responses
        9 views
        0 likes
        Last Post dgee949
        by dgee949
         
        Started by dgee949, Today, 05:58 PM
        0 responses
        11 views
        0 likes
        Last Post dgee949
        by dgee949
         
        Started by thepcmd, Today, 05:14 PM
        0 responses
        24 views
        0 likes
        Last Post thepcmd
        by thepcmd
         
        Started by xmess777, Today, 04:58 PM
        0 responses
        17 views
        0 likes
        Last Post xmess777  
        Working...
        X