Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleCustomEvents

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

    SampleCustomEvents

    if you put a print statement in either OnMarketDepth(MarketDepthEventArgs e) it prints on every orderbook update

    if you put a print statement in MyCustomHandler(object state) it prints every 1000ms

    however if you put a DrawText statement in with the print statements you do not get the same updates in the chart...i.e. the interval of the prints to the output window and plots on the chart do not match....chart is much slower and misses many of the updates...i.e. lags what is actually going on

    same lag if you plot a line using myline.Set(value);

    Why is the chart not plotting at same interval?

    #2
    In addition to the "Display Update interval" property on your chart, the Draw() methods are not called the same as Print()

    You'll notice if repeatedly click on the chart, you should be able to get the Draw method to update almost as quickly as your output prints.

    This can be worked around by over ridding the plot method however. You can look at the BarTimer indicator to get an idea of how you accomplish this.
    MatthewNinjaTrader Product Management

    Comment


      #3
      changing "Display Update interval" property from 0.5 to 0.1 had no effect so changed it back to 0.5

      copied some of the code from the BarTimer indicator into my indicator and now it plots every 1000ms per the default timer setting in my indicator

      works great...thanks

      Comment


        #4
        To clarify, Display update interval only affects the OnBarUpdate events.
        MatthewNinjaTrader Product Management

        Comment


          #5
          excellent..thanks

          Comment


            #6
            spoke too soon....

            "Error creating window handle."

            Edit Ninjascript could not pull up dialog to select indicator to edit.

            could not exit ninja... closed with TaskManager

            had copied from OnBarUpdate:
            if (DisplayTime()){
            timer = new System.Windows.Forms.Timer();
            timer.Interval = 100;
            timer.Tick += new EventHandler(OnTimerTick);
            timer.Enabled = true;}

            on restart copied from onbarupdate:
            if (timer == null){
            if (DisplayTime()){
            timer = new System.Windows.Forms.Timer();
            timer.Interval = 100;
            timer.Tick += new EventHandler(OnTimerTick);
            timer.Enabled = true;} }

            had copied from bartimer indicator Misc region:
            DisplayTime()
            DateTime Now
            OnTimerTick(object sender, EventArgs e)

            on restart copied from bartimer indicator Misc region:
            OnTermination()

            have not copied:
            Plot(Graphics graphics, Rectangle bounds, double min, double max)
            since I do not want bartimer plots

            working fine now...waiting to see if lock up recurs
            Last edited by ATI user; 02-15-2013, 09:14 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            634 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X