Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can the Ninjascript Editor Be open to custom users F2 templates?

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

    Can the Ninjascript Editor Be open to custom users F2 templates?

    Is there currently a feature enabling users to add custom templates to the F2 menu?
    Something like adding custom snippet scripts to a <F2 Snippets> sub folder of the
    C:\Users\Administrator\Documents\NinjaTrader 8\templates

    If not could users get to be able to add their custom snippets to it?

    #2
    Hello PaulMohn,

    Thank you for your post.

    Currently, there is no supported / documented way for users to save their own custom code snippets.

    However, the snippets are located in the C:\Program Files\NinjaTrader 8\bin\Custom\Snippet folder. If you wanted to create your own code snippet file from scratch, you can save it in that folder.

    If you are interested, I can submit a feature request to have this feature implemented.

    Please let us know if you have any other questions.

    Comment


      #3
      Thanks Gaby for the reference.

      Would be best to have some prompt from the editor to simply input parameters in a form-like snippet builder.

      I see it is in xml.

      Code:
      <?xml version="1.0" encoding="utf-8" ?>
      <CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
          <CodeSnippet Format="1.0.0">
              <Header>
                  <Title>for loop</Title>
                  <Shortcut>for</Shortcut>
                  <Description>Builds a 'for' loop</Description>
                  <Author>NinjaTrader, LLC</Author>
                  <SnippetTypes>
                      <SnippetType>Expansion</SnippetType>
                      <SnippetType>SurroundsWith</SnippetType>
                  </SnippetTypes>
              </Header>
              <Snippet>
                  <Declarations>
                      <Literal>
                          <ID>index</ID>
                          <Default>index</Default>
                          <ToolTip>Index</ToolTip>
                      </Literal>
                      <Literal>
                          <ID>count</ID>
                          <Default>count</Default>
                          <ToolTip>Iteration count</ToolTip>
                      </Literal>
                  </Declarations>
                  <Code Language="csharp">
      <![CDATA[for (int $index$ = 0; $index$ < $count$; $index$++)
      {
          $selected$$end$
      }]]>
                  </Code>
              </Snippet>
          </CodeSnippet>
      </CodeSnippets>​
      Any demo on how I would add the region #endregion?

      Comment


        #4
        Hello,

        I have submitted this as feature request on your behalf. I will follow up with the internal tracking number once this is created.

        Unfortunately, since creating your own custom code snippet is not supported, we are not able to assist in creating your own snippet file.

        Comment


          #5
          PaulMohn It's quite straightforward as you seem to already understand. I have a number of snippets defined that I use regularly. You just need to manage the relevant folder yourself, particularly if you uninstall/reinstall or perform some other "significant" configuration change that affects that part of the standard file structure.

          Thanks.
          Multi-Dimensional Managed Trading
          jeronymite
          NinjaTrader Ecosystem Vendor - Mizpah Software

          Comment


            #6
            Hello PaulMohn,

            We are tracking interest for this feature in an existing internal feature request ticket and I have added your vote. This request is being tracked under the number SFT-4267.


            As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted on the Release Notes page of the Help Guide.


            Release Notes —https://ninjatrader.com/support/help...ease_notes.htm

            Comment


              #7
              Originally posted by PaulMohn View Post
              Thanks Gaby for the reference.

              Would be best to have some prompt from the editor to simply input parameters in a form-like snippet builder.

              I see it is in xml.

              Code:
              <?xml version="1.0" encoding="utf-8" ?>
              <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
              <CodeSnippet Format="1.0.0">
              <Header>
              <Title>for loop</Title>
              <Shortcut>for</Shortcut>
              <Description>Builds a 'for' loop</Description>
              <Author>NinjaTrader, LLC</Author>
              <SnippetTypes>
              <SnippetType>Expansion</SnippetType>
              <SnippetType>SurroundsWith</SnippetType>
              </SnippetTypes>
              </Header>
              <Snippet>
              <Declarations>
              <Literal>
              <ID>index</ID>
              <Default>index</Default>
              <ToolTip>Index</ToolTip>
              </Literal>
              <Literal>
              <ID>count</ID>
              <Default>count</Default>
              <ToolTip>Iteration count</ToolTip>
              </Literal>
              </Declarations>
              <Code Language="csharp">
              <![CDATA[for (int $index$ = 0; $index$ < $count$; $index$++)
              {
              $selected$$end$
              }]]>
              </Code>
              </Snippet>
              </CodeSnippet>
              </CodeSnippets>​
              Any demo on how I would add the region #endregion?
              Sorry about this delay, but I thought I'd share my 2 cents for the rest of us:
              Code:
              <?xml version="1.0" encoding="utf-8" ?>
              <CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
                  <CodeSnippet Format="1.0.0">
                      <Header>
                          <Title>#region #endregion block</Title>
                          <Shortcut>reg</Shortcut>
                          <Description>Creates a '#region' block, standalone or around a block</Description>
                          <Author>SnailHorn</Author>
                          <SnippetTypes>
                              <SnippetType>Expansion</SnippetType>
                              <SnippetType>SurroundsWith</SnippetType>
                          </SnippetTypes>
                      </Header>
                      <Snippet>
                          <Declarations>
                              <Literal>
                                  <ID>region_name</ID>
                                  <Default>[Region Comment]</Default>
                                  <ToolTip>Comment about the region</ToolTip>
                              </Literal>
                          </Declarations>
                          <Code Language="csharp">
              <![CDATA[#region $region_name$
              $selected$$end$#endregion]]>
                          </Code>
                      </Snippet>
                  </CodeSnippet>
              </CodeSnippets>​
              Just throw it in the snippets folder/directory with the name <region.snippet> .
              And just call it with 'reg' -> [Tab].

              Alternatively for a selected text, select the intended part then press 'F2' (if you didn't change the usual hotkey) then type 'reg' followed by 'enter'. Should see magic then.

              Nonetheless, please count my vote for the feature too!

              Happy coding with NinjaScript !

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              557 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              324 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
              545 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              547 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X