[Quantitative Trading 01] CTA Strategy Fiali Four Price + Sky Garden Strategy

Fiari's four-price + sky garden strategy

CTA strategy (Commodity Trading Advisor Strategy), known as commodity trading advisory strategy, also known as managed futures strategy (Managed Futures), simple understanding - CTA strategy refers to the strategy of investing in the futures market, which is the same as investing in the stock market The biggest difference in strategy. It refers to an investment strategy in which professional managers invest in the futures market and take advantage of the rising or falling trend of the futures market to make profits.

Fiari's four-price strategy and the sky garden strategy are both classic intraday trend-breaking strategies.

I used the main futures contract market data from 2015.01.05 to 2022.10.29 to backtest the two strategies.

1. Policy principle

1. Fiari's four-price strategy

Fiari's four-price strategy is a relatively simple trend-based intraday trading strategy. Yesterday's high point, yesterday's low point, yesterday's closing price, and today's opening price can be collectively called the four prices of Fiali. It is the main breakthrough trading frame of reference adopted by the Japanese futures champion Fiari Firm.

Fiari's four-price is an intraday breakthrough strategy , so positions need to be closed before the market closes every day. The upper and lower rails of this strategy and their usage are as follows:

  • Upper track: yesterday's high point;
  • Lower track: yesterday's low point;

Yesterday's high point and yesterday's low point can be regarded as a recent fluctuation range. The existence of this range is a kind of pressure line to a certain extent. Only when there is enough price rise or fall can it break through the previous high point or low point . Therefore, the breakthrough position is a relatively good entry signal. If it breaks through this fluctuation range, it proves that the kinetic energy is relatively large, and the probability of maintaining a strong follow-up trend is relatively high. Therefore, this strategy adopts the following opening methods:

  • If the price breaks through the upper track, if you hold a short position, you will close the position first, and then open a long position; if there is no position, you will directly open a long position;
  • If the price falls below the lower track, if you hold a long position, you will first close the position and then open a short position; if you have no position, you will directly open a short position.

2. Sky garden strategy

Hanging garden is an intraday breakthrough strategy. Different from the previous strategy, Hanging Garden pays more attention to opening breakthroughs .

A high or low opening at the opening indicates that there are big positives or negatives that make the opening far away from yesterday's closing price. Opening a breakthrough is the fastest way to enter the market. Of course, the probability of error is also the highest. Therefore, in order to improve the winning rate of the strategy, the sky garden strategy adds additional conditions, that is, the opening must be opened significantly higher or lower to form an empty window, so it is called the sky garden as the name implies, and then it is opened according to whether it breaks through the upper and lower rails. Warehouse judgment. In this way, the winning rate of the strategy will be greatly improved, but due to the high or low opening range requirements are too high, generally more than 1%, so the number of transactions of the strategy may be lower than other strategies .

Intraday trading strategy, closing positions at the close of the day; Sky Garden is used when the day opens high or low, that is, when:

  • Opening price >= yesterday's closing price * 1.01 or
  • When the opening price <= yesterday's closing price * 0.99;
    if this condition is not met, no transaction will be carried out on that day.

The upper and lower rails of the strategy are:

  • Upper track = the highest price of the first K line;
  • Lower track = the lowest price of the first K line;

The way to open a position is the same as that of Fiali's four-price strategy:

  • If the price breaks through the upper track, if you hold a short position, you will close the position first, and then open a long position; if there is no position, you will directly open a long position;
  • If the price falls below the lower track, if you hold a long position, you will first close the position and then open a short position; if you have no position, you will directly open a short position.

The trading logic is actually a kind of opening sharply higher (>1%) on the day, fighting high and opening low; on the contrary, opening sharply lower (<1%), opening low and moving high.

2. Data preparation and basic settings

1. Data preparation

Use the main futures contract market data from 2015.01.05 to 2022.10.29, and the data frequency is 5min.
insert image description here

2. Stop profit and stop loss optimization

We backtested the strategies without stop-profit and stop-loss optimization and with stop-profit and stop-loss optimization respectively.

Before the optimization of stop-profit and stop-loss, the original intraday trading strategy actually adopted the method of holding until the closing (closing positions 10-15 minutes before the closing) , but the disadvantage of this way of exiting the market is that it cannot lock the potential High returns also increase the chances of losses . And a good active market exit strategy can not only lock in profits, but also reduce losses in a timely and effective manner, that is, truly achieve big gains and small losses.

