![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
See Post Titled Summary for a reorganized version of this thread.
It is best viewed in Display Mode of Hybrid.
Last edited by Jim W.; 09-12-2012 at 11:58 PM.
|
|
|
|
|
The following user says thank you to Jim W. for this post: |
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
Thanks for starting and sharing this resource here Jim.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
|
Quote:
May I suggest that instead, you list each app as a separate posting, with the app as the heading for the post? You may want to make a summary listing as the very first post?
|
|
|
|
|
|
The following user says thank you to koganam for this post: |
|
|
|
#4 |
|
Junior Member
Join Date: May 2009
Posts: 2
Thanks: 4
Thanked 1 time in 1 post
|
Thanks Jim!!!
My advice to NinjaScript programmers is to read every line that Jim has written in every post in this thread. You will find gold nuggets in unexpected places. |
|
|
|
|
The following user says thank you to ymScalper for this post: |
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
Below are 3rd party tools that I use for developing and maintaining NinjaScripts.
More information about each of these programs is provided in the replies to this post. This information is best viewed in Display Mode of Hybrid. Share your favorites or add comments to this thread. Post entitled Program Template is a cut and paste template to get you started. Feel free to private message me with your comments, questions, and feedback. New NinjaTrader users should understand that it is likely that everything mentioned in this thread is unsupported by NinjaTrader support. NotePad++ NinjaScript Use: Replace or compliment the NT Editor. Search & Replace NinjaScript Use: Search NinjaScript folders for working examples of NinjaScripts facilities that you want to use. Snagit NinjaScript Uses: * Document your NinjaScript output and parameters. * Capture error messages during debugging. * Create examples for support or suggestion submission. Talking Alarm Clock Talking Desktop Clock NinjaScript Use: Maintain Temporal Awareness Visual Studio NinjaScript Use: Debugging NinjaScripts VMWARE Workstation NinjaScript Use: Create a complete NinjaScripts development and testing environment in a Virtual Machine. The VM can be located on a SSD, so it is portable and can fit into a shirt pocket (antistatic bag or protective case recommended to prevent static damage). WinMerge NinjaScript Use: Compare source versions. NotePad++ has a good Compare Plugin but WinMerge is better. WinZip NinjaScript Use: Selectively restore NinjaScripts from .ntbk files.
Last edited by Jim W.; 10-02-2012 at 06:47 AM.
|
|
|
|
|
The following 2 users say thank you to Jim W. for this post: |
|
|
|
#6 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
NotePad++
NinjaScript Use: Replace or compliment the NT Editor. Notepad++ is a source code editor and Notepad replacement that supports several languages including C#. NP++ is considered by many to be the best source/text editor available. Instructions on its website tell how to make NP++ your default text editor instead of NotePad. Free: Yes But donate if you like it Website: http://notepad-plus-plus.org/ Details: Features
1) Browse one section of code in NotePad++ while editing another section in NT. 2) When NinjaScript is saved or compiled and focus is returned to NotePad++ then NotePad++ gives a warning. If I do not reload the source then I can view it as it was when previously loaded into Notepad++. Reloading keeps the two source windows in sync. NotePad++ has a Compare Plugin. If the source has changed and I do not reload then I can select the Compare Plugin and see the changes to the source file in side by side NotePad++ windows. Others like snaphook http://www.ninjatrader.com/support/forum/showthread.php?p=301742#post301614 may choose to use NotePad++ instead of the NT Editor. Summarizing his explaination of how he does this: 1) Do all the editing in Notepad++ while having a different NT script open in the NT editor. 2) Once finished in NP++, compile the indicator being edited in NT. 3) If errors are found, navigate to that line in NP++ and make corrections, save, and recompile. Because the script in the NT editor is not the same as the one in NP++, the errors are found but NT Edit never saves the script being edited with NotePad++. See my post titled "A suggestion for Edit Find improvement" in thread http://www.ninjatrader.com/support/forum/showthread.php?p=301742#post301536 for images comparing NT Editor to NotePad++. When the NT editor opens a NinjaScript file or compiles a NS it displays the source code with all regions collapsed or folded. NP++ opens source code with all regions uncollapsed, but it has commands to collapse/uncollapse code blocks. This is called Code Folding. NP++ lines and blocks are described here http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Lines_And_Blocks . To make source in NT++ look like the NinjaScript Editor when opened you can enter the command Alt-0 to fold/collapse all code blocks. NT++ is very extendable and this can be done in a startup macro. You can define user command See Editing Configuration Files in http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Editing_Configuration_Files#.3CUse rDefinedCommands.3E then start the command by "Controlling Notepad++ at startup by passing it Command Line Options" http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Command_Line_Switches. Or, compile it into a plugin DLL which are all loaded at startup. One topic from above link "Managing text lines and grouping them into blocks": Code Folding Most programming languages support the notion of code block. When Notepad++ detects a keyword or operator that starts a block, it inserts a fold point, which shows on the fold margin. You can click on such a symbol to fold/unfold the corresponding block. Its first line is always displayed. Ctrl-clicking a folded point will recursively unfold all blocks inside it. Additionally, the View menu provides the following commands:
Topmost code blocks are said to be at level 1. Their direct sub-blocks are at level 2 and so on. The block level must be a digit between 1 and 8. The default shortcuts use the top keybboard row, not the numeric keypad. Note that the folding block where the current line lies is highlighted on the fold margin. You can change the colour being used using Settings -> Styler Configurator -> Global Styles , Fold active. This will work with the box or circle folding block style only. The shortcuts for folding and unfolding a level have the same appearace on the Shortcut mapper. However, collapsing commands follow Collapse current level, and likewise for uncollapsing. As of version 6.1.6, folding arbitrary text is not supported. Saving the state of the folding points isn't supported either. Plugins NotePadd++ can be enhanced with Plugins. There are DLLs located in the NP++ Plugins folder. At startup they are loaded by NP++ and can be run from Plugins in the Tool Bar. Plugins can be written in any language that can create a DLL. NP++ is written in C++ but fortunately there is a C# version NppPlugins.net that can be downloaded here http://notepad-plus-plus.org/contrib...gin-howto.html that contains a Visual Studio template and demo plugin. More information is available at http://notepad-plus-plus.org/resources.html and http://sourceforge.net/apps/mediawik...Plugin_Central . I am currently working on my first plugin Save Backup that will Save the current source with YYYY-MM-DD-HH-MM-SS.BAK appended to its file name. The backup can be saved to: * same folder as the source * folder named Backup in the same folder as the source * common NP++ backup folder Creating the DLL with modified Demo plugin source works but having problems with NppPlugins.net template and VS 2012 Full and Express version that must be resolved.
Last edited by Jim W.; 10-07-2012 at 02:18 PM.
Reason: Added Plugins Information
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
Search & Replace
NinjaScript Use: Search NinjaScript folders for working examples of NinjaScripts facilities that you want to use. Search & Replace is a very powerful utility for searching and optionally replacing text within files. There are Shareware, Classic, Replace Studio Pro and Replace Studio Business Edition versions. Free: Basic version is Shareware at http://www.funduc.com/srshareware.htm . Advanced versions are very reasonably priced at http://www.funduc.com/search_replace.htm Website: http://www.funduc.com/ Caution: This software has very powerful Replace capabilities. Learn to use the Replace functions with files in a temp folder. Details: To search the Indicators for examples of the unsupported ChartControl: 1) Download and install Shareware version http://www.funduc.com/srshareware.htm . 2) By default SR installs to "C:\Program Files\SR\SR32.exe" 3) Start SR 4) Enter the Search for text, File Mask and Path (Win 7 path shown) then click the left most Blue Binocular icon. It is the Search icon the Purple Binocular icon is Replace. 5) Click the BLUE Binocular icon to search all the files in the folder. There is a Subfolder icon that allows subfolder search. See first attachment 6) Scroll down to find a file of interest 7) Right clicking on the file name brings up the available action. Select Open with … then select Notepad++ See second attachment 8) Scroll NotePad++ to see lines of interest. Lines can be copied to the clipboard among other things. See third attachment
Last edited by Jim W.; 09-28-2012 at 04:40 AM.
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
Snagit
NinjaScript Use: * Document your NinjaScript output and parameters. * Capture error messages during debugging. * Create examples for support or suggestion submission. With Snagit’s full list of features you can capture anything, enhance your images, work more efficiently, and share your work with just a click. Free: No but full function trialware available Website: http://www.techsmith.com/snagit.html Details: So powerful and easy to capture anything on your screen. The Snagit Editor then allows you to do anything that you want to and with the image. All of the attachments to my posts are created with Snagit. There are two Snagit Editor features that I find unique and very useful: Color Substitution - Replaces a color with one other color. All black pixels can be replaced with white pixels and white with black. Invert Colors - Inverts the RGB color values. I submitted a suggestion to add these features to NT in 2008: Printing/displaying charts with black backgrounds http://www.ninjatrader.com/support/forum/showthread.php?t=6062 If you would like to have these features in NT please add your vote to the suggestion thread above. That would make a difference.
Last edited by Jim W.; 09-28-2012 at 08:16 AM.
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
Talking Alarm Clock
NinjaScript Use: Maintain Temporal Awareness Talking Alarm Clock set reminders for important dates and events. Free: Freeware. Donate if you find useful. Website: http://www.cinnamonsoftware.com/alarm_clock.htm Details: Manually set alerts to fire at the specified date/time. See first four attachments for options. I have not tried to programatically set alerts with C# but I suspect that it is possible. Talking Desktop Clock NinjaScript Use: Maintain Temporal Awareness Talking Desktop Clock says time or plays chime at specified intervals. Free: Freeware. Donate if you find useful. Website: http://www.cinnamonsoftware.com/desktop_clock.htm Details: It is easy to lose track of time while coding or testing NinjaScripts. I set Talking Desktop Clock to display a custom desktop analog clock and announce the time at ten minute intervals during the trading day. See fifth attachment. Note: If you do not work in private, these programs may become an annoyance to those who work near you.
Last edited by Jim W.; 09-28-2012 at 08:06 AM.
Reason: Updated fifth attachment to show desktop clock
|
|
|
|
|
The following user says thank you to Jim W. for this post: |
|
|
|
#10 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
Visual Studio
NinjaScript Use: Debugging NinjaScripts Free: Express Version is Free. Full Version has full function 90 day trialware. Microsoft has released Visual Studio 2012 and 2012 Express. I have successfully tested NT 7.0.1000.11 (Current) with Visual Studio Full and Express 2010 and 2012 versions on 32-bit Windows XP, Vista, and Windows 7 Ultra. On all the VS supported combinations, VS Express worked when a modified .csproj file was used. The "Attach to Process" Debug option has been added to VS 2012 Express, which means that the same procedure used with the VS Full version can now be used with Express. A modified .csproj file is not required. VS 2012 Ultra and VS Express 2012 for Windows 8 installations are blocked on the Release Preview Windows 8 Ultra because of a .Net Framework 4.5.50709 conflict. Visual Studio Supported Operating Systems VS 2010
Details: The best place to start is searching NT Help for "visual studio debugging". There are many post in the NinjaTrader Support Forum regarding Visual Studio sometimes abbreviated as just VS followed by the year version number or combined into VisualStudio. They refer to various version of NT and Visual Studio. The instructions that yuvalw posted for debugging NT with VS Express are below. His instructions revised for VS 2010 Express and for NT7 are: 1) Open Visual Studio. 2) Create new project (I created regular console application), let's call it NinjaTraderDebug. 3) Save the project and close Visual Studio 2010 Express. 4) Go to the My Document / Visual Studio 2010 / Project / NinjaTraderDebug / NinjaTraderDebug / directory and open with notepad the NinjaTraderDebug.csproj file. Caution there are two files, one ends in .csproj and the other csproj.user. If you do not show extensions then it is easy to select the wrong one ending in .user. 5) Insert the lines below in the three locations shown in the attachment. Of course you need to use your path to NinjaTrader.exe. <StartAction>Program</StartAction> <StartProgram> C:\Program Files\NinjaTrader 7\bin\NinjaTrader.exe </StartProgram> 6) Close NinjaTrader if it is opened. 7) Open the ninjatraderDebug project in VisualStudio. 8) Hit "Play" (F5), this will launch NinjaTrader and will attach to it. These last three steps are very important when debugging with either Visual Studio or Visual Studio Express. Debug Mode will remain enabled until you disable it and recompile a NinjaScript. 9) In the NinjaScript Editor enable "Debug Mode" by right clicking on the script source and clicking the option. 10) Be sure to compile the NinjaScript assembly afterwards by pressing "F5" on your keyboard. 11) Open the NinjaScript source file within Microsoft Visual Studio and set your break point(s). In subsequent NT debugging sessions with VS 2010 Express: 1) Close NinjaTrader if it is running. 2) Start VS 2010 Express 3) Open the NinjaTraderDebug VS project. Note: Any breakpoints previously set in NinjaScripts will be displayed as hollow circles until you compile a NinjaScript with NT Debug Mode enabled. 4) Select from the Toolbar: Debug | Start Debugging or F5 5) Edit any NinjaScript with NT Edit. 6) Compile the NinjaScript with NT. 7) Now that VS has the needed symbol information from NT Debug Mode, VS breakpoints will be displayed as solid red circles. 8) Use the VS F5 key to continue between breakpoints.
Last edited by Jim W.; 10-23-2012 at 12:26 PM.
Reason: Expanded steps to show subsequent debugging steps.
|
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
VMWARE Workstation
NinjaScript Use: Create a complete NinjaScripts development and testing environment in a Virtual Machine. The VM can be located on a SSD, so it is portable and can fit into a shirt pocket (antistatic bag or protective case recommended to prevent static damage). Instead of carrying around just NinjaScript source you can have all your applications (NinjaTrader, VisualStudio, data source, 3rd party tools, etc.) ready to run on any computer that has WMWARE Workstation installed. Free: No, but full function trialware is available Website: http://www.vmware.com/products/workstation/overview.html Details: Virtual Machines can be created from existing physical computers or from a new OS installation. VMWARE Workstation allows new Vitrual Machines to be created directly from ISO files. Most OS ISO files on the Internet have malware installed. You can download safe Windows 7 SP1 ISO files from the links at http://www.w7forums.com/official-windows-7-sp1-iso-image-downloads-t12325.html . These are official, genuine ISO files from Microsoft. Thеѕе аrе NOT illegal – Thеѕе аrе јυѕt thе download links fοr Windows 7 SP1 ISO whісh іѕ a retail wrap thаt offers a 30-day trial period (extendable to 120 days with instructions here http://www.howtogeek.com/howto/windo...0-to-120-days/). Yου need tο activate уουr Windows afterwards wіth a genuine license activation key tο continue using іt after the 120 trial days. Downloading thеѕе files frοm Digital River іѕ absolutely legal аnԁ completely free οf charge. Will Digital River remove the Windows 7 ISO files when Windows 7 is no longer sold? I don't know, you can still download Windows Vista Ultimate SP1. See http://answers.yahoo.com/question/index?qid=20120426200252AAmPoKe for links and instructions for turning the downloadable Vista Ultimate .exe files into an ISO file. The Vista trial is also extendable with the same instructions above. I am still looking for links to safe Window 8 ISO files. I did find this information: How to Install Windows 8 without a Product KeyWindows 8 License Relating to Virtual Machines The License for Windows 8 reads: "e. Use in a virtualized environment. If you use virtualization software to create one or more virtual computers on a single computer hardware system, each virtual computer, and the physical computer, is considered a separate computer for purposes of this agreement. This license allows you to install only one copy of the software for use on one computer, whether that computer is physical or virtual. If you want to use the software on more than one virtual computer, you must obtain separate copies of the software and a separate license for each copy. Content protected by digital rights management technology or other full-volume disk drive encryption technology may be less secure in a virtualized environment." And the related section reads: "Can I transfer the software to another computer or user? You may transfer the software to another computer that belongs to you. You may also transfer the software (together with the license) to a computer owned by someone else if a) you are the first licensed user of the software and b) the new user agrees to the terms of this agreement. To make that transfer, you must transfer the original media, the certificate of authenticity, the product key and the proof of purchase directly to that other person, without retaining any copies of the software. You may use the backup copy we allow you to make or the media that the software came on to transfer the software. Anytime you transfer the software to a new computer, you must remove the software from the prior computer. You may not transfer the software to share licenses between computers. You may transfer Get Genuine Windows software, Pro Pack or Media Center Pack software only together with the licensed computer." The above makes the use of Win 8 Trial installations, without a Product Key, even more valuable. Attachments: 1) VM desktop, installed software, and computer's properties. 2) SSD containing the VM. 3) All of the files that together make up the VM. Notice that I have chosen to create a 30 GB virtual hard drive stored in multiple 2 GB files.
Last edited by Jim W.; 11-19-2012 at 11:55 AM.
|
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
WinMerge
NinjaScript Use: Compare source versions. NotePad++ has a good Compare Plugin but WinMerge is better. WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle. WinMerge is highly useful for determining what has changed between project versions, and then merging changes between versions. Free: Yes Website: http://winmerge.org/ Details: Lets start by creating NinjaScript source to demonstrate WinMerge. 1) In the Indicators folder create a copy of @CustomPlotSample.cs with copy and paste. 2) Rename the copy to @CustomPlotSample.cs.201209121028.bak 3) Paste again and rename this copy to MyCustomPlotSample.cs 4) Paste again and rename this copy to MyCustomPlotSample.cs.201209121028.bak 5) Edit MyCustomPlotSample.cs and change the NinjaScript Line 24 to publicclass MyCustomPlotSample : Indicator Also change some source statements. 6) Compile the NinjaScript 7) Run a NT Backup of NinjaScripts 8) Rename the back file to c:\temp\2012-09-12.ntbk.zip 9) Left click on the zip file. 10) Expand the tree to see the Indicator folder See first attachment There are only two NinjaScripts. Why? NT Backup does NOT backup any NinjaScript folder files that begin with @. If you create new or make changes to files whose names begin with @ they will not be included in the backup. I have never seen this information in NT documentation. It is left for each NT user to discover for themselves. Back to WinMerge example. The second attachment shows the differences between MyCustomPlotSample.cs.201209121028.bak and MyCustomPlotSample.cs. I have found that it is a good practice to alway put the older file on the left with WinMerge. In that way the added and remove indications make chronological sense. See second attachment for WinMerge output
Last edited by Jim W.; 10-23-2012 at 12:53 PM.
|
|
|
|
|
|
#13 | |
|
Senior Member
|
Quote:
One day, I may write some replies pointing out free alternatives to the commercial programs that you have listed.
|
|
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
WinZip
NinjaScript Use: Selectively restore NinjaScripts from .ntbk files. WinZip is the most popular file compression software with an innovative and easy-to-use feature set. Free: No, but full function trialware is available Website:http://www.winzip.com Caution: The .ntbk file extension is associated with NinjTrader during installation. These files contain backups created by the NT Backup Utility. Left clicking or opening a .ntbk file starts NT in Restore mode. You have one chance to stop the restore of ALL files that were backedup into the file. Details: To safely restore one or more NinjaScript files: 1) Right click on the .ntbk file and rename it adding .zip after the .ntbk extension. The new file's name will then end in .ntbk.zip and when opened will be associated with your compression utility instead of NinjaTrader. 2) Left click on the .zip file to start Winzip or your compression utility. 3) Extract the NinjaScript file(s) to a temporary folder. 4) Open the file(s) in the temp folder and verify that they are the ones that you want. 5) Rename the files to be replaced, changing their extension from .cs to .cs.old in My Documents\NinjaTrader x\bin\Custom\Indicator or My Documents\NinjaTrader x\bin\Custom\Strategy. Note: The renamed file must NOT end in .cs to prevent future compilation errors. 6) Copy the temp file(s) to the NT Indicator or Strategy folders. Note: The restored source will NOT be used until the next NinjaScript compile or NT startup. It is best to recompile immediately after restore to ensure that NT is functional on the next startup. 7) You can leave the .zip extension on the backup file. You only need to remove it should you want to restore all files that it holds with NinjaTrader.
Last edited by Jim W.; 09-28-2012 at 09:33 AM.
|
|
|
|
|
|
#15 |
|
Senior Member
Join Date: Jul 2007
Posts: 101
Thanks: 6
Thanked 18 times in 14 posts
|
Below is a cut and paste template to get you started. Font is Arial 2. Make the post's title Program_Name.
It doesn't take long to knock one out. Start with a draft then make revisions until you like it, then post it to this thread. Program_Name NinjaScript Use: Brief description of how you use Program_name with NinjaScript. Program_Name general description. Adapt info from its website. Free: Yes or no. Explain if needed. Website: Program_Name_Website_Link Details: Useful information about how to use Program_Name with NinjaScript. Add image attachments if you can. Numbered checklists always help someone get started. Point out any sharp edges to save time and frustration.
Last edited by Jim W.; 09-28-2012 at 04:12 AM.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 3rd Party Books on NinjaScript | TrendTracker | General Programming | 4 | 02-20-2013 02:13 PM |
| Using 3rd party indicators | kcyster | General Programming | 9 | 12-14-2010 09:38 AM |
| 3rd Party Licensing | DionysusToast | Miscellaneous Support | 4 | 12-10-2010 08:56 AM |
| 3rd Party Developers | stressless | General Programming | 0 | 09-29-2009 08:38 AM |
| 3rd Party Programming | John_Aus | General Programming | 2 | 05-26-2008 10:51 PM |