Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MAX problem

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

    MAX problem

    Hello i'm check my indicator on HISTORY and i got the problem with MAX().

    Code:
    int daysBackStart = 7;
    int daysBackFinish = 3;
    
    DateTime today = DateTime.Now;
    DateTime beginDay = today.AddDays(-1*daysBackStart);
    DateTime endDay = today.AddDays(-1*daysBackFinish);
    
    
    // OnBarUpdate
    
    int startBar = CurrentBar - Bars.GetBar(beginDay);
    int endBar = CurrentBar - Bars.GetBar(endDay);
    
    int fromBar = startBar+10;
    double myMax = MAX(High,10)[fromBar]; // if fromBar < 0 i have exception "needed to be between 0 and 34100 but was -47 error."
    In NT7 all works fine. Why in NT8 i can't count MAX with "fromBar < 0"?
    Last edited by nordseven; 01-31-2017, 07:28 AM.

    #2
    Hello Nordseven,

    Thank you for your note.

    Passing a negative index in NT7 worked but was not supported. In NT8 it neither works nor is supported. A negative index value only works historically and never in live data.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Of course i need assistance.
      How i can count MAX on history bars?
      And where is the line between history bars and real time?

      Comment


        #4
        Hello Nordseven,

        Passing a negative value as a bar index in NT8 is not supported.

        I would suggest checking to make sure the bar index value is not negative.

        So prior to,

        double myMax = MAX(High,10)[fromBar];

        You could add,

        if(fromBar<0) return;

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sjsj2732, Yesterday, 04:31 AM
        0 responses
        24 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        282 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        280 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        130 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X