Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

string text question

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

    #16
    Originally posted by NinjaTrader_PatrickH View Post
    Hello duck_CA,

    Thank you for your post.

    Attached is the full script that works on my end.

    Please let me know if you have any questions.
    thank you so much! looks great!

    think i see why the prior code didn't work

    Code:
    private Days day = Day.Monday;
    new

    Code:
    private Day day = Day.Monday;

    and

    Code:
     [Description("")]
            [GridCategory("Parameters")]
            public Days Day
            {
                get { return day; }
                set { day = value; }
            }
    new

    Code:
     [Description("")]
            [GridCategory("Parameters")]
            public Day Day
            {
                get { return day; }
                set { day = value; }
            }

    Comment


      #17
      can you tell me if the indicator you provided is v8 compliant?

      thanks!

      Comment


        #18
        Hello duck_CA,
        NinjaTrader 7 scripts will need to be re-coded for NinjaTrader 8: http://ninjatrader.com/support/helpG...ng_changes.htm
        BrandonNinjaTrader Customer Service

        Comment


          #19
          Hi Patrick,

          can you tell me why the following code will not compile correctly?
          which = (i==1) ? lvnBrush : hvnBrush : svnBrush ;
          the original code below works fine but i'm trying to add one more
          which = (i==1) ? lvnBrush : hvnBrush ;
          thanks,

          I added the svnBrush to all other areas in editor without errors

          Comment


            #20
            That's because the ?: operator only supports two results based of a true of false condition.

            Learn about the C# ternary conditional operator, (`?:`), that returns the result of one of the two expressions based on a Boolean expression's result.


            You would need to add a secondary condition to the last result of the first ?: operator

            Example-
            Code:
            which = (i==1) ? lvnBrush : (i==2 ? hvnBrush : svnBrush );

            Comment


              #21
              Hello duck_CA,

              Calonious is correct on how to handle this.

              Comment


                #22
                thank you!!!

                Originally posted by Calonious View Post
                That's because the ?: operator only supports two results based of a true of false condition.

                Learn about the C# ternary conditional operator, (`?:`), that returns the result of one of the two expressions based on a Boolean expression's result.


                You would need to add a secondary condition to the last result of the first ?: operator

                Example-
                Code:
                which = (i==1) ? lvnBrush : (i==2 ? hvnBrush : svnBrush );

                Comment


                  #23
                  Another option is use to a switch case if you start getting more scenarios you need to test for
                  Example
                  Code:
                  switch(i)
                  {
                      case 1:
                            which = lvnBrush;
                            break;
                      case 2:
                            which = hvnBrush;
                            break;
                      default:
                            which = svnBrush ;
                            break;
                  }

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by herzogvladimir2, Yesterday, 08:10 PM
                  0 responses
                  15 views
                  0 likes
                  Last Post herzogvladimir2  
                  Started by giogio1, 04-13-2025, 01:42 AM
                  2 responses
                  39 views
                  0 likes
                  Last Post giogio1
                  by giogio1
                   
                  Started by mmenigma, 01-23-2024, 09:37 AM
                  1 response
                  92 views
                  0 likes
                  Last Post Nin8aTrender  
                  Started by wbayne333, 02-22-2021, 01:18 PM
                  6 responses
                  415 views
                  0 likes
                  Last Post Nin8aTrender  
                  Started by gtheaded, 07-03-2020, 03:47 PM
                  3 responses
                  374 views
                  0 likes
                  Last Post Nin8aTrender  
                  Working...
                  X