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 Segwin, 05-07-2018, 02:15 PM
              14 responses
              1,788 views
              0 likes
              Last Post aligator  
              Started by Jimmyk, 01-26-2018, 05:19 AM
              6 responses
              837 views
              0 likes
              Last Post emuns
              by emuns
               
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              6 responses
              3,293 views
              1 like
              Last Post jgualdronc  
              Started by Touch-Ups, Today, 10:36 AM
              0 responses
              13 views
              0 likes
              Last Post Touch-Ups  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              11 responses
              63 views
              0 likes
              Last Post halgo_boulder  
              Working...
              X