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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    56 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X