• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.

            https://msdn.microsoft.com/en-us/lib...or=-2147217396

            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.
              Patrick H.NinjaTrader Customer Service

              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.

                https://msdn.microsoft.com/en-us/lib...or=-2147217396

                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 uiwislth, Yesterday, 11:25 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post uiwislth  
                  Started by Steve L, Yesterday, 10:04 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post Steve L
                  by Steve L
                   
                  Started by marianfed, Yesterday, 09:47 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post marianfed  
                  Started by hir04068, Yesterday, 09:29 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post hir04068  
                  Started by iq200, 03-11-2018, 07:49 PM
                  24 responses
                  1,017 views
                  0 likes
                  Last Post mrlucky1x  
                  Working...
                  X