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

NinjaScript: Symbol for Currency

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

    NinjaScript: Symbol for Currency

    Is there a NinjaScript function that returns a Currency's symbol?

    In particular, I'm accessing currency configured for an instrument through Bars.Instrument.MasterInstrument.Currency.

    I wish to display this currency in its equivalent currency sign or three-character ISO 4217 currency symbol:
    UsDollar ==> $ or USD
    Euro ==> € or EUR
    BritishPound ==> £ or GBP
    etc.

    Is there a way through NinjaScript coding?

    Kind Regards
    Vivek
    Last edited by engrvivs; 06-23-2016, 12:41 AM.

    #2
    Hello Vivek,

    Thank you for your post.

    You would override ToString(). For example:
    Code:
    		public override string ToString()
    		{
    			if (Instrument.MasterInstrument.Currency.ToString() == "Euro")
    				return "€";
    			else
    				return Name;
    		}

    Comment


      #3
      Thanks Patrick for the response!

      So, this means I need to create whole if-else series for all allowed "Currency" in NT.

      Where can I find all possible NT "Currency" values, so that I can create such a function?

      Kind Regards
      Vivek

      Comment


        #4
        Hello Vivek,

        Thank you for your response.

        Go to Tools > Instrument Manager > select any instrument > Edit > then left click on the Currency. All available currencies will be listed here.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by maybeimnotrader, Yesterday, 05:46 PM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Perr0Grande, Yesterday, 08:16 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by f.saeidi, Yesterday, 08:12 AM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by algospoke, Yesterday, 06:40 PM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by quantismo, Yesterday, 05:13 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X