Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Live or Demo account?

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

    Live or Demo account?

    Hello,

    is there a way to detect if account my strategy is connected to is Live mode or simulation mode?

    Thanks for help

    Paul

    #2
    Hello kujista,

    Thank you for your post.

    The Account property has the account object a strategy is running on.

    Below is a link to the help guide.​

    https://ninjatrader.com/support/helpGuides/nt8/strategy_account.

    Please let us know if you have any further questions.

    Comment


      #3
      Thank you for response. Could you please tell me how exactly i know that we are running on live account?

      Comment


        #4
        Hello kujista,

        There is no way for the strategy to know whether the accounts selected are simulation accounts or live accounts, so you would need to get the Account.Name and check if it is the Sim101 account, for example.

        if (Account.Name == "Sim101")
        Print("this is a simulation account);

        Please let us know if you have any further questions.

        Comment


          #5
          This is pitty :-/ I use this code
          Code:
          if (account.Name == "Playback101")
          
          {
          
          tradingMode = EnumModeTrading.Replay;
          
          } else if (account.Name.Contains("DEMO"))
          
          {
          
          tradingMode = EnumModeTrading.Backtest;
          
          } else if (int.TryParse(account.Name, out accNr))
          
          {
          
          tradingMode = EnumModeTrading.Live;
          
          }
          ​
          trying to detect live account, is there a way get formats of account names? i mean especially for live accounts? According to account type - live or demo i do some logic in sending notification mails. different levels of loging trades.. etc.

          Comment


            #6
            Hello kujista,

            Live account names are determined by your broker and do not have a set format. I suggest getting the account names of all your live accounts, then you can check them similarly to checking if the Account.Name == "Sim101".

            Please let us know if you have any further questions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X