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 rhyminkevin, Today, 04:58 PM
              3 responses
              47 views
              0 likes
              Last Post Anfedport  
              Started by iceman2018, Today, 05:07 PM
              0 responses
              5 views
              0 likes
              Last Post iceman2018  
              Started by lightsun47, Today, 03:51 PM
              0 responses
              7 views
              0 likes
              Last Post lightsun47  
              Started by 00nevest, Today, 02:27 PM
              1 response
              14 views
              0 likes
              Last Post 00nevest  
              Started by futtrader, 04-21-2024, 01:50 AM
              4 responses
              50 views
              0 likes
              Last Post futtrader  
              Working...
              X