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 Mindset, 05-06-2023, 09:03 PM
              10 responses
              262 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by michi08, 10-05-2018, 09:31 AM
              5 responses
              741 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by The_Sec, Today, 02:29 PM
              0 responses
              2 views
              0 likes
              Last Post The_Sec
              by The_Sec
               
              Started by tsantospinto, 04-12-2024, 07:04 PM
              4 responses
              62 views
              0 likes
              Last Post aligator  
              Started by sightcareclickhere, Today, 01:55 PM
              0 responses
              1 view
              0 likes
              Last Post sightcareclickhere  
              Working...
              X