Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MonitorAccount - Sim101 and LIVE Trading differences

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

    MonitorAccount - Sim101 and LIVE Trading differences

    Hi,
    i have developed a strategy which is running perfect for a Simulation Account but its not working with a LIVE Account.

    The Strategy takes 1 Parameter as String, the AccountName must be entered. Like "Sim101", which is working all the time. This are my lines of code to get the MonitorAccount:


    private Account MonitorAccount = null;

    .....

    if (State == State.Configure)
    {
    lock (Account.All)
    MonitorAccount = Account.All.FirstOrDefault(a => a.Name == AccountName);

    }

    Is there maybe something else iam missing?, thx

    #2
    Hello,

    Thank you for the post.

    Without being able to see both the input name printed along with each of the names listed in the account collection, I wouldn't be able to say why there was no match.

    A simple approach would be for you to Print the values here to see why this was not true.

    Before the line where you assign the account:

    Code:
    MonitorAccount = Account.All.FirstOrDefault(a => a.Name == AccountName);
    Add in a Print and a for loop:
    Code:
    for(int i = 0; i < Account.All.Count; i++)
    {
    	Account acc = Account.All[i];
    	Print("user selected account: " + AccountName + " account in NinjaTrader Account.All: " + acc.Name);
    }
    user selected account: Sim101 account in NinjaTrader Account.All: Backtest
    user selected account: Sim101 account in NinjaTrader Account.All: Playback101
    user selected account: Sim101 account in NinjaTrader Account.All: Sim101
    This would output the string name of what you had entered and what is in the accounts collection. If there is no match, you should be able to see why.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    55 views
    0 likes
    Last Post CarlTrading  
    Working...
    X