Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Record own code snippet ?

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

    Record own code snippet ?

    Hi,

    I was reading about Intellisense and Code Snippets and I saw that you have a lot of hotkeys with tab that reveal different code portions.

    Is there a way to record a new one ?

    (For those that do not know that trick you can eg. write if and then press tab and the "if " will be replace with

    if (expression)
    {
    }
    else
    {

    in Ninjascript.

    Now I have my own code and I would like to store so that I do not have to write entire functions with try catch blocks from scratch

    Thanks in advance!!!

    #2
    Hello TakisTakis,

    Unfortunately this is not supported. Thank you for the suggestion.

    As a hint, take a look at:
    \Program Files\NinjaTrader\bin\custom\snippet

    We cannot assist in creating these but it may be possible if you feel like playing around a bit.

    You can see a list of available intellisense shortcuts here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan I will look at it, there may be a couple of things I can do.

      Comment


        #4
        TakisTakis, I was interested in doing the same thing. Microsoft Visual Studio supports the creation of the XML snippet files. Here is a link with more details on creating your own snippets. http://msdn.microsoft.com/en-us/libr...94(VS.80).aspx
        The Trading Mantis
        NinjaTrader Ecosystem Vendor - The Trading Mantis

        Comment


          #5
          Thanks I will look at it!

          Comment


            #6
            Visual Studio 2010 does most of that out-of-the-box for regular C# expressions such as "if" statements, and there is a free extension that allows you to create you own code snippets called Snippet Designer.

            Intellisense information would come from comments with three of these /// just before the method. Here is an example snippet for OnStartUp():

            PHP Code:
             /// <summary>
             /// Called once when the stratgey is first enabled
             /// </summary>
             protected override void OnStartUp()
             {
             } 
            
            You can also drag frequently used code into the toolbox in Visual Studio for reuse in other projects.

            On the Open Source front I've heard good things about Notepad++ though I've never tried it myself and don't know if it helps in the snippets department.

            Comment


              #7
              Thanks MXASJ, I'll have to checkout the upgrade to VS10.

              I've been using Notepad++ for several months and really like it as a general text editor. It is also great for editing large data files before importing into NinjaTrader. It looks like it would be a good editor for programming too.
              The Trading Mantis
              NinjaTrader Ecosystem Vendor - The Trading Mantis

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              571 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              330 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              549 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              549 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X