The first generation of CTA trading system emerged in the 1960s and 1970s. Due to the strong trend of the commodity market at that time, CTA strategy made considerable gains at that time. The strong trend of the commodity market during this period can be attributed to the sustained economic growth and rising economic inflation after World War II. The powerful trend market allows a simple trend tracking system to achieve better returns. The first generation CTA system deals with fewer basic markets and varieties, and the trading system is relatively simple, usually a trading system that tracks multiple trading targets. Because of the trend of the commodity market at that time, this strategy worked well.
The strategies used in the first generation trading system are those that are familiar with the trend tracking strategy now, such as the mobile average system (with some simple filtering conditions, such as when the short-term moving average exceeds the long-term moving average or vice versa). A simple trend tracking strategy can play a continuous trend of the trading target fundamentals effectively. The sustained economic growth, inflation and oil crisis are the reasons behind this persistence. However, when many traders use the same strategy and the fundamentals continue to exist, the first generation of trading strategies need to be developed to adapt to the new environment.
Due to the decoupling of the USD and gold, the financial futures market developed rapidly from 1970 to 1980, allowing the futures management fund to participate in many futures markets, including the money market, the bond market, the stock index futures and the stock financial derivatives. In addition, the development of information technology and low cost make it easy to obtain data during the day. The increase in the scale of funds entering the CTA fund and the increased competition make the CTA strategy more complex and more adaptable.
Based on the above market characteristics, the second generation CTA trading system and strategy have the following characteristics compared with the first generation CTA strategy:
The trading theme is more diversified. The entry of the financial futures market has made the trading variety and market more diversified.
In terms of trading strategy, the strategy of the second generation CTA trading system is not limited to pure trend tracking and price breakthrough. It applies more mathematical models to monitor multiple markets. Whether to use trend tracking according to different market conditions or average response strategies. Because many institutions participate in the liquidity of the futures market, the continuous low volatility period of the futures market has also emerged. In this case, the traditional first-generation CTA system is difficult to make profits and adapt to market changes. This strategy becomes important.
The second generation CTA strategy can conduct short-term trading at the trading window and holding time. Unlike the first-generation CTA strategy, the second-generation strategy has begun to monitor the short-term and high-frequency trading intraday trading patterns. This feature stems from the development of computer technology, which makes the provision of financial data more timely and frequent.
The third generation CTA trading system is the further diversification, decentralization and adaptability of the second generation trading system. The third generation CTA uses more trading systems to trade more markets and varieties. In terms of strategy, it uses a more profitable market model. All of these are based on the combination of multiple models running in multiple markets.
In view of the wide application of CTA strategy and the maturity of CTA strategy after time, it is a classic strategy model widely contacted and wanted to understand by a large number of quantitative traders (especially for novices). The FMZ Quant platform has developed a standard CTA strategy class library very early. If readers want to apply CTA strategy on the FMZ Quant platform, they can copy the code simply or reference the class library directly.
Extensibility is also very convenient. The code comments are very clear and easy to understand. If you want to make in-depth customization or extension, you only need to do it under the existing framework directly.
Part of the source code (JavaScript version):
function main() {
$.CTA(exchanges[0], 0.01, function(r, mp, pair){ // The first parameter is the exchange object to be done, the second parameter 0.01 is the minimum order quantity required by the exchange, the third anonymous function function() {...} is the callback function, and the trading logic is written in the function. The first parameter r of the callback function receives the latest K-line data, the second parameter receives the number of positions, and the third parameter receives the name of the trading pair.
if (r.length < 20) { // Determine the number of K-line bars
return
}
var emaSlow = TA.EMA(r, 20)
var emaFast = TA.EMA(r, 5)
var cross = _Cross(emaFast, emaSlow); // To determine the intersection status of indicators, for _Cross, please refer to: https://www.fmz.com/bbs-topic/9116
if (mp <= 0 && cross > 1) {
Log(pair, "Buy, Golden Cross period", cross, "mp:", mp);
return 0.1 * (mp < 0 ? 2 : 1) // The value returned is the number of positions to be opened, a positive number is to open a long position, a negative number is to open a short position, and 0 is to close all positions.
} else if (mp >= 0 && cross < -1) {
Log(pair, "Sell, Bearish Crossover period", cross, "mp:", mp);
return -0.1 * (mp > 0 ? 2 : 1)
}
})
}
For more information about source code and class library, please refer to: https://www.fmz.com/strategy/57267.