Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Default Account while Running a NinjaScript Strategy from a Chart

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

    Default Account while Running a NinjaScript Strategy from a Chart

    Hello,

    I am running a NinjaScript from a chart window. Most of the properties are able to be set in the NinjaScript (Parameters, Order Handling etc.).

    Can I define an account other than Sim101 as the default account for automated trading (not ATI)? Anywhere in the options menu or in the NinjaScript (maybe in the initialize()-section of the script)?

    Thanks a lot.

    Joerg
    Last edited by Joerg; 08-27-2009, 03:30 AM.

    #2
    Joerg, unfortunately this is not supported with NinjaTrader 6.5 - but you can try for example this at the OnBarUpdate start for never trading in Sim and then go from there, account name is a string -

    Code:
     
    if (AccountName == "Sim101") return;
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      does this mean it will be possible in version 7? I really need the possibility to start NinjaSkripts running on a live account without manual action.

      I tried to do it in the code like it´s possible for "EntriesPerDirection" or other settings but AccountName seems to be readonly.

      Code:
       
      #region Variables
      string accountName = "Tim101";
       
      #region Properties
      [Description("Account used for Trading")]
      [Category("General")]
      public string AccountName 
      {
      get { return accountName; } 
      set { base.AccountName = accountName; } }
      Why not giving the user this possibility? If one is able to do so he typically knows what he does or at least what´s the risk of that?

      Thanks.

      Kind regards,

      Joerg
      Last edited by Joerg; 08-28-2009, 06:10 AM.

      Comment


        #4
        You cannot change the account a strategy is running on while already running. This will not change in NT7.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Is it possible to use "AccountName" in an indicator? I always get the message -"AccountName" does not exist in the current context-.
          Maybe I missed a using statement?

          Thanks a lot.

          Joerg


          Originally posted by NinjaTrader_Bertrand View Post
          Joerg, unfortunately this is not supported with NinjaTrader 6.5 - but you can try for example this at the OnBarUpdate start for never trading in Sim and then go from there, account name is a string -

          Code:
           
          if (AccountName == "Sim101") return;

          Comment


            #6
            Unfortunately this would not work for indicators Joerg.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by Joerg View Post
              Hi Bertrand,

              does this mean it will be possible in version 7? I really need the possibility to start NinjaSkripts running on a live account without manual action.

              I tried to do it in the code like it´s possible for "EntriesPerDirection" or other settings but AccountName seems to be readonly.

              Code:
               
              #region Variables
              string accountName = "Tim101";
               
              #region Properties
              [Description("Account used for Trading")]
              [Category("General")]
              public string AccountName 
              {
              get { return accountName; } 
              set { base.AccountName = accountName; } }
              Why not giving the user this possibility? If one is able to do so he typically knows what he does or at least what´s the risk of that?

              Thanks.

              Kind regards,

              Joerg
              Hi Bertrand,

              I tried this, on NT7, but it shows the wellknown error message after compiling... Would it be possible to ask the system which account it is working on? I would just like to put it in my logfile.

              Thanks,
              Péter

              Comment


                #8
                Welcome to the forums Péter, this will unfortunately not work if you're from an indicator - only the strategy could access the unsupported Account.Name
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by andrewtrades, Today, 04:57 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                5 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                436 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                7 views
                0 likes
                Last Post FAQtrader  
                Started by rocketman7, Today, 09:41 AM
                5 responses
                19 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X