Hi! Testing often uses the back/forward test methods, stress testing, or test on chaotic quotations. Today I want to tell how to simulate the situation when the algorithm is good, but for some reasons our application was not executed.
There are lots of possible reasons: late posting, problems with the Internet slippage, stock/broker/software malfunction, etc. To get such crashes just add a random event to the terms of trade, and depending on the logic of the algorithm, set this randomness.
For example, if you trade on the market, the randomness of events is possible for a maximum of 10% of cases. If you trade by levels, with conditional orders, there will also be 10-20% of accidents depending on the slippage, but it is important to keep in mind that the levels are usually saved and if you do not open now, you can open later at the same price, and while testing the situation will not be much distorted. While trading against the market with the limits (scalping) you can surely put randomness in 80% of cases, whereas there are much more surprises and they are more common. It’s important to understand, that you can’t use one randomness for all algorithms. Also, by the way, a random number is also generated not so randomly, therefore, using randomness, you should use an additional setting for generating numbers, which helps you view different randomness.
Let's turn to statistics
The picture shows trade statistics without random crashes. Pay attention to the brown line — it is solid, which means the signal is constant. Also look in the upper-left corner, the number of deals.
Now the brown line became intermittent, indicating that the the signal appears and disappears, and therefore the transaction will not be closed. And it is clearly visible that if in the first example the transaction was closed, then after adding randomness of execution the position was not closed, since there was no signal at that time. And no matter how it looks, the statistics improved – sometimes accidents are useful. This is also confirmed the number of transactions — the number has decreased due to the fact that we did not close somewhere, and somewhere we did not open once again.
And the last example, with the probability of signal execution only in 5% of cases. The dotted brown line indicates that the signal is very rarely active
If you have any questions or suggestionsб please contact us)) If you are interested in continuing to read about trading, algorithms and statistics, please write me about it, or subscribe to me.
Submitted October 05, 2020 at 11:10AM by Saro_M_V