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

example code request for o-h-l-c usage

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

    example code request for o-h-l-c usage

    help requested:
    i'm looking for some example code that will show me how to use open high low close prices when using the NinjaEditor [eg] are they reserved words? or must they be declared somehow?...and if so where?

    #2
    Originally posted by joemiller View Post
    help requested:
    i'm looking for some example code that will show me how to use open high low close prices when using the NinjaEditor [eg] are they reserved words? or must they be declared somehow?...and if so where?
    The help guide?



    It's also installed locally under Help in control center.

    Comment


      #3
      thanks sledge

      when I code "xyz=open;" and xyz was defined in the user defined inputs panel and then I compile ....I get the error message 'the name xyz does not exist in the current context'.

      any thoughts/suggestions will be appreciated.

      Comment


        #4
        Originally posted by joemiller View Post
        thanks sledge

        when I code "xyz=open;" and xyz was defined in the user defined inputs panel and then I compile ....I get the error message 'the name xyz does not exist in the current context'.

        any thoughts/suggestions will be appreciated.
        It might help if you showed your actual code, so that we might be able to quide you as to what is not properly coded?

        Comment


          #5
          below is a copy of the code.
          the statement about halfway down 'hAOname=open;' (at the blue 'confused' icon)
          is the issue. it is line 50. the following two error messages are generated, both for line 50.
          'the type of namespace name "dbl" could not be found'
          'the name "open" does not exist in the current context

          I got a message 'The text that you have entered is too long (36529 characters). Please shorten it to 10000 characters long.' .... so the shortened version is below'
          #region Variables
          // Wizard generated variables
          private double hAOname = 0.015; // Default setting for HAOname

          // User defined variables (add any user defined variables below)
          #endregion
          ///<summary>
          /// This method is used to configure the strategy and is called once before any strategy method is called.
          ///</summary>
          protected override void Initialize()
          {
          CalculateOnBarClose =
          true;
          }
          ///<summary>
          /// Called on each bar update event (incoming tick)
          ///</summary>
          protected override void OnBarUpdate()
          // my stuff ///////////////////////////////////////

          {
          hAOname=open;
          }

          // end my stuff //////////////////////////////////

          Comment


            #6
            Please try with hAOname = Open[0];

            NinjaScript as C# is case sensitive and you want to access a double value of your Open series value, so an index needs to be applied (in the [ brackets ]).

            BertrandNinjaTrader Customer Service

            Comment


              #7
              solved....many thanks

              you nailed Bertrand,

              after considerable false starts, your fixes + a couple other resolved issues resulted in a clean compile.

              many thanks

              Comment


                #8
                correction to last reply

                that should have been "you nailed it Bertrand" not "you nailed Bertrand"

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                601 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                22 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                18 views
                0 likes
                Last Post Pattontje  
                Started by flybuzz, 04-21-2024, 04:07 PM
                17 responses
                230 views
                0 likes
                Last Post TradingLoss  
                Started by agclub, 04-21-2024, 08:57 PM
                3 responses
                17 views
                0 likes
                Last Post TradingLoss  
                Working...
                X