Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

selecting

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

    selecting

    Hi,

    I have an indicator where you can select the instrument at the parameters section.
    Is posible to change automatically other 2 variables depending the instrument i have selected in parameters?
    I mean, for example, if i choose EurUsd, variable 1 sets to 0,005 and variable 2 sets to 0,003 instantly so i don´t have to write them manually.

    -Parameters
    Instrument .... EurUsd
    Variable 1 ..... 0,005
    Variable 2 ..... 0,003.

    If ai choose , EurJpy, then

    -Parameters
    Instrument .... EurUsd
    Variable 1 ..... 0,0002
    Variable 2 ..... 0,0007.

    Hope you understand me and excuse my english

    Thanks

    #2
    txarly,

    Unfortunately this is not supported. You could try it from inside your OnBarUpdate code. If x is selected for the instrument, change all parameters to a certain setting. If y is selected, change all of them to something else.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Its not a problem.
      In properties section on first parameter add in set
      if (param1 == "US..") {
      param2 = 1234;
      param3 = 4567;
      } else if (param1 == "JEN..") {
      param2 = 4321;
      param3 = 7654;
      }

      Baruch

      Comment


        #4
        Glad you got it to work.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          mmm

          i got this error:

          The operator '==' can't be applied to operands like 'Instrumselect' and 'string'.
          My code:

          Code:
          [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Instrumselect Subyacente[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]get[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] { [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] instrum; }[/SIZE][/FONT]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]set[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] { instrum = value;[/SIZE][/FONT]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (instrum == [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"EurUsd"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]) [/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{ [/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]emaresta = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0.0003[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]emasdif = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0.0008[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; } [/SIZE][/FONT]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (instrum == [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"EurJpy"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]) [/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]emaresta = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0.005[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]emasdif = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0.001[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; } [/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]}[/FONT][/SIZE][/SIZE][/FONT]

          Comment


            #6
            Is it enum or string?

            Comment


              #7
              I use switch like:
              [RefreshProperties(RefreshProperties.All)]
              public TradeInstrument p100_TInst
              {
              get { return TInst; }
              set {
              TInst = value;
              switch(TInst)
              {
              case (TradeInstrument.SixA15Min):
              .......
              Also add [RefreshProperties(RefreshProperties.All)]

              Baruch

              Comment


                #8
                That is not a string type object so you can't assign it to a string.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  yes

                  Perfect Baruch, now works perfect.
                  Thanks to all

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by algospoke, Yesterday, 06:40 PM
                  2 responses
                  23 views
                  0 likes
                  Last Post algospoke  
                  Started by ghoul, Today, 06:02 PM
                  3 responses
                  14 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  45 views
                  0 likes
                  Last Post jeronymite  
                  Started by Barry Milan, Yesterday, 10:35 PM
                  7 responses
                  22 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  10 responses
                  181 views
                  0 likes
                  Last Post jeronymite  
                  Working...
                  X