Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Retrieving Currency Rates

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

    Retrieving Currency Rates

    Hi there,

    My Sim101 account is in British Pounds. When trading a foreign asset like Germany30 (denominated in Euros), I noticed that the executions table provides the current EURGBP rate, which was used to convert my profit from Euros into British pounds to display the correct PNL in British Pounds on the Accounts tab.

    Click image for larger version  Name:	image_2021-02-25_112301.png Views:	0 Size:	34.3 KB ID:	1143529

    I was wondering how Ninjatrader retrieves this information and is there any way for me to get access to current exchange rate information programmatically?

    I note there are a number of CurrencyRequest classes, but I'm not sure how to use them. Any advice for retrieving these rates would be greatly appreciated.

    Click image for larger version  Name:	image_2021-02-25_112518.png Views:	0 Size:	9.7 KB ID:	1143531
    Attached Files

    #2
    Hello kevinenergy, thanks for writing in.

    NinjaTrader uses either a currency pair or a currency futures instrument to get the conversion rate. To get the conversion rate programmatically, add an "EURGBP" series to your script with AddDataSeries, then you can reference the price of EURGBP to convert the price in real time.

    https://ninjatrader.com/support/help...dataseries.htm - AddDataSeries()

    https://ninjatrader.com/support/help...nstruments.htm - multi time frame and instrument overview

    Please let me know if you have any questions on this material
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris thanks for your response and the information.
      It's actually an Addon I'm working with, so I don't think AddDataSeries is compatible.
      Is there any other way?

      Thanks for your support!

      Comment


        #4
        Hello kevinenergy, thanks for your reply.

        Yes, you can do this in an Addon. We have a full example of the functionalities of an Addon here that you can download, see the commented section "// When user presses the Realtime Data button"

        This will show you how to do a bars request to get the real time data of any instrument.

        https://ninjatrader.com/support/help...t_overview.htm - Download on this page

        Kind regards.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AaronKoRn, Today, 09:49 PM
        0 responses
        5 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Today, 08:42 PM
        0 responses
        8 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Today, 07:51 PM
        0 responses
        9 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,975 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Today, 06:48 PM
        0 responses
        9 views
        0 likes
        Last Post rbeckmann05  
        Working...
        X