Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X