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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    67 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    60 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X