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

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
    Aylin
    NinjaTrader Ecosystem Vendor - RealTime Trading Global

    #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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    26 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, Yesterday, 09:53 PM
    2 responses
    49 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    191 views
    0 likes
    Last Post Hasadafa  
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,230 views
    0 likes
    Last Post xiinteractive  
    Working...
    X