Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Timer object

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

    Timer object

    Hello,

    I need to develop a timer that is executed an exact lapse of time in miliseconds.

    I followed the instructions found in http://ninjatrader.com/support/forum...ead.php?t=5965

    and in your help guide: https://ninjatrader.com/support/help...ustomevent.htm

    and the TimerEventProcessor method is correctly triggered but not MyCustomHandler

    Am I missing something?. I applied it in a strategy instead of an indicator.

    Thanks

    #2
    Hello,

    Thank you for the post.

    I couldn't say what may be happening without seeing what you have programmed so far, I tried copying the indicators code into a strategy and can see it printing the orderbook so potentially this is specific to something you have added.

    Could you compare the sample attached here with what you have developed?


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

    Comment


      #3
      Thanks,

      the error was related with the "More than 100 subsequent user events" issue. The method called in the timer just checks several files, so, I avoided to use
      TriggerCustomEvent(MyCustomHandler, 0, myTimer.Interval);

      I don't think this will be a problem.

      Another question. OnStartup() is executed after historical data is fully loaded? I would like to execute the timer after data is fully loaded.

      Comment


        #4
        Hello,

        The OnStartup method is called only once immediately prior to the start of your script processing its logic in OnBarUpdate(), but after the Initialize() method.

        I believe this should work in regard to know that the script was Started but may not necessarily mean that the data was successfully loaded.

        To ensure Historical data was loaded and the script has begun processing you could append this logic to the top of OnBarUpdate checking if the CurrentBar is 0 or using a bool to control logic.

        For a multi series script, it may instead be easier to use a bool to ensure the logic is called on the first call to OnBarUpdate and only once.

        Code:
        if(!completeOnce)
        {
            //some logic
            completeOnce = true;
        }
        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I understand then that the timer can be started at any point. As an example in OnMarketData(). Am I wrong?

          Comment


            #6
            Hello,

            Yes, the timer can be started at any point, assuming that whatever action you are doing with the timer can also be started when you start the timer.

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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by love2code2trade, Yesterday, 01:45 PM
            4 responses
            28 views
            0 likes
            Last Post love2code2trade  
            Started by funk10101, Today, 09:43 PM
            0 responses
            7 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            37 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            44 views
            0 likes
            Last Post bill2023  
            Started by yertle, Today, 08:38 AM
            6 responses
            26 views
            0 likes
            Last Post ryjoga
            by ryjoga
             
            Working...
            X