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

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 Haiasi, 04-25-2024, 06:53 PM
              2 responses
              16 views
              0 likes
              Last Post Massinisa  
              Started by Creamers, Today, 05:32 AM
              0 responses
              4 views
              0 likes
              Last Post Creamers  
              Started by Segwin, 05-07-2018, 02:15 PM
              12 responses
              1,785 views
              0 likes
              Last Post Leafcutter  
              Started by poplagelu, Today, 05:00 AM
              0 responses
              3 views
              0 likes
              Last Post poplagelu  
              Started by fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,407 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Working...
              X