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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            92 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            138 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            122 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            73 views
            0 likes
            Last Post PaulMohn  
            Working...
            X