Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Forex PnL calculation

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

    Forex PnL calculation

    Hi,
    I'm a newbie to NT and have a couple of questions re currency trading.

    Where do I input leverage information? I see that if I open the Instrument Editor I can enter a margin value, but margin in forex is determined at the time I start a trade and will be lot size x no. of lots x base currency / leverage (1 minilot EURUSD @ 1.25 = 12500 / 50 leverage = 250, amount that I put on the table to start my trade). Where does all this information fit into NT?

    2nd question. I see that PnL calculation is kept in the quote currency. No problem if the quote currency is USD. But if I trade USDJPY I get PnL calculated in JPY. If I run a backtest on a basket of currencies, the cumulative profit figure I get is a mix of different currencies. The only solution I see at the moment is to export each symbol result to Excel and then recalculate everything in a spreadsheet. Am I right?

    Thanks for helping me!

    #2
    Hello,

    Thanks for the note.

    The margin code in NinjaTrader is primary used for Stocks. For Forex this is more of a grey area that we do not have any documentations on.

    This margin setting here is margin per contract that is used up when you purchase one contact.

    Remember that a mini lot in forex is 10k so 1 mini lot would consume 10,000 margin you wouold need to have in the account.

    You can set simulator account margin in the control center->tools->simulator tab and then Margin setting.

    I would recommend just playing with some values here until you get it how you like it.

    As far as your second question everything in NinjaTrader needs to be converted back into USD. With backtesting you need to have data available in history to make the conversion. It is a good idea to bring up charts goiing back as far back as your are backtesting for conversion pairs. This way NinjaTrader can apply conversion to the point value to get the native pair currency into USD.

    If you look at the executions tab there is a rate column. If this rate is a value of 0or 1 then no conversion has taken place. If conversion has taken place there wil be a .00138 balue here for example and will change depending on the currency conversion rate at the time of the trade.

    Let me know if I can be of further assistance.

    Comment


      #3
      I am currently evaluating whether Ninjatrader will provide the framework I need to move forward on my project.

      I just wanted to weigh in on this thread (and a few others) to identify this point as a barrier to using Ninjatrader for my project.

      MQL5 provides a method, OrderCalcMargin, which tells you the amount of margin that would be required to place an anticipated FOREX order. This can be compared against the available margin, so that, for example, the quantity can be adjusted before placing the order. (part of money management). Also, in this way, in multi-instrument strategies, one can open positions of a consistent size (in terms of account currency) regardless of instrument.

      The return value is a complicated function of the chosen instrument, the quantity, the bid/ask of that instrument, and the bid/ask of all instruments required to convert to/from the chosen instrument and the account currency. I was really hoping I would not need to code this logic myself.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WeyldFalcon, 12-10-2020, 06:48 PM
      14 responses
      1,426 views
      0 likes
      Last Post Handclap0241  
      Started by Barry Milan, Today, 10:35 PM
      0 responses
      3 views
      0 likes
      Last Post Barry Milan  
      Started by DJ888, Yesterday, 06:09 PM
      2 responses
      9 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      40 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Today, 08:51 AM
      2 responses
      16 views
      0 likes
      Last Post bill2023  
      Working...
      X