What programming languages are available to implement my strategy on FMZ Quant Trading Platform? The FMZ Quant Trading Platform supports
JavaScript
,TypeScript
,Python
,C++
,PINE
,My Language
,Blockly
visualization to write and design strategies.
It supports JavaScript language and integrates the following JavaScript libraries:
JavaScript
language strategy, when a program exception error or interface business error occurs, the error log will display the specific line number where the error occurred in the strategy code, which is convenient for strategy debugging and bug troubleshooting.It supports TypeScript
language, still set it to JavaScript
strategy when we create strategies, then we write // @ts-check
at the beginning of the strategy code or click the button TypeScript
in the top right corner of the strategy editing area to switch to TypeScript
. The platform will recognize the code as TypeScript
automatically and provide you with corresponding compilation and type checking support for:
Set the Python interpreter used by the Python strategy program
Strategies written in Python, when backtesting or live trading, if the docker system environment has bothPython2 and Python3 installed, you can set the Python version to be launched at runtime on the first line of the strategy, such as #!python3
and #!python2
, so that the system will find the interpreter automatically. And you can also specify an absolute path, such as: #!/usr/bin/python3
.
Python-based Strategy Security
When trading strategies are developed on FMZ Quant Trading Platform, the strategy contents are only visible to the FMZ account holders. And on the FMZ Quant Trading Platform, you can achieve complete localization of strategy code. For example, a strategy logic can be encapsulated into a Python package, which is loaded in the strategy code, so that the strategy content localization can be realized.
The security of Python code:
Because Python is an open-source language that is extremely easy to decompile, if the strategy is not for personal use but for rent, you can run the strategy on your own deployed docker and rent it out in the form of sub-account or full docker management if you are worried about strategy leakage.
The encryption of Python strategy code:
By default, Python strategy code is not encrypted when used by the author and encrypted when rented to others. By editing the following code at the beginning of the Python strategy, you can specify whether to encrypt the strategy code for personal use or rental. The Python versions that support the encryption of strategy codes are as follows: Python 2.7, Python 3.5 and Python 3.6.
When the strategy author runs it himself or uses it for others through a registration code, the strategy code is encrypted:
Specify #!python
as the version of Python interpreter, and then use ,
to keep apart; input the encryption command encrypt
. If you don’t specify the version of Python, you can add #!,encrypt
directly.
#!python,encrypt
Or
#!encrypt
It will not encrypt the strategy codes when strategy writers run for their own use and share with others through the registration code:
#!python,not encrypted
Or
#!not encrypted
Use code os.getenv('__FMZ_ENV__')
to determine whether the encryption code is valid; the return of the string "encrypt"
indicates that it has taken effect. It is only valid in the live trading, and the backtest will not encrypt the Python
strategy codes.
#!encrypt
def main():
ret = os.getenv('__FMZ_ENV__')
# If the print variable ret is the string "encrypt" or ret == "encrypt" is true, that means the encryption is valid.
Log(ret, ret == "encrypt")
Our platform supports the C++ programming language and the C++ 11
standard. Strategies in C++ are pre-compiled and then executed. Strategies in C++ in the backtesting system are run on the C++ backtesting server of the backtesting system; Strategies in C++ in the bot environment are run based on the docker after they have been compiled.
Using the C++ programming language and the C++ 11
standard, you can develop powerful and efficient trading strategies on the FMZ Quant Trading Platform. Using the modern features of C++, you can build flexible and scalable trading algorithms for automated trading.
The following C++ libraries are integrated:
The platform supports write and design strategy in MyLanguage, which is compatible with most of the grammar, commands, and functions of the Wenhua MyLanguage. MyLanguage encourages building block programming, which breaks down complex algorithms into functions. It supports complex financial logic applications through concise grammar, specialized data structures and a powerful library of financial function libraris. Build applications in a modular way to improve efficiency and maintainability.
MyLanguage strategy example: System based on translational Bollinger channel
M := 12; // Parameter range 1, 20
N := 3; // Parameter range 1, 10
SDEV := 2; // Parameter range 1, 10
P := 16; // Parameter range 1, 20
//The strategy is a trend-following trading strategy for larger periods, such as daily.
//This model is only used as a case study for model development, and entering the market accordingly will be at your own risk.
////////////////////////////////////////////////////////
//Panning BOLL Channel Calculation
MID:=MA(C,N);//Calculate the middle track
TMP:=STD(C,M)*SDEV;//Calculate the standard deviation
DISPTOP:=REF(MID,P)+TMP;//Translate BOLL channel upper track
DISPBOTTOM:=REF(MID,P)-TMP;//Translate BOLL channel down track
//System admission
H>=DISPTOP,BPK;
L<=DISPBOTTOM,SPK;
AUTOFILTER;
The platform supports, and is compatible with, scripts in PINE language of Trading View
. The PINE language is a lightweight yet powerful strategy design programming language for creating backtested, live-trading indicators and strategies, with a thriving forum that has created more than 100,000 PINE scripts.
Users can easily access and apply a wide range of technical analysis and trading strategies; users can quickly implement their trading ideas with the help of community scripts, eliminating the need to write code from scratch and thus significantly reducing development time; it helps both novice and experienced traders to learn and understand different technical indicators, strategies and programming concepts.
PINE language strategy example: Super trend strategy
strategy("supertrend", overlay=true)
[supertrend, direction] = ta.supertrend(input(5, "factor"), input.int(10, "atrPeriod"))
plot(direction < 0 ? supertrend : na, "Up direction", color = color.green, style=plot.style_linebr)
plot(direction > 0 ? supertrend : na, "Down direction", color = color.red, style=plot.style_linebr)
if direction < 0
if supertrend > supertrend[2]
strategy.entry("entry long", strategy.long)
else if strategy.position_size < 0
strategy.close_all()
else if direction > 0
if supertrend < supertrend[3]
strategy.entry("entry short", strategy.short)
else if strategy.position_size > 0
strategy.close_all()
Our platform supports Blockly visual approach to programming. With the Blockly editor, users can express code concepts by piecing together graphical blocks (similar to building blocks), such as variables, logical expressions, loops, etc. In this way, the programming process no longer needs to pay too much attention to the tedious grammar details, and can directly follow the programming principles. By arranging and combining graphic blocks, users can easily understand programming logic and realize creative ideas. Ideal for developing an interest in strategy design in order to quickly get started with programmatic, quantitative trading.