Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData Oddity

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

    OnMarketData Oddity

    Why does OnMarketData return values for Ask and Bid in the "ask" and "bid" return values that appear to be uninitialized? It returns Last correctly. Should it not also return Ask and Bid correctly? For each, it should, surely, return the relevant value correctly, even if the other value is uninitialized.

    Code:
    OnMarketData: instrument='GBPUSD Default' type=Ask price=1.22799 volume=26 time='12-Oct-16 12:15:54' bid=-1.79769313486232E+308 ask=-1.79769313486232E+308 isReset=False
    OnMarketData: instrument='GBPUSD Default' type=Ask price=1.22799 volume=26 time='12-Oct-16 12:15:54' bid=-1.79769313486232E+308 ask=-1.79769313486232E+308 isReset=False
    OnMarketData: instrument='GBPUSD Default' type=Bid price=1.22786 volume=26 time='12-Oct-16 12:15:54' bid=-1.79769313486232E+308 ask=-1.79769313486232E+308 isReset=False
    OnMarketData: instrument='GBPUSD Default' type=Bid price=1.22786 volume=26 time='12-Oct-16 12:15:54' bid=-1.79769313486232E+308 ask=-1.79769313486232E+308 isReset=False
    OnMarketData: instrument='GBPUSD Default' type=Last price=1.22786 volume=26 time='12-Oct-16 12:15:54' bid=1.22786 ask=1.22799 isReset=False
    OnMarketData: instrument='GBPUSD Default' type=Last price=1.22786 volume=26 time='12-Oct-16 12:15:54' bid=1.22786 ask=1.22799 isReset=False
    NT8 RC2.

    Thanks.
    Last edited by jeronymite; 10-11-2016, 08:28 PM. Reason: Add NT version
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Hello,

    Thank you for the post, I believe this would be expected based on the object and the way the data is reported.

    In the case you Printing the total object out like you have displayed, some properties may be un initialized because there is no value for that property in the current usage.

    The type=Last specifically needs to use the Price property to report its Price. The Ask and Bid are also reported with the Last so two more properties are needed for these values creating the Ask and Bid properties. Because the MarketDataEventArgs object is used for all 3 events, this entails all 3 events get the same properties although they may or may not be used by that event type.

    The type=Ask and Bid work the same as type=Last in the sense that they use the Price property to report their Prices. There is no second Ask or Bid data for these event so the values are not set to a price.

    Used in logic, you would need to determine if you are getting the type=Last value or not to know if you should use the Price property or to use the Ask/Bid properties specifically.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      The more important question is why do each event occurs twice. I believe it is because he is using 2 time frames in his strategy/indicator. This is truly redundant and slows down the "Tick Replay" backtest and the realtime updates of the indicators and strategies that rely on "OnMarketData" for calculations.

      Another strange coincidence is that the bid, ask and the last volume is the same. Those volumes should be different in 99.999% of the time because they represent the current bid volume, current ask (=offer) volume and the size of the last trade respectively. They rarely have the same numbers.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gentlebenthebear, Today, 01:30 AM
      2 responses
      13 views
      0 likes
      Last Post gentlebenthebear  
      Started by Kaledus, Today, 01:29 PM
      2 responses
      7 views
      0 likes
      Last Post Kaledus
      by Kaledus
       
      Started by frankthearm, Yesterday, 09:08 AM
      13 responses
      45 views
      0 likes
      Last Post frankthearm  
      Started by PaulMohn, Today, 12:36 PM
      2 responses
      16 views
      0 likes
      Last Post PaulMohn  
      Started by Conceptzx, 10-11-2022, 06:38 AM
      2 responses
      56 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Working...
      X