Unforseen Consequences

Gordon Freeman went like every day to his job at the secret Black Mesa facility, at the end of the day he would find himself fighting for his life to get out of there alive…

One of the things that cannot be foreseen in trading is the future. You can believe that you increase your chances by running different backtests, but you can always run the risk that the Bot will unintentionally get trapped in parameters that were adjusted based on events. past

One of the things that can be done to test the bot even more is to obviously run it in Paper, but another thing that can be useful is to create a Monte Carlo Simulation, at least a Phony one.

Monte Carlo Simulation performs risk analysis by building models of possible outcomes by substituting a range of values ​​(a probability distribution) for any factors that have inherent uncertainty. It then calculates the results again and again, each time using a different set of random values ​​of the probability functions.
We can simulate this in the Backtests by adding one coin or more to the one we are testing, choosing the random mode (Pic 1-2).
You could also add increasing the Tax Fee to simulate a spread (pic 3-4).
We can also change the Take Profit so that it is less. (pic 4-5)
and at the end we can add a cooldown to add more randomness (pic 6-7)

This in theory will make the results of a backtest when run again altering these parameters look different.

If our Bot still maintains similar parameters in Win Ratio and is profitable, it could be thought that this False Simulation has passed, this could give it an advantage and leave it ready to face unforseen consequences…

Original backtest BTC:


Random






3 Likes

Super idea! What where specifically the changes that you tested here (increasing tax, cooldown,…)?

2 Likes

Many thanks Perez! Those 2 and the value of the take profit in this case is 0.5 I changed to 0.4 and at last the Random mode that you can use when you have a bot with multiple coins and you want the bot trade with only one per time.
I guess with that 4 parameters you will change enough the back test data.
You can put the 4 at once or you can add 1 in every back test.

2 Likes

Great idea thanks for sharing. Monte Carlo simulation is something I wanted to build in the backtester, but I am not sure it will be possible to do it client side. Hopefully we will get to it soon.

1 Like

Would it be possible to implement a controllable Random Walk chart that creates different Random Walks if you use different start parameters but the same else?

1 Like

I guess I would do it like creating a series of OHLC candles. C of one candle should be almost O of the next candle. Within each candle we can define how much percent the HLC values move away from O. We can control how likely a green candle is, how far it is allowed to move upwards and on the other side how far a negative candle is allowed to move downwards.

If I can give you my opinion this is the number one TRAP in backtesting or building a strategy - why? simple because we have infinite combination of indicators, indicators settings, coins, parameters, feature combination, etc.

I use the black and white principle where only the essential elements are in focus and then I add colours with the actual settings and optimisation afterwards

But Monte Carlo Simulation does not alter parameters in the bot it only alter the factors with an inherent uncertainty wich the bot will face, is just another layer of backtest that you can take in consideration, some of them will happen for sure.

1 Like

I think I will have to have a proper look and study it :+1: anything to share brother?

1 Like

take a look @Rossano : https://youtu.be/0gowMNRc9u8?si=zq8TsTrZXa5y-Z8D

1 Like

An easy way to do Monte Carlo simulation in Gainium is to take the entries of any back test and then to randomize their order of those entries and run the back test using the same strategy settings in a loop and then displaying the corresponding results in a table below with a Equity Curve of each run on top another.

3 Likes

and Fisher F test for model confirmation ? before generate a new value.

Even is not bad idea if you take all the trades and put them in random, you may have a better idea of your possible drowdown but at the end of the test you will have always the same result wich is unlikely to happen. you need evaluate more variables like TP variations, Trades not taken, strong manipulation. etc.
One test could be drop your bot in radom periods of 6 months and see if he can manage to be profitable after a X period of time. I hope this help.