The essence of the Bayesian method is that it provides a mathematical rule for explaining how you should change your existing beliefs when a new set of evidence appears. A typical example is a gifted newborn who, when he sees the sunrise for the first time in his life, then wonders if the sun will rise again. He then assigns two equal prior probabilities of possible outcomes, and puts a white ball and a black ball in a bag, respectively, representing that the sun will rise again, and the sun will not rise again.
A single order stream is the difference between the volume of trades initiated by the buyer and the volume of trades initiated by the seller. Whether based on the size of the transaction or the number of trades, a single order stream can briefly influence the market trend. A single order stream may itself contain information about the direction of the next movement, which the trader may convey his view of the future movement of the market if the trader chooses to make a transaction immediately rather than waiting for the order to be placed.
We still use the example of the Bayesian law used by the above-mentioned gifted newborns to predict whether the sun will rise again, to try to build a high-frequency trading strategy with the core idea of pursuing radical directives as a single stream.
Step 1: Create a subroutine that contains only one loop of N cycles (TICK) for computing instruction single-strokes within N cycles.
The calculation rules are as follows (pseudo-code):
if(bidprice=bidprice[1] and askprice=askprice[1]){
if((bidvol[1]-bidvol) < (askvol[1]-askvol)){
此处以挂单数量减少量PK下的次数为准
}
{
long=long+1
}else short=short+1
}
如果报价发生移位,则无需计算,直接加计移位方向的贝叶斯球。
Step 2: Clearly following the threshold for radical uniformitarianism, assuming N = 10, assuming the threshold is set to 7, can solidify our Bayesian beliefs.
if (long>=7) then buy; if(short>=7) then sellshort;
There is a famous saying in the gift basket of the Phantom of the Opera: "Put out when the market doesn't prove you right, not when the market proves you wrong". Based on this idea, we can implement a high-frequency trading strategy of entering and leaving asynchronously, by setting threshold differences.
This article is translated from the blog of QuantWay.