Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Negative Intergers

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

    Negative Intergers

    I'd like to setup a strategy I can apply to the TIKI to see when it hits a positive/negative variable, then play an alert.

    I've successfully set this up on the TIKI using a positive number, but I can't get it working with the TIKI hits a negative number.

    Is this some sort of limitationt in Ninja Trader, or am I doing about programing this the wrong way?

    From my limited programing experinece, I understand intergers can't be negative, but a string variable could be. But it won't accept a string when I go to program the "if >= X" portion of the stragety... for obvious reaseons.

    Any help is greatly appercaited.

    Regards,

    Brian Heyliger

    #2
    Integers are capable of being negative. Please post what you have as your code so we can further assist. Thank you.

    Also, you mean TIKI as in the index not a custom indicator correct? Thanks.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Here it is...

      I don't think the problem is with the strategy, I think it with the application of the strategy. The problem arises when I apply the strategy to the chart. So, I've included a few screen shots of what happens when I'm applying it.

      The "TICKLow" field, I populate with "-999," then when I move to the next field in the window, it automatically reverts it to the "1."

      The strategy and the screen shots are attached.

      Regards,

      Brian
      Attached Files

      Comment


        #4
        Code:
        [Description("")]
        [Category("Parameters")]
        public int TICKHigh
        {
            get { return tICKHigh; }
            set {[COLOR=Red][B] tICKHigh = Math.Max(1, value);[/B][/COLOR] }
        }
        
        [Description("")]
        [Category("Parameters")]
        public int TICKLow
        {
            get { return tICKLow; }
            set { [COLOR=Red][B]tICKLow = Math.Max(1, value); [/B][/COLOR]}
        }
        What is in red is what is causing your value to reset to 1 when you try to set anything below it. Just remove the Math.Max function and leave value.

        Code:
        set { tICKLow = value; }
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        668 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        377 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X