Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AccountSize returns 0 on JPY crosses

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

    AccountSize returns 0 on JPY crosses

    NT support,

    Could you please help me?

    I’ve got some strange behaviour happening and I don’t know if it is something I’m doing incorrectly.

    I’ve got a strategy, when I apply that strategy to a USD or EUR cross there is no problem. The strategy returns the correct account size. However, when I apply that strategy to a JPY cross the AccountSize value returns 0 when processing historical bars. I’ve used VS to inspect the variables when the strategy is being applied using the Strategies Tab (Control Centre) and when it is in backtest to confirm it is returning different values. When applied in the Strategy Tab (Control Centre) the AccountValue returns 0 on the historical bars. When applied in backtest it returns the 50000 that is set in the initialise section of the code.

    Tests i’ve done:

    1. Exactly the same strategy applied to the GBPUSD & USDJPY via the Strategies tab (Control Centre) – different AccountSize being returned
    2. USDJPY backtested in Strategy Analyser across the same dates – correct AccountSize returned
    3. GBPUSD backtest in Strategy Analyser across the same dates – correct AccountSize returned

    The code I use to segment between Historical vs real time is here:


    Code:
                double CAccountSize;
                
                if (Historical) {
                
                    CAccountSize = AccountSize + Performance.AllTrades.TradesPerformance.Currency.CumProfit;
                    
                } else {
                    
                    CAccountSize = GetAccountValue(AccountItem.CashValue);
                    
                }
    I’m setting the account size in the code:

    Code:
                AccountSize = 50000;
    I’m happy to send the code through via the usual support address if that works.


    Any help you could offer would be greatly appreciated.

    Thanks,

    drolles

    #2
    Hi drolles,

    Thanks for the strategy offer. Can you please send to [email protected] and we will give it a run here.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X