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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        161 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        308 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        349 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X