I have come up with an idea to combine open orders and trades at the market price to create a leading indicator for forecasting market movement.
Open orders are represented in a table called “market depth”. Its fragment is shown in Fig. 6.1. The table contains bid, ask, volume of buy and sell open orders in lots.
Trades at market price are represented in a table called “anonymous trades”. Its fragment is shown in Fig. 6.2. The table contains time of the trade, security tag, volume of the trade in lots, direction of the trade (buy or sell). This table may also contain other data, for example, bid and ask, but we do not need them.
The program accesses the market depth table and calculates the total volume separately of all buy and sell open orders at the end of each minute during the trading day. These volumes are displayed as a blue and red line under the 1-minute price chart in Fig. 6.3 for buyers and sellers respectively. If the blue line lies above the red, then there are more buy orders, and vice versa. In some cases, the indicator correctly warns of a price reversal: buy (sell) orders prevail before the market rises (falls). As can be seen in Fig. 6.3, usually soon after an increase in the volume of buy orders, the price rises, and after an increase in the volume of sell orders the price drops.
The program also refers to the table of anonymous trades and calculates the total volume separately of all buy and sell trades for every minute during the trading day (the sum of these volumes is the volume displayed by the standard volume indicator). These volumes are displayed as blue and red dots in Fig. 6.3. A large volume of buy or sell trades often leads to a large candle.
Now we can evaluate the strength of the bulls and bears S as:
BO- volume of buy open orders
BT- volume of buy trades
SO- volume of sell open orders
ST- volume of sell trades
Bulls dominate when S>0, and bears dominate if S<0. Blue and red triangles in Fig. 6.3. correspond to the dominance of bulls and bears, respectively.
Now let's decide when the bulls and bears lose their strength. To do this, we register every minute when the volume of buy and sell orders at the end of the current minute drops compared to the end of the previous minute during the trading day. If this drop is greater than the volume of trades of the opposite sign for the current minute, then some orders were canceled during this minute. Canceled buy (sell) orders mean that buyers (sellers) are leaving, and the price often changes after some time in favor of those who remain. I call this phenomenon the pessimism of bulls and bears, which can be defined as:
PBi = BOi - BOi-1 + STi
PSi = SOi -SOi-1 + BTi
PBi - bull pessimism measure
PSi - bear pessimism measure
BOi and BOi-1 - volume of buy open orders at minute i and i-1
SOi and SOi-1 - volume of sell open orders at minute i and i-1
BTi - volume of buy trades at minute i
STi - volume of sell trades at minute i
Bulls are pessimistic when PBi<0, and bears if PSi<0. The measure of pessimism of bulls and bears PBi and PSi is represented as a histogram below the zero line in Fig. 6.3. The blue and red bars of the histogram appear when the bulls and bears are pessimistic, respectively.
But what if some bulls (bears) cancelled their orders and immediately bought (sold) at the market price? In this case, we are not talking about pessimism. Such an outcome cannot be ascertained for sure. We can only guess about it if trading at a market price of the same direction with a large volume occurs at the same or the next minute after a negative bar.
In conclusion, for clarity, Figure 6.4 shows an indicator for another stocks, where only open orders remained. Again, most often a significant excess of the volume of buy orders over the volume of sell orders (or vice versa) will soon lead to an increase (or decrease) in the price.