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

How to tell if the account is a simulation account

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

    How to tell if the account is a simulation account

    I'm using

    Code:
    Print("Account: " + Account.Name);
    Print("Simulation Account: " + Account.SimulationAccountName);
    Print("Simulation Name: " + Account.SimulationName);
    In OnStateChange State == State.Config

    This prints:

    Account: Sim101
    Simulation Account: Sim101
    Simulation Name: _Simulation

    I'd like to know the correct way to determine if the strategy is running on any simulation account or if it's a real account.
    Thank you!

    #2
    Hi Brillo, thanks for posting.

    The best way to find this is to check the Accounts name for a "Sim" prefix or add a simple boolean property where the user can toggle live vs simulation behavior from the properties menu. Unfortunately, there's no built-in property that will tell if the account is live or simulated.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      All sim accounts will have the "Sim" prefix regardless of what the user names the account? That's fine. It is working to test this way:

      Code:
      [Browsable(false),XmlIgnore]
      protected bool IsSimAccount { get { return Account.Name.ToLower().StartsWith("sim"); } }
      Thanks.

      Comment


        #4
        Hi Brillo,

        Yes, all custom sim accounts will start with "Sim"
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        41 views
        0 likes
        Last Post futtrader  
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        11 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        7 views
        0 likes
        Last Post port119
        by port119
         
        Started by Philippe56140, Today, 02:35 PM
        0 responses
        7 views
        0 likes
        Last Post Philippe56140  
        Started by 00nevest, Today, 02:27 PM
        0 responses
        7 views
        0 likes
        Last Post 00nevest  
        Working...
        X