User login

  

Scripting .NET

You can use .NET indicators and Trading Systems in ProTrader Desktop. There are two general ways of creating .NET scripts. You can implement your scripts either in MS Visual Studio or in Trading Terminal.

In the former case you will be able to use VS features in full; the latter is useful if you want to quickly create a simple script or make some changes to an existing one.

To create a new script in .NET Terminal simply make a new project using the Wizard. .NET Terminal debugger will use .NET Remoting. For this reason, .NET Terminal debugging will be much slower than execution without debugging.

Visual Studio

To create a new script in MS Visual Studio you will need to follow these steps:

  1. Create a new project as a Class Library.
  2. Link PTLRuntime.dll from the ProTrader Desktop installation directory to use the PTLRuntime.NET Script namespace.
  3. Create a script and place both the .dll and .pdb files into the \Indicators or \Strategies folder. You can do this as a post-build event.
  4. Run Trading Terminal.
  5. Select Debug > Attach to process from the MS VS menu, and select the main application as the target. Here is MSDN reference about attaching a running process.
  6. Run your script in the normal way.
  7. Done. You can now place breakpoints in your VS code and they will work.

To make changes to your code please disconnect from the process and repeat the actions in Step 3.

Scripting

Create a class inherited from NetTradingSystem or NetIndicator. You can override the Init(), NextBar() (for indicators only), OnQuote(), Complete() functions and place your own code there.

Create a public constructor without any parameters. Please do not program any long-term operations in this constructor - place them all in the Init() function instead.

You can set the module properties in the constructor (e.g. author, comments) and line settings for the Indicator.

12345

Comments