A, in this paper,

Recently, commodities began to unprecedented crazy rise pattern, become a hot topic in the futures circle, whether the media or national regulators have great concern. For traders, it makes more sense to go long at a time of persistent global commodity inflation. This article on the domestic commodity futures black system as the target, the development of a long timing strategy.

Second, commodity rise reason

Why bulk commodity rises crazily recently, especially is black fasten to stage fluctuation tide frequently? From all views, there are the following reasons: 1. The SUSTAINED decline of the DOLLAR index since the outbreak of COVID-19 in 2020, the DOLLAR index has continued to decline, while the commodities are denominated in US dollars, and the sustained weak trend of US dollar has indirectly promoted the rise of commodity prices.

After the epidemic in 2020, the central banks of the world’s major economies collectively released water. In particular, the M2 growth rate in the United States, Europe and Japan exceeded 20% year on year. Under the condition that the easing policies of the central banks remain unchanged, the market inflation expectations are still strong.

3. Global Economic Recovery The recovery of the manufacturing sector is supporting the prices of manufactured goods as global demand for commodities rebounds and the global manufacturing purchasing managers index (PMI) continues to expand, with the recovery of the manufacturing sector supporting the prices of manufactured goods.

Dollar index and commodities

In 2021, upstream goods and materials that are closely related to our daily life will rise significantly imperceptibly. Thanks, as Buffett says, to the Federal Reserve’s loose monetary and fiscal policies, the global economic recovery has been driven by a surge in inflation, thanks to the massive stimulus measures in the United States during the pandemic.Photo credit: Sina Finance and Oriental Wealth

As shown in the chart above, the dollar index from May 2018 to date, and the commodity index from August 2018 to date, the dollar index and the commodity index have been moving in opposite directions.

Rising commodity prices are a global problem, not just domestic ones. The relationship between the price and demand is roughly similar to that between the dollar and the price of commodities, that is, the change in the price of commodities is usually opposite to the dollar, usually the dollar index falls while the commodity rises.

Money supply and Fisher equation

Fisher’s equation can explain the quantitative relationship among money supply, price level and national income. The formula is as follows:

MV=PQ

Among them:

  • M: Monetary aggregates
  • V: Currency turnover rate
  • P: Commodity price
  • Q: Quantity

Due to the emergence of the epidemic, unmarketable products, leading to enterprise loan demand decreases, so money turnover rate (V) will reduce, fisher equation (MV = PQ) will lose balance smaller (left), if not controlled will appear the risk of deflation, in order to ease the fisher equation on the left side of the MV drop speed, The approach adopted by the world’s major central banks is to turn on the printing presses and increase the amount of money (M).

But now, after the epidemic, the economic recovery, the currency velocity (V) has been close to normal, but the excess money (M) will not be collected for a while, causing the Fisher equation (MV=PQ) to lose balance again (the left side becomes larger).

So since The Fisher equation is an equation, the right-hand side of the equation is going to get bigger, either the price of the good is going to get bigger, or the quantity of the good is going to get bigger, or both. However, we know that it takes a process and a certain time for the quantity of goods to increase, so the market will start to repair itself. In the case that the quantity of goods (M) cannot increase immediately, the price of goods (P) can only increase.

In sum, despite the uncertainty of short-term market movements, 2021 could be the year when the bull market for commodities really begins. Well, not much to say, then we will take domestic commodity futures black system as the target, to develop a long timing strategy.

5. Strategy logic and implementation

The black long timing strategy of commodity futures is to explore the trading opportunities and make profits through the analysis of targeted historical data, market rules, trading patterns and other aspects by using fixed and quantitative trading patterns. The strategy is implemented by MY language quantified by the inventor (FMZ.COM). The specific policy logic is as follows:

  • Calculate the mean of the difference between the highest price and the opening price of the first four K lines
  • Calculate the mean values of HO1, HO2, HO3, and HO4
  • Calculate long opening signal
  • Calculate long liquidating signal
  • Order transactions

Step 1: Calculate the average difference between the highest price and the opening price of the first 4 K lines

HO1 := REF(H, 1) - REF(O, 1);
HO2 := REF(H, 2) - REF(O, 2);
HO3 := REF(H, 3) - REF(O, 3);
HO4 := REF(H, 4) - REF(O, 4);
HTO := (HO1 + HO2 + HO3 + HO4) / 4;
Copy the code

Step 2: Calculate the mean values of HO1, HO2, HO3, and HO4

LINE := O - HTO * N;
Copy the code

Step 3: Calculate the long open position signal

D1 := REF(C, 1) < REF(C, 2);
D2 := REF(C, 2) < REF(C, 3);
D3 := REF(C, 3) < REF(C, 4);
D := D1 && D2 && D3 && C > LINE;
Copy the code

Step 4: Calculate long liquidating signals

K1 := REF(C, 1) > REF(C, 2);
K2 := REF(C, 2) > REF(C, 3);
K3 := REF(C, 3) > REF(C, 4);
K := K1 && K2 && K3 && C <= LINE;
T1 := BARSLAST(BARSLAST(K) < BARSLAST(D));
DT := IFELSE(T1 <= REF(T1, 1), 0, (C - VALUEWHEN(T1 = 1, C)));
Copy the code

Step 5: Place the order

D, BK;
T1 < 5 && T1 > 3 && DT < 7, SP;
Copy the code

6. Strategy backtest

  • Back test start date: 2015-02-22
  • Back test end date: 2021-05-12
  • Data type: rebar index
  • Data cycle: daily line
  • Sliding point: open positions 2 jump each

Back to the test configuration

To measure performance

Money curve

Vii. Complete policy code

(*backtest
start: 2015-02-22 00:00:00
end: 2021-05-07 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
args: [["ContractType","rb000",126961]]
*)

HO1 := REF(H, 1) - REF(O, 1);
HO2 := REF(H, 2) - REF(O, 2);
HO3 := REF(H, 3) - REF(O, 3);
HO4 := REF(H, 4) - REF(O, 4);
HTO := (HO1 + HO2 + HO3 + HO4) / 4;
LINE := O - HTO * N;
D1 := REF(C, 1) < REF(C, 2);
D2 := REF(C, 2) < REF(C, 3);
D3 := REF(C, 3) < REF(C, 4);
D := D1 && D2 && D3 && C > LINE;
K1 := REF(C, 1) > REF(C, 2);
K2 := REF(C, 2) > REF(C, 3);
K3 := REF(C, 3) > REF(C, 4);
K := K1 && K2 && K3 && C <= LINE;
T1 := BARSLAST(BARSLAST(K) < BARSLAST(D));
DT := IFELSE(T1 <= REF(T1, 1), 0, (C - VALUEWHEN(T1 = 1, C)));
D, BK;
T1 < 5 && T1 > 3 && DT < 7, SP;
Copy the code

The complete policy code and the backtest configuration are attached above, or you can copy the complete policy code by clicking the link below: www.fmz.com/strategy/27…