Three potential models in quantitative trading

FMZ QuantFMZ Quant
4 min read

The triple realm of trading: induction - deduction - gaming

Period potential model

MA1:MA(O,18); //Find the average opening price of 18 periods
TMP:=(REF(C,1)-REF(C,10))/REF(C,1); // The difference between the closing price one period ago minus the closing price 10 periods ago, over the closing price before the previous period
REF(L,1)>REF(MA1,1)&&H>REF(H,1)&&MA1>REF(MA1,1)&&TMP>0.008,BPK; // The lowest price one period ago is greater than MA1 and the current highest price is greater than the highest price one period ago, buy the closing/opening position
REF(H,1)<REF(MA1,1)&&L<REF(L,1)&&MA1<REF(MA1,1)&&TMP<-0.008,SPK; // The highest price one period ago is lower than MA1 and the current lowest price is lower than the highest price one period ago, sell the closing/opening position
AUTOFILTER;

The significance of the moving average is to sum up the past price. As the triple realm of trading, induction, deduction and game, the moving average plays one of the most important roles in induction. For the period induction, it is a good way to reflect the historical price and provides the basic "raw material" for the second stage of deduction.

The above is a basic framework based on the moving average. Readers can follow the chart and find out their own operation period in terms of induction.

Intraday potential model

N:=BARSLAST(DATE<>REF(DATE,1))+1; // How many K-lines were taken at the opening of the day
LL:=REF(LLV(L,N),N); // Find the lowest price yesterday
HH:=REF(HHV(H,N),N); // Find the highest price yesterday

CC:=VALUEWHEN(DATE<>REF(DATE,1),REF(C,1)); // Find the closing price yesterday
SV:MAX(CC-LL,HH-CC); // Find the larger value in CC-LL and HH-CC

TMP1:H>O+0.7*SV; // The highest price is greater than the opening price plus 0.7 times the SV
TMP2:L<O-0.7*SV; // The lowest price is less than the opening price minus 0.7 times the SV

COUNT(TMP1,N)=1&&TMP1,BPK; // After the current opening, TMP1 is met for the first time. Buy the closing/opening position. Only one transaction is made on the same day
COUNT(TMP2,N)=1&&TMP2,SPK; // After the current opening, TMP2 is met for the first time. Sell the closing/opening position. Only one transaction is made on the same day
AUTOFILTER;

Intraday trading, the most famous of traditional subjective trading, is "copy the order". This method can ignore the requirements of technical analysis. The most important thing is to have a set of positive profits or positive expectation rules (rules, not strategies, because it does not involve strict mathematical formulas or causality) and fund management. This set of rules needs to be operated and adhered to by traders with heart and wisdom, and it is difficult to quantify. The reason why it is difficult to quantify is that we can classify it as deductive category only.

The above is a deductive strategy. There are no inductive technical indicators, but only a set of "rules" that are applicable to all areas. Subjective traders, especially day-traders like copy the orders, can use the above strategies as a framework to describe their own "rules", and let computers help us overcome the shortcomings in "operating and adhering with heart and mind".

Standard deviation potential model

MA35:=MA(C,35); // 35 period SMA
UB:=MA35+2*STD(C,35);
DB:=MA35-2*STD(C,35); // 2 times the standard deviation above and below the SMA
C>UB,BK; // Latest price is greater than UB, buy the opening
C<DB,SK; // Latest price is less than DB, sell the opening
C<MA35,SP; // The latest price is less than the SMA of 35 periods, close the long position
C>MA35,BP; // The latest price is more than the SMA of 35 periods, close the short position
AUTOFILTER;

Gaming is the highest level in trading. On the surface, it is the rise and fall of prices, but behind it is the result of the game among fund, psychology, expectations and fundamentals. In futures trading, no matter what the trading object is, the change of position is a comprehensive reflection of these aspects, because no matter how much the trading volume makes the capital rush, it seems incredible, and the change of position (especially the holding position) is an effective tool to remove these barriers. How much fund is deposited in the market and how firm the attitude of long and short position is. The trading volume can't tell you, but the position will tell you.

The strength of long and short positions. In terms of positions, each price level is piled up with real money (of course, we should exclude those fraudulent exchanges, such as many Altcoins exchanges). It is more meaningful to study the position well than the price itself, because the price performance is always the present, but the position can see the expectation, and the ultimate purpose of the transaction is the expectation. At present, it is always inductive, and at most deductive. If you want to make profits, it depends on the game.

The above is the simplest mathematical formula of game. For the meaning of standard deviation in mathematics, you can go to search engines for in-depth reading. Based on the above simple framework, readers can expand the conditions and environment of the game they can think of, and then apply them into the above formula, especially the understanding of the position in futures, and apply the standard deviation into the analysis of the position, which I believe will give you a deeper understanding of the origin of trading.

From: https://blog.mathquant.com/2023/01/28/three-potential-models-in-quantitative-trading.html

0
Subscribe to my newsletter

Read articles from FMZ Quant directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

FMZ Quant
FMZ Quant

Quantitative Trading For Everyone