I use a simple fixed ratio method for stop profit and stop loss:

  • Dynamic take profit: the retracement reaches the retracement ratio p relative to the high point during the position period , and the position is closed to take profit;
  • Static stop loss: the retracement reaches the retracement ratio p relative to the position opening point , and the position is closed and the stop loss is reached;
  • Take profit and stop loss parameters p and q, we test the values ​​in the range of 0.005~0.025 respectively, so as to select the optimal combination of stop profit and stop loss parameters.

3. Other parameter settings

The initial capital for the backtest is 1 million yuan, considering impact costs and handling fees.

The impact cost is 2/10,000, and the handling fee is 0.3/10,000.

4. Backtest indicators

  • cumulative rate of return
  • Annualized rate of return
  • Annualized Volatility
  • Sharpe ratio
  • maximum drawdown
  • benefit risk ratio
  • Transactions
  • winning percentage
  • profit-loss ratio

3. Backtest performance

1. Fiari's four-price strategy

It is not difficult for us to draw the following conclusions:

  • Fiari's four-price strategy's judgment conditions for trends are too simple, and it is not particularly effective in the current highly volatile market. That is to say, if the formation of a trend is to be established, the conditions for its establishment should also be very complicated, and It cannot be established just by yesterday's highest and lowest prices. And the fact is the same, through backtesting the historical data of 16 different futures varieties, we also verified this inference. Before and after stop profit and stop loss, only 3 of the 6 varieties have positive cumulative returns, and half of the varieties are losing money.
  • Gold, rebar, and coke have achieved positive annualized returns, but copper, natural rubber, and soybean meal have negative annualized returns.
  • Different varieties have different optimal stop-profit and stop-loss optimization parameters. For example, the optimal stop-profit and stop-loss parameters of copper are p=0.015, q=0.005, but the optimal stop-profit and stop-loss parameters of gold are p=0.01, q= 0.015.
  • After adding stop-profit and stop-loss optimization, except for soybean meal, the income of other varieties has increased slightly. It shows that stop profit and stop loss have worked.

Table 1. The backtest results of Fiali’s four-price without considering the optimization of stop-profit and stop-loss
insert image description here

Table 2. Considering the "optimal" parameters of the stop-profit and stop-loss optimization of Fiali's four-price backtest results
insert image description here

Figure 1. Under different stop-profit and stop-loss parameters, the heat map of the annualized yield of each futures product
insert image description here
Main net value curve of copper ↓ Main
insert image description here
net value curve of gold ↓
insert image description here
Main net value curve of rebar ↓ Main
insert image description here
net value curve of natural rubber ↓
insert image description here
Main net value curve of soybean meal ↓

insert image description here
Net value curve of coke main force↓

insert image description here

2. Sky garden strategy

  • Sky Garden’s strategy of only gaining sharply higher openings or sharply lower openings, some pay too much attention to the impact of the accumulation of news during non-trading hours on the opening price. In fact, in many cases, the market’s digestion and feedback of information will always produce The opposite effect makes the backtest results of such a strategy that uses the highest and lowest price of the first bar after the opening of the gap as the upper and lower rails to judge whether the trend is established are not particularly good. Only 2 of the 6 varieties have achieved a positive annualized rate of return.
  • Compared with the Fiali four-price strategy, the number of transactions of the sky garden strategy is significantly reduced. In the nearly 7 years of trading, the number of transactions is only about 200 to 300 times, and the net value curve is stepped, indicating that most trading days are not Comply with the conditions of use of the Sky Garden Policy.
  • Copper and gold have achieved positive annualized returns, but rebar, natural rubber, soybean meal, and coke have negative annualized returns.
  • Different varieties have different optimal stop-profit and stop-loss optimization parameters. For example, the optimal stop-profit and stop-loss parameters of copper are p=0.055, q=0.02, but the optimal stop-profit and stop-loss parameters of gold are p=0.01, q= 0.005.
  • After adding stop-profit and stop-loss optimization, except for natural rubber, the income of other varieties has slightly increased. It shows that stop profit and stop loss have worked.

Table 3. Backtest results of Sky Garden without taking profit and stop loss optimization
insert image description here
Table 4. Backtest results of Sky Garden considering "optimal" parameters for stop loss optimization
insert image description here

Figure 2. Under different stop-profit and stop-loss parameters, the heat map of the annualized return rate of each futures variety Copper
insert image description here
main force net value curve↓
insert image description here

Net value curve of the main force of gold↓
insert image description here

Rebar main force net value curve ↓
insert image description here

Net worth curve of natural rubber main force↓
insert image description here

The main net value curve of soybean meal ↓
insert image description here

Net value curve of coke main force↓
insert image description here

Guess you like

Origin blog.csdn.net/Quickrise/article/details/128262372