Welcome to FMZ Quant Trading Platform
Programming Languages
Key Security
Live Trading
Strategy Library
Docker
Exchange
Strategy Editor
Backtesting System
Backtesting System Modes
Impact of Backtest Data Granularity on Backtesting
Backtesting System Supports Multiple Programming Languages
Exchanges Supported by Backtesting System
Backtest System Parameter Optimization
Save Backtest Settings
Custom Data Source
Local Backtesting Engine
Backtest Page Shortcuts
Backtest Data Download
Backtest System Sharpe Ratio Algorithm
Strategy Entry Functions
Strategy Framework and API Functions
Template Library
Strategy Parameters
Interactive Controls
Options Trading
C++ Strategy Writing Guide
JavaScript Strategy Writing Guide
Web3
Built-in Libraries
Extended API Interface
MCP Service
Trading Terminal
Data Explorer
Alpha Factor Analysis Tool
General Protocol
Debugging Tool
Remote Editing
Import and Export of Complete Strategies
Multi-language Support
Live Trading and Strategy Grouping
Live Trading Display
Strategy Sharing and Renting
Live Trading Message Push
Common Causes of Live Trading Errors and Abnormal Exits
Exchange-Specific Notes
C++ Strategy Writing Guide
- The main difference between writing strategies in
C++andJavaScriptlies in the data returned by API functions on the FMZ Quant Trading Platform. For example, theexchange.GetTicker()function:
-
JavaScript
exchange.GetTicker()returns an object when called successfully, and returnsnullif the call fails (e.g., exchange server issues, network problems, etc.).javascriptfunction main() { var ticker = exchange.GetTicker() // Check if exchange.GetTicker function call failed and returned null if (ticker){ Log(ticker) } } -
C++
exchange.GetTicker()returns an object when called successfully, and still returns an object when the call fails. The objects returned from successful and failed calls are distinguished by theValidproperty.c++void main() { auto ticker = exchange.GetTicker(); // Check if exchange.GetTicker() function call failed by checking if the Valid property in the returned object is false if (ticker.Valid) { Log(ticker); } }
- The difference between the
main()function inC++strategies and themain()function in standard C11:
The entry functionmain()in C11 C++ programs returns aninttype, while in FMZ Quant's C++ strategies, the strategy's startup function is alsomain(). However, these are not the same function, they just share the same name. Themain()function in FMZ Quant's C++ strategies returns avoidtype.
c++
void main() {
// Test using the Test function
if (!Test("c++")) {
// Throw an exception to terminate program execution
Panic("Please download the latest version of the docker");
}
// All returned objects use the Valid property to determine validity
LogProfitReset();
LogReset();
Log(_N(9.12345, 2));
Log("use _C", _C(exchange.GetTicker), _C(exchange.GetAccount));
}