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 gbourque, Today, 06:39 AM
        0 responses
        3 views
        0 likes
        Last Post gbourque  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by benmarkal, Yesterday, 12:52 PM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by helpwanted, Today, 03:06 AM
        1 response
        20 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        12 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Working...
        X