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

Currency designation

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

    Currency designation

    The code below returns a double, but not the currency symbol.
    Position.GetProfitLoss(Close[0], PerformanceUnit.Currency)

    How can the currency symbols such as the dollar sign "$", the Pound sign "£", and the Euro sign "€", be obtained? Such as how the Chart trader is able to display the correct currency symbol in the PnL.

    thank,
    Zac
    zacwhitesi
    NinjaTrader Ecosystem Vendor - Shark Indicators

    #2
    Hi Zac,

    Using the code in your snippet will return the numerical value of PnL in terms of currency, but will not add a specific currency symbol. To accomplish this, you will need to append the currency symbol using a string, like so:

    Print("$" + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);

    Please let me know if I can assist further.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      How can the currency symbols be obtained from NinjaScript?
      zacwhitesi
      NinjaTrader Ecosystem Vendor - Shark Indicators

      Comment


        #4
        Hi Zac,

        There is not a method that will return currency symbols and append them to numerical data out of the box, although you could create a method that will do this for you. The GetProfitLoss() method will always return a double value, but you can always append currency symbols on your own.

        In Chart Trader, the currency symbol shown in the PnL field comes from your regional settings in Windows. However, the PnL numbers will always be quoted in USD, regardless of the symbol that is shown.

        Please let me know if I can assist further.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_DaveI View Post
          In Chart Trader, the currency symbol shown in the PnL field comes from your regional settings in Windows. However, the PnL numbers will always be quoted in USD, regardless of the symbol that is shown.
          I disagree as the chart trader shows here... http://screencast.com/t/wudmwFVczFT
          My windows region is U.S. - English
          NKY.. http://www.cmegroup.com/trading/equi...ProductId=7401

          How did the chart trader get the Yen symbol? The chart trader shows that the currency symbol is known by Ninja. The question is how can it be accessed by code?

          Thanks,
          Zac
          zacwhitesi
          NinjaTrader Ecosystem Vendor - Shark Indicators

          Comment


            #6
            Hello Zac,

            There is no list or object for storing that is done here. The ChartTrader will check the MasterInstruments Currency and then apply the appropriate symbol to match the PnL Display for the instrument.

            The symbol that you want is just a string that is being added.

            Dave was right in his first post in that you will need to check the MasterInstrument Currency and then apply the appropriate symbol to the display.

            if(Instrument.MasterInstrument.Currency == Euro)
            {
            Print("€" + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency));
            }

            Let me know if I can be of further assistance.
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ttrader23, Today, 09:04 AM
            0 responses
            2 views
            0 likes
            Last Post ttrader23  
            Started by geotrades1, Today, 07:54 AM
            8 responses
            18 views
            0 likes
            Last Post geotrades1  
            Started by SnailHorn, Today, 08:38 AM
            1 response
            1 view
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
            26 responses
            145 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by leonardomocci, Today, 08:28 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Working...
            X