• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Strategy Performance - Wrong profit values?

  • Filter
  • Time
  • Show
Clear All
new posts

    Strategy Performance - Wrong profit values?


    I'm testing an automated strategy and have some issues with the Strategy Performance window: all the values in the Profit column seem to be off.

    I attached a screenshot with a sample trade.

    The scenario is simple. Assuming a $10,000 account, I want to risk 1% of my account on a trade, so $100 / trade.

    The strategy took a long trade on USDJPY:
    Quantity: 80,557
    Entry price: 109.113
    Exit price: 108.978

    So basically I had a 13.5 pip stop.

    I attached another screenshot of an online position sizing calculator.
    As you can see, in order to risk $100 on a trade, with a 13.5 pip stop and current USDJPY ask price of 109.113, position size should be 80,824 units.
    I risked even less on the trade: 80,557 units.

    So I expected to risk a $100 on the trade (or even less), but the Strategy Performance window shows a loss of $108.75. I don't understand where this came from, or how it's calculated.

    What am I missing here?

    Attached Files

    Hello sportal,

    Thanks for your post.

    The calculation will involve [(Price Entered * Quantity) - (Price Exited * Quantity)] * Point value.

    For example, you had entered at 109.113 with a quantity of 80557. (8,789,815.941)
    You had exited at 108.978. (108.978 * 80557 = 8,778,940.746)

    Entry minus Exit = -10875.195

    Multiplying this by the Point Value will give us the PnL. Since the base pair is Yen, the Point Value is 0.01.

    We are then left with 108.75 with the remainder rounded off for the loss.

    Please let me know if you have any additional questions.
    JimNinjaTrader Customer Service


      Hi Jim,

      Thanks for your reply.

      The problem is that your formula doesn't calculate with USD. It calculates with the quote currency (JPY in this case).

      I attached two new screenshots. If you look at the first screenshot, you can see that I put all the parameters into a calculator and it shows that I should have lost around $97.7 on the trade.

      Now take a look at the second screenshot. All I changed is that I switched the account currency to JPY and put in 10875 JPY as my risk, the result is the same.

      So all your formula does is that it calculates the loss in JPY (which is 10875 JPY) and multiplies it by 0.01, which won't give me the actual loss in USD.

      So the Strategy Performance window shows all the profit and loss in terms of the quote currency, not in the currency of the account (USD). All other analysis and statistics is probably off because of this.

      Could you please fix this?

      Attached Files


        Hello sportal,

        I have received your message. I have not been able to return to this inquiry but will be able to during our office hours tomorrow.

        Thanks for your patience.
        JimNinjaTrader Customer Service


          Hello sportal,

          Thanks for your patience.

          We have two different kinds of performance reports for strategies. Historical and Realtime. Trades that are made with Realtime data will have the PnL converted using the Account denomination specified when configuring the account. (Control Center > Accounts Tab > Right Click Account > Edit Account.) Trades with historical data will not have context to the conversion rate, so historical performance reported will only show PnL in terms of the quote currency. Realtime strategy performance reports will display PnL in terms of Account denomination.

          This is the general case for trades generated with realtime data and those generated with historical data. Historical trades will not have the currency conversion.

          There is one final note regarding currency conversion for Interactive Brokers that I'll include from our help guide.

          Interactive Brokers reports forex trades in the instrument currency, not the account currency, without commissions applied. So, forex trades are not applied to Realized PnL.

          Source: https://ninjatrader.com/support/help...TheAccountsTab

          You can set up a test for this by creating a simple script like the following and testing it with the playback connection.

          protected override void OnBarUpdate()
              if (State == State.Historical)
              if(Position.MarketPosition == MarketPosition.Flat)
              if(Position.MarketPosition == MarketPosition.Long && Close[0] < Position.AveragePrice - 2)
          1. Download Market Replay data for USDJPY
          2. Accounts Tab > Edit the Sim101 account to use an Account Denomination of USD. Reset the account to apply changes
          3. Restart NinjaTrader
          4. Connect to Playback
          5. Open a chart and enable the strategy.
          6. Start Playback at MAX
          This will test what results would be expected with realtime trades. Take a screenshot of the performance report.

          Now let's see what the strategy will do with historical data.
          1. Edit the strategy to comment out the if (State == State.Historical) check.
          2. Rewind playback
          3. Reload the strategy and enable it (Do not start playback)
          4. Take a screenshot of the historical performance report.
          Now, you may repeat these steps making sure that you set the Sim101 account denomination to another currency. This will change the account denomination of the Playback Connection. After testing both realtime and historical tests, you will see the same trades generated and the same PnL generated for historical trades, but realtime trades will use the conversion rate for the account denomination.

          Please let me know if I can be of further assistance.
          JimNinjaTrader Customer Service


          Latest Posts


          Topics Statistics Last Post
          Started by sgordet, Today, 10:44 AM
          1 response
          Last Post bltdavid  
          Started by Parmenides48, Today, 08:37 AM
          1 response
          Last Post Emma1
          by Emma1
          Started by EnveousColnago, 08-06-2020, 08:31 AM
          8 responses
          Last Post Emma1
          by Emma1
          Started by dieci, Today, 08:50 AM
          0 responses
          Last Post dieci
          by dieci
          Started by sabankaradeniz, 05-05-2020, 03:49 AM
          4 responses
          1 like
          Last Post tornadoatc