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

Need help getting started with Ninjascript.

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

    Need help getting started with Ninjascript.

    I have been unable to find an explanation of how to express a Ninjascript Boolean ‘NOT’ [I am aware that I can say ‘if variable == false’]. This has led to a realization that I now need to know the details of how to use the Visual Basic language within Ninjascript [eg] I have been unable to find a list of Ninjascript reserved words. Now that I need to write more than just an extremely simple strategy I will appreciate suggestions and/or links to some educational material, comprehensive user’s guides, etc. I have not yet been able to find what I need in 'The NinjaTrader User’s Guide', such as a discussion about a Boolean ‘NOT’.

    #2
    Thats a discussion for C#, not ninjascript.

    And there is no VB in ninjascript.

    http://www.blackwasp.co.uk/CSharpBooleanOperators.aspx

    Originally posted by joemiller View Post
    I have been unable to find an explanation of how to express a Ninjascript Boolean ‘NOT’ [I am aware that I can say ‘if variable == false’]. This has led to a realization that I now need to know the details of how to use the Visual Basic language within Ninjascript [eg] I have been unable to find a list of Ninjascript reserved words. Now that I need to write more than just an extremely simple strategy I will appreciate suggestions and/or links to some educational material, comprehensive user’s guides, etc. I have not yet been able to find what I need in 'The NinjaTrader User’s Guide', such as a discussion about a Boolean ‘NOT’.

    Comment


      #3
      at least one reference which describes Ninjascript?

      Is the following an accurate statement?

      Ninja strategies are written in Ninjascript. VB is involved only in that Ninjascript looks very similar to VB. Therefore, at a minimum, I need to find a reference which describes Ninjascript syntax, reserved words, etc.

      Comment


        #4
        Originally posted by joemiller View Post
        Is the following an accurate statement?

        Ninja strategies are written in Ninjascript. VB is involved only in that Ninjascript looks very similar to VB. Therefore, at a minimum, I need to find a reference which describes Ninjascript syntax, reserved words, etc.
        I've never programmed in VB, or know what it looks like.

        It is C#, .NET.

        The reserved NinjaScript words are basically those found in the help manual:



        Scott Daggett is about the only who has written a book on how to program in NinjaScript. He's a NT partner. I don't own the book, so I can not comment on it's quality or how in depth he goes. I'm using one of his indicators he posted for free here, with some modifications,as I don't like to reinvent the wheel.

        His website is http://ninjalaunchpad.com/
        There is kind of a review here: http://emini-watch.com/learn-ninjascript

        There is a sample here: http://www.smashwords.com/books/view/164698


        * Advanced C# development using NinjaScript®

        Popular non-proprietary C# programming language
        Extensible via the .NET Framework

        Comment


          #5
          thanks for the good help, quick replles, etc.

          I have not yet found an explanation in the Help Manual for reserved words and symbols for Boolean operators for instance for 'NOT', 'AND', etc.

          however you have gotten me aimed in the right direction I think, and things are starting to fall into place maybe.

          looks like the Daggett book for 6 bucks is a promising suggestion,

          Comment


            #6
            I just downloaded Scott Daggett's book.

            at first glance I don't see an explanation of, for example, the syntax for an 'if' statement. shouldn't that kind of info be in a user's manual?

            Comment


              #7
              6 bucks well spent.

              Scott's book is nicely done and appears to be just what I need. 6 bucks well spent.

              he does say 'If you don’t already know how to program in Microsoft C#.NET, then learn that first', which explains why nowhere in his book or in the Ninjascript help guide is the 'if' statement discussed. leaving one to determine by experimentation that the form 'if variable == FALSE' must be used rather than 'if NOT variable'. although in a perfect world that would have been said. anyhow thanks a lot for your help. i am now much better oriented to carry on.

              Comment


                #8
                Originally posted by joemiller View Post
                Scott's book is nicely done and appears to be just what I need. 6 bucks well spent.

                he does say 'If you don’t already know how to program in Microsoft C#.NET, then learn that first', which explains why nowhere in his book or in the Ninjascript help guide is the 'if' statement discussed. leaving one to determine by experimentation that the form 'if variable == FALSE' must be used rather than 'if NOT variable'. although in a perfect world that would have been said. anyhow thanks a lot for your help. i am now much better oriented to carry on.
                There is no "if NOT variable".

                It is "if !variable"

                It comes down to style and preference and what you find easier to read.



                Most of these languages are very similar these days, they all have mostly the same setup structures and program flow. One may use ! and another may use NOT.

                One may use := for variable assignment, other simply =.

                a := TRUE;
                a = true;

                Your question is more related to how the language is setup. There is a load of information on the internet about C#.

                C# isn't my first language these days, (I've had a pretty long history of assembly, C, C++, Oracle pl/sql, some Java, some Eiffel, etc. ).... So I do find myself searching for correct syntax or how to do something. Yesterday, I had an exception opening a file, so I had to look up how to handle/catch exceptions (try/catch in C#).

                Comment


                  #9
                  I have just learned that an exclamation point is 'NOT'

                  thanks Sledge. I have just learned that an exclamation point is 'NOT'.

                  if(Open[0]>=redline & hit_redline_yest == false)
                  if(Open[0]>=redline & !hit_redline_yest) //<--same thing as above

                  which has been my main concern all along [ie] that I was unable to find an explanation of that, which confused me. per your point [ie] 'style and preference', '==FALSE' is my choice because i'm a seat of the pants programmer at best and I don't have to remember the meaning of an exclamation point.

                  I was stalled but now have some momentum in my thirst and quest for knowledge...for which I thank you again.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by traderqz, Yesterday, 09:06 AM
                  3 responses
                  21 views
                  0 likes
                  Last Post NinjaTrader_ThomasC  
                  Started by f.saeidi, Today, 10:19 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by kujista, Today, 06:23 AM
                  5 responses
                  15 views
                  0 likes
                  Last Post kujista
                  by kujista
                   
                  Started by traderqz, Today, 12:06 AM
                  3 responses
                  6 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by RideMe, 04-07-2024, 04:54 PM
                  5 responses
                  28 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X