The Script Designer is the preferred Integrated Development Environment (IDE) for writing trading strategies and other supported script types. The designer can be used for creating and editing 18 different types of scripts using C# and Python.  


The designer is highly integrated with our API functions and offers many useful productivity features, such as: auto-completion, parameter details, syntax highlighting and error highlighting. In addition, whenever you’re editing a script the designer will categorize and list all of the API functions that it supports, enabling you to quickly find the functions you’re looking for. 


Once a script has been created you can either continue editing it in the Script Designer or you can launch Visual Studio or Visual Studio Code and edit it from there. One feature that Visual Studio offers that our Script Designer does not is the ability to use a debugger with breakpoints on C# scripts. In order to debug a C# script using breakpoints you'll have to launch Visual Studio and attach it to the Tickblaze.exe process, which will then enable the breakpoints whenever the script is executed by the platform.



Script Type


The following script types are supported by the platform:


Script Name

Script Description

Trading Strategy

Trading Strategy scripts are used for trading one symbol at a time such that each symbol gets its own strategy instance.

Multi-Symbol Trading Strategy

Multi-Symbol Trading Strategy scripts are used for simultaneously trading a group of symbols from a single strategy instance.

Trade Management Strategy

Trade Management Strategy scripts have multiple use-cases such as implementing position entry strategies, implementing position exit strategies and implementing advanced order management systems, among others.

Position Sizing

Position Sizing scripts are used for overriding the quantity of pending orders after those were generated by a Trading Strategy script.

Bar Type

Bar type scripts are used for building custom bar types that can be used interchangeably with native bar types throughout the platform.

Drawing

Drawing scripts are used for drawing a visual object on a chart or as part of another script's implementation (such as a Trading Strategy script).

Indicator

Indicator scripts are used for calculating a series of numerical values based on the price, volume and open interest of an underlying symbol.

Pattern

Pattern scripts are used for recognizing and highlighting chart patterns based on the price, volume and open interest of an underlying symbol. 

Signal

Signal scripts are used for generating numeric buy/sell trading signals based on the price, volume and open interest of an underlying symbol.

Add-On

Add-on scripts are used for adding functionality to the platform by allowing custom code to be triggered manually from its trading tools.

Alert

Alert scripts are used for executing custom actions as part of the actions executed by an alert.

Commission

Commission scripts are used for calculating the commission paid to a broker for each executed order, based on the broker's exact commission schedule.

Dynamic Allocation

Dynamic allocation scripts are used for systematically redistributing cash between Desktop strategies based on their performance or some other heuristic. 

Optimization Algorithm

Optimization Algorithm scripts are used to control the optimization process. During optimization the Desktop and its strategies will be backtested repeatedly with different optimization vectors (script parameter values) as selected by the Optimization Algorithm script.

Performance Metric

Performance Metric scripts are used for calculating performance statistics similar to those in the Performance tab of the Desktop

Risk Management

Risk Management scripts are used for managing risk by modifying or cancelling trading strategy orders based on portfolio level risk analysis.

Slippage

Slippage scripts are used for simulating market slippage by setting the final execution price of each simulated order fill. 

Tax System

Tax system scripts are used for calculating and reducing the capital gain taxes created by the strategies.



Programming Language


Tickblaze scripts can be coded in either C# or Python. Python is by far the most popular language for strategy traders, mostly due to its huge selection of packages and easy to learn syntax. C# is mostly suited for professional developers who are more familiar with C based language such as C#, Java or C++. 


Both languages share the exact same API, and offer nearly identical functionality, other than a few script types which are not yet supported by our Python integration.


Pick Python if you don’t know C# or you require Python’s large selection of packages. Pick C# for greatly improved performance, which means faster backtesting, optimization and trading. Strategy traders often develop their strategies in Python and then have developers translate them to C++, C# or Java.



Script Parameters


Most Tickblaze scripts can accept parameter values during their setup. Each script has an OnInitialize function which is called prior to all other functions, the parameters that it accepts are the parameters the user can specify when the script is set up. 


These parameters can either be added from the Script Wizard or directly from the script itself. We highly recommend that you add, edit and remove parameters using the Script Wizard instead of manually from the script itself. 



Imported Scripts


Some scripts can import and use Indicators, Signals, Patterns and Drawings from their code. Once a script with an ID of XYZ is added to this list, a new API function named SignalXYZ, DrawingXYZ, IndicatorXYZ or PatternXYZ is created. This new function accepts the same parameters accepted by the script's OnInitialize function and is used for creating new instances of it.