- Module for obtaining an attribute in asset information
This module needs to be used together with the module of obtaining asset information.
For example: print the available currency of the current account
Backtesting display:
Like JavaScript strategy code:
function main () {
Log(exchange.GetAccount().Stocks)
}
- Module for obtaining an attribute in order data
This module is used to obtain the value of an attribute in the order data, such as the price or quantity of selling one in the order book (example of No.13).
Backtesting results:
Like JavaScript strategy code:
function main () {
Log(exchange.GetDepth().Asks[0].Price)
}
It can also be used to obtain an attribute in the order information returned by the "Query Order Details Module" (to be explained in the advanced chapter).
- The module to obtain the attributes of a position in the position information
Similarly, it should be used together with the "Get Futures Position Module". Note that the position data returned by the "Get Futures Position Module" is an array (list) that contains positions in different contracts and directions. Therefore, the index should be specified when using.
Having learned so much, let's combine a hedging operation, that is, hedging both short-term and forward contracts.
We make a positive arbitrage hedge, that is, open a short position contract for the forward contract, and open a long position contract for the recent contract.
Backtesting results:
Examples of visualization strategies:
https://www.fmz.com/strategy/121404
https://www.fmz.com/strategy/129895
https://www.fmz.com/strategy/123904
https://www.fmz.com/strategy/122318
For more strategies, please refer to: https://www.fmz.com/square
Other articles in this series
-Visualization Module to Build Trading Strategies - In-depth (https://www.fmz.com/digest-topic/9509)
-Visualization Module to Build Trading Strategy - Advanced Understanding (https://www.fmz.com/bbs-topic/9815)
The boring programming can be easily completed by building blocks. It's very interesting to try!