“Semifinished products” of trading systems on the 1C Enterprise platform for the Moscow Exchange
Semifinished (semi + lat. fabricatusmanufactured) — productthat has undergone primary processing but needs further finishing to be usable. (https://en.wikipedia.org)
hidden text
Initial data: we have a QUIK exchange terminal from Sberbank Broker. The typical documented standard functionality of QUIK allows you to download information on current trades and deals via ODBC and download orders for buying and selling from an external text file.
Purpose: to predict the closing price of tomorrow based on the available historical data.
Solution options:

Option 1: System training based on the use of analysis and forecasting built into 1C: Decision tree, clustering.

Option 2: Training the system based on the analysis of signal triggering of typical indicators of technical analysis.

Option 3: Training the system based on the analysis of mutual dependencies between the movements of technical indicators.
Option 1. System training based on the use of analysis and forecasting built into 1C: Decision tree, clustering.
To solve this problem, we need to store information on how true the predictions of typical 1C analysis and forecasting mechanisms turned out to be. We will make forecasts using all available methods and remember them for each stock instrument.
The best way to check if the forecasts come true is to make this forecast for some date in the past based on historical data and check whether the forecast came true or not. But since by itself all forecasts cannot come true, we will use the following settings:

Forecast recognition threshold (%). This is the value at which the existing forecasting system is recognized as acceptable for use for this tool.

The number of days to analyze. This is the number of days back in the past from the current day for which the forecast will be built.

The number of days that the forecast classification is relevant. This is the value during which the analysis made on the basis of past data will be considered still valid for use. After this number of days, we will need to doublecheck the relevance of each of the forecasting methods for each instrument.

For clustering methods and 1C decision tree, the forecast can be a range of values or a specific value. About the range of values, the decision comes by itself. If the predicted value fell into the range, then the forecast worked. And for cases when the system predicted not a range, but a specific value, we will use the possibility of setting the accuracy (forecast error).
As a result of applying this option, when forecasting based on current data, we can build a table of possible values of tomorrow’s closing price in accordance with the forecast methods acceptable for this instrument and select the value with the highest probability among the prices.
Option 2: Training the system based on the analysis of signal triggering of typical indicators of technical analysis.
We have 18 trading strategies built into the system. The value of technical indicators is obtained by transferring price information from 1C to Python and receiving calculated technical indicators back. The Python libraries “ta” and “ta_lib” are used. In total, these are more than 120 technical indicators, although, of course, some are repeated. Based mainly on trend indicators, trading strategies have been formed.
Using the example of a trading strategy based on the ta MACD library indicator, in the simplest case, a buy signal will be: ta_MACD_macd_diff is greater than 0 and growing.
In a separate table (information register) we will store the history of signals of technical indicators, according to the above strategies.
Since we have a history of signals, we can get a separate table of triggering these signals on historical data. (signal triggered or not triggered)
Accordingly, we can get a table of the probability of each technical analysis strategy being triggered in the past. (absolute and relative values of the number of cases)
And having received the advice of the current day on these trading strategies, immediately assess the likelihood of their operation based on historical probabilities. Those. when a signal arrives, we will look not only at its presence, but also at its probability (reliability) in the past. So let’s call the columns “Buy reliably” and “Sell reliably”. At the same time, these values for each instrument can be summed up, i.e. find, as it were, the sum of tips multiplied by the probability. Or take the average value of “Reliable advice”. It will turn out, as it were, the voting of trading strategies. For example, only 10 buy signals were received from different strategies. For each of them, the probability ranged from 0.4 to 0.6 (4060%). The average probability for example turned out to be 0.59 (59%). Therefore, the signals received today to buy with a probability of 59% will work.
According to the advice received, you can get a transcript of which signals worked and what their probability is.
And decipher each of the tips graphically by pressing 1 button.
3: Training the system based on the analysis of mutual dependencies between the movements of technical indicators.
After checking option 2, there is a natural desire not to set up individual strategies based on the signals of technical indicators. I would like to simply feed all the available technical indicators and their components to the input of any mechanism and look at the dependence on the closing price of tomorrow with a known change in the indicator today.
Based on the analysis of the data history, we will obtain information about the mutual dependence (correlation) of technical indicators today and the closing price tomorrow. In terms of probability theory, we find the relationship between events.
We will consider cases

The indicator is growing today relative to yesterday, the closing price is growing tomorrow

The indicator is falling today relative to yesterday, the closing price is rising tomorrow

The indicator is growing today relative to yesterday, the closing price is falling tomorrow

The indicator is falling today relative to yesterday, the closing price is falling tomorrow
Let’s count the number of cases in the past.
Accordingly, knowing the absolute values of the number of cases, one can obtain relative values. (probability of triggering, correlation)
By analogy with forecasting option 2, we can either add up our received probabilities and select them by exceeding some threshold value, or find the average among the predicted probabilities, or somehow prefilter and take only those probabilities that somehow differ from 50% (from a simple toss of a coin), and then analyze them.
Afterword:
I would be grateful for additional ideas on how to predict tomorrow’s closing price in the market. Preferably without resorting to the Python machine learning methodology. (Study and work in this direction continues…)