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 ketostrongdiet, Today, 12:34 AM
        0 responses
        6 views
        0 likes
        Last Post ketostrongdiet  
        Started by ketostrongdiet, Today, 12:33 AM
        0 responses
        5 views
        0 likes
        Last Post ketostrongdiet  
        Started by mattdowns1234, Yesterday, 06:57 PM
        0 responses
        16 views
        0 likes
        Last Post mattdowns1234  
        Started by dgee949, Yesterday, 06:26 PM
        0 responses
        26 views
        0 likes
        Last Post dgee949
        by dgee949
         
        Started by dgee949, Yesterday, 05:58 PM
        0 responses
        32 views
        0 likes
        Last Post dgee949
        by dgee949
         
        Working...
        X