Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Select second account

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

    Select second account

    Hi traders! I have a little problem with my strategy.

    It works on 2 account, but i would like to select the second account when i set my parameters. How can i do it?

    Thank in advance for the assistance,

    Bergimax

    #2
    Hello bergimax,

    Thanks for your post.

    You can select the account to use for your strategy when you apply the strategy to the chart or apply the strategy in the strategies tab. This would be selected in the "set-up" section of the strategy properties window.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank's for the replay, Paul!
      My problem is about this code:

      lock( Account.Accounts )
      myAccount = Account.Accounts.FirstOrDefault( a => a.Name == "Sim102" );

      For one instrument i would like to use Sim102, for other instrument the Sim 103.
      I would like to create another script, only for this.

      I would like to create a variable where i decide my second account in the strategies tab.

      Comment


        #4
        Originally posted by bergimax View Post
        Thank's for the replay, Paul!
        My problem is about this code:

        lock( Account.Accounts )
        myAccount = Account.Accounts.FirstOrDefault( a => a.Name == "Sim102" );

        For one instrument i would like to use Sim102, for other instrument the Sim 103.
        I would like to create another script, only for this.

        I would like to create a variable where i decide my second account in the strategies tab.
        "Sim102" is a string. So use a string or an enum to be your public parameter and reference that parameter in your code.
        Last edited by koganam; 01-12-2016, 02:57 PM.

        Comment


          #5
          Hello bergimax,

          Thanks for your post.

          Member koganam advised a solution concept. Did that satisfy your needs?
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Thank's Kogonam and Paul for the assistance!

            Yes, the Kogonam's answer it's what i need.
            Only the last question, how can i create a drop down menu?
            I try in this way, but i have an error..

            private simulator second.SIM102.; // in variables

            // this in the region properties
            [ NinjaScriptProperty]
            [Display(ResourceType = typeof(Custom.Resource), Name = "SAccount", GroupName = "NinjaScriptStrategyParameters", Order = 0)]
            public simulator second
            { get; set; }

            // this is the loop

            switch( second )

            case simulator.SIM102 :
            break;
            case simulator.SIM103:
            break;
            .
            .
            .
            .
            defalt:
            // do something


            Where i mistake?

            Thank's a lot!

            Comment


              #7
              Hello bergimax,

              Thanks for your reply.

              I've created a quick example for you which can be imported and applied to a chart. It does nothing (nothing in onbarupdate) but in the strategies user interface properties window you can choose between the sample accounts listed. I added notes in the .cs file at the top where the enum is located.
              Attached Files
              Paul H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pibrew, Today, 06:37 AM
              0 responses
              4 views
              0 likes
              Last Post pibrew
              by pibrew
               
              Started by rbeckmann05, Yesterday, 06:48 PM
              1 response
              14 views
              0 likes
              Last Post bltdavid  
              Started by llanqui, Today, 03:53 AM
              0 responses
              6 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Started by burtoninlondon, Today, 12:38 AM
              0 responses
              11 views
              0 likes
              Last Post burtoninlondon  
              Started by AaronKoRn, Yesterday, 09:49 PM
              0 responses
              16 views
              0 likes
              Last Post AaronKoRn  
              Working...
              X