Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData not called

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

    OnMarketData not called

    My code worked before. After loading new simulated stock AA, when I enable the strategy, I only see Initialize() executed from my added log. But don't see onMarketData)_ was ever called. Is there something I could adjust to make it work?

    Thanks.

    #2
    I am all set, suddently it worked, I don't know why, but it worked.

    Comment


      #3
      Hello appleseed,

      Are you getting real-time data for the AA instrument? You may check this by opening up a Time and Sales window under File -> New -> Time and Sales then right click inside of the windows and adding the AA instrument. You will see data populate under Volume if you are getting real-time data for AA instrument.

      Also, do you get any error messages inside of the Log tab of your Control Center window?

      Happy to be of further assistance.
      JCNinjaTrader Customer Service

      Comment


        #4
        OnMarketData() doesn't work again, as I don't see Print() from it.
        Time and Sales window looks normal, I see real time from simulators. Log tab of your Control Center window shows Enabling and Disabling Strategy and nothing else.

        Comment


          #5
          Hello appleseed,

          The Stock Markets are closed right now so you should not get any OnMarketData() until the markets open back up again tomorrow.

          Also, could you share with us what you have inside of OnMarketData()?
          JCNinjaTrader Customer Service

          Comment


            #6
            I am using simulator to feed.

            protected override void OnMarketData(MarketDataEventArgs e)
            {
            if (Historical) {
            Print("historical print");
            return;
            }
            Print("OnMarketdata print");

            I don't even this first line to print.

            Comment


              #7
              Hello appleseed,

              That may be expected depending on what session template you have selected. With a Session Template you can use it to be able to only show data in your chart in between a specific time frame. You may want to use the Default 24/7 to be able to show data all week long.

              For more information about the Session Template you may view the following link.


              To change the session template on a chart open up your "Data Series" window by right clicking in the chart and select Data Series. With the instrument that you want to change highlighted go to the right panel. Under "Data" change the "Session template" from "<Use instrument settings>" to the session template that you want. For example "Default 24/7".

              For more information about "How to edit Data Series parameters in a chart" you may read our online help guide at the following link.


              Let me know if you see updates after changing the session template.
              JCNinjaTrader Customer Service

              Comment


                #8
                It worked now. It seems that I didn't wait long enough. It prints after about 3-5 minutes running strategy or sim. How can I make it quicker?

                Comment


                  #9
                  It is OK now after running a few times. Thanks for the help.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  597 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  343 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  556 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  555 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X