Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

indicator irregularities

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

    indicator irregularities

    I have an indicator I built which utilizes
    OnMarketData(MarketDataEventArgs e
    basically I use it to track tick movement. I have 2 questions about this. When I display the indicator on 2 identical charts, the readings are different, not huge differences, but enough that it changes the meaning for me. Could this problem be because my computer is not fast enough to do the calculations when using
    OnMarketData(MarketDataEventArgs e
    and there is a delay in getting the data from one chart to the next? My computer has the following;
    Dual Core Pentium D820, with core speed of 2800 Mhz
    Bus Speed of 200 Mhz
    Memory: DDR2 2560 MB
    DRAM 200 Mhz

    Another question about using
    OnMarketData(MarketDataEventArgs e
    When referring to it from within a Strategy, I call it like any other indicator, MyIndicator(1).Plot0[0], but the data from this reference is erroneous. Is this because it is built using
    OnMarketData(MarketDataEventArgs e
    and not
    OnBarUpdate ?

    Thanks,

    Safetrading

    #2
    Hello safetrading,
    Thanks for your note and I am happy to assist you.

    OnMarketData is the raw data stream and can be resource intensive.

    This is a real-time data stream and can be CPU intensive if your program code is compute intensive (not optimal)


    The chart is updated at an interval (as set via the chart properties). By default the refresh interval is 0.5 seconds. Thus there may be difference between 2 charts as the refresh interval may vary. I would thus recommend to print out the values of the indicator so that you can compare it.

    OnMarketData and OnBarUpdate runs on different thread and there can be a difference between them.
    With NinjaTrader being multi-threaded, you should not rely on any particular sequence of events like OnMarketData() always being called before OnBarUpdate() or vice versa.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      reply

      Thanks for the quick reply, it all makes sense, but one clarification please. If I want to refer to my indicator that uses OnMarketData(MarketDataEventArgs e)
      from within a strategy, is the right was to do it the way I said I was, by referring to it like any other indicator, MyIndicator(1).Plot0[0], because when I use a print statement from my strategy to display the indicator values, they in no way relate to what the indicator displays?

      If not, is there some sample code around that you could point me to?

      Thanks,

      Safetrading

      Originally posted by NinjaTrader_Joydeep View Post
      Hello safetrading,
      Thanks for your note and I am happy to assist you.

      OnMarketData is the raw data stream and can be resource intensive.




      The chart is updated at an interval (as set via the chart properties). By default the refresh interval is 0.5 seconds. Thus there may be difference between 2 charts as the refresh interval may vary. I would thus recommend to print out the values of the indicator so that you can compare it.

      OnMarketData and OnBarUpdate runs on different thread and there can be a difference between them.

      http://www.ninjatrader.com/support/h...marketdata.htm

      Comment


        #4
        Hello safetrading,
        You have to call your indicator the same way in the OnMarketData event as you would have called it in the OnBarUpdate event. There are no special codes out there.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        19 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        21 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X