Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

new beta11 bug?

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

    #16
    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    With the latest build there is no crash but it still takes about 15 seconds to load the indicator. Again, that is very unusual as I have very complex strategies that load almost instantly on my (very fast) system.

    This is my current OnBarUpdate() method:

    Code:
     /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                if (Bars.BarsSinceSession > 5) {
                    //Log("" + Bars.BarsSinceSession, LogLevel.Information);
                    // highest bar of day:
                    double dailyHigh = MAX(High, Bars.BarsSinceSession)[0];
                    Log("Bars since Session: " + Bars.BarsSinceSession, LogLevel.Information);
                    if (dailyHigh == High[0]) { 
                        BarColor = colorDayHigh;
                        Log("Highest at: " + High[0], LogLevel.Warning);
                        //DrawText("highest" + CurrentBar, false, "highest", 0, High[0], 10, Color.White, new Font("Arial", 8, FontStyle.Bold),
                        //        StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                    }
    
            }
    It works however and that's a start:

    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    If I change the code to this:

    Code:
     /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                if (Bars.BarsSinceSession > 5) {
                    //Log("" + Bars.BarsSinceSession, LogLevel.Information);
                    // highest bar of day:
                    double dailyHigh = MAX(High, Bars.BarsSinceSession)[0];
                    double dailyLow = MIN(Low, Bars.BarsSinceSession)[0];
                    //Log("Bars since Session: " + Bars.BarsSinceSession, LogLevel.Information);
                    if (dailyHigh == High[0]) { 
                        BarColor = colorDayHigh;
                        Log(Instrument.FullName + " touching daily HIGH at: " + High[0], LogLevel.Warning);
                        //DrawText("highest" + CurrentBar, false, "highest", 0, High[0], 10, Color.White, new Font("Arial", 8, FontStyle.Bold),
                        //        StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                    } else if (dailyLow == Low[0]) {
                        BarColor = colorDayLow;
                        Log(Instrument.FullName + " touching daily LOW at: " + Low[0], LogLevel.Warning);
                    }
                }
            }
    ... then it takes around one minute to load the indicator. So, it's quite clear to me that the problem is with this call:

    Code:
                    double dailyHigh = MAX(High, Bars.BarsSinceSession)[0];
                    double dailyLow = MIN(Low, Bars.BarsSinceSession)[0];
    I'm worried that NT7 might get bogged down when running this indicator - do you have any suggestions as to what's going on?
    Last edited by molecool; 03-25-2010, 07:06 PM.

    Comment


      #17
      molecool,

      When you do that you are literally creating tons and tons of instances of that indicator as each different period you pass in equals a new instance of the indicator. By the time you reach bar 100 that is 100 instances of MAX and 100 of MIN. By the time you reach bar 1000 that is 2000 instances.
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_Josh View Post
        molecool,

        When you do that you are literally creating tons and tons of instances of that indicator as each different period you pass in equals a new instance of the indicator. By the time you reach bar 100 that is 100 instances of MAX and 100 of MIN. By the time you reach bar 1000 that is 2000 instances.
        Yes, agreed and I thought of that. Can you think of a better way of doing that in NT?

        Comment


          #19
          You could run the calculations natively within your script.

          private double maxHigh;

          Code:
          if (High[0] > maxHigh)
               maxHigh = High[0];
          Then just reset the variable at the start of a new session. You can use Bars.SessionBreak or Bars.FirstBarOfSession
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_Josh View Post
            You could run the calculations natively within your script.

            private double maxHigh;

            Code:
            if (High[0] > maxHigh)
                 maxHigh = High[0];
            Then just reset the variable at the start of a new session. You can use Bars.SessionBreak or Bars.FirstBarOfSession
            You're right - much more efficient approach. The Bars.SessionBreak/Bars.FirstBarOfSession constants really help doing it this way. I will rewrite it as suggested - many thanks for the tips.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            602 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            347 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
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            559 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X