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

How to collect a string

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

    How to collect a string

    Good morning,
    I would want to know, is it possible to collect a string from a fullName Please?
    For example:
    I work on eur/usd and I tests a strategy on this pair, the instrument.fullName will be eur/usd.
    So, in this strategy I want to do a calcul on aud/usd and for this I would want to collect the 3 last letters on the right of the fullName.
    How can I do this please?

    Thank's a lot for your answer and your time.

    #2
    Hello,

    This can be done with string modification:
    Learn about strings in C# programming. See information on declaring and initializing strings, the immutability of string objects, and string escape sequences.



    Please note, I'm unsure as to whether or not you're doing this in OnBarUpdate() or Initialize(). If you're passing in dynamic strings to Initialize() please keep in mind that this is not supported by us as it can lead to unexpected results since Initialize() can be called other times than when starting the strategy/indicator.

    Let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Originally posted by neo-13 View Post
      Good morning,
      I would want to know, is it possible to collect a string from a fullName Please?
      For example:
      I work on eur/usd and I tests a strategy on this pair, the instrument.fullName will be eur/usd.
      So, in this strategy I want to do a calcul on aud/usd and for this I would want to collect the 3 last letters on the right of the fullName.
      How can I do this please?

      Thank's a lot for your answer and your time.
      Methinks you are looking for the Substring() method.

      ref: http://msdn.microsoft.com/en-us/library/aka44szs.aspx

      Comment


        #4
        Thank's so much at you two.
        Koganam, your post is exactly that I search.

        Thank's.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Yesterday, 09:43 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by TheWhiteDragon, 01-21-2019, 12:44 PM
        5 responses
        551 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by rtwave, 04-12-2024, 09:30 AM
        5 responses
        37 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by funk10101, Today, 12:02 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by GLFX005, Today, 03:23 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X