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 Harry, 05-02-2018, 01:54 PM
        10 responses
        3,203 views
        0 likes
        Last Post tharton3  
        Started by cre8able, Yesterday, 01:16 PM
        3 responses
        11 views
        0 likes
        Last Post cre8able  
        Started by ChartTourist, Today, 08:22 AM
        0 responses
        6 views
        0 likes
        Last Post ChartTourist  
        Started by LiamTwine, Today, 08:10 AM
        0 responses
        2 views
        0 likes
        Last Post LiamTwine  
        Started by Balage0922, Today, 07:38 AM
        0 responses
        5 views
        0 likes
        Last Post Balage0922  
        Working...
        X