New What If Snippets

Two new What If snippets, which allow us to test how strategy can be managed, depending on its current performance, have been added to the sharing server. The first is Equity MA Trading, which simulates trading strategies based on the performance of the stock curve. The second snippet Profit Factor MA Trading allows you to simulate trading a strategy based on its profit factor. Both snippets are an introduction to the topic of managing the intermediate performance of a strategy.

This what-if snippet allows you to simulate trading a strategy based on whether the current equity is below or above the equity curve. In practice, the snippet works by calculating the moving average balance over x trades. If the equity curve falls below its moving average, the strategy will not trade. While still calculating the moving average (even in the case of trades that are after the moving average.). And once the equity gets back below the moving average the strategy starts trading.

My preliminary tests indicate that this simple implementation does not produce positive results in general. Kevin Davey came to similar conclusions in his theses which you can find here . This functionality is also implemented in QuantAnalyzer and colleagues have come to similar conclusions in this article

Let us show a simple system that turns on and off depending on whether its equity is above or below the average equity of the last 10 trades.

In the figure below, we see the strategies with filtered equity.

However, it is possible to extend the snippet by tracking only long or only short equity or using a different type of moving average.

What if snippet Profit Factor MA Trading calculates the profit factor of the strategy, and when the profit factor is lower than the threshold you have set, the strategy does not trade. Snippet still calculates the profit factor of the strategy, even if the current profit factor is below the threshold. Right at the moment when the profit factor gets above the threshold that we have chosen, the strategy starts trading again.

There are two modes you can use

•  Period = 0: The first one is that you calculate the profit factor of the strategy from 2 trades and compare the performance of the strategy with the value you set
• Period > 0: The second mod calculates the average current profit factor for the last x trades.

Let’s see an example of a simple RSI market reverse strategy on EURJPY.

I apply a snippet that will enable the strategy when its current profit factor is above 1.3.

We see improvement. The strategy has reduced the number of trades, better stability, and much lower DD.

Conclusion

Implementing both snippets into live trading is quite difficult. In reality, it could work like this: on one demo account, the strategy trades, and you use the copy script to trade on the other account. Or you could have a sort where the values are stored in a CSV file on the demo account, and on the real account, the strategy reads the values from the CSV file and trades accordingly. The easiest is probably to simulate money management, and this is the topic we will cover in the following article.

You can donwload boath snippets :

Inline Feedbacks
Emmanuel
January 5, 2022 11:54 am

Good idea !!! Thank you Clonex !!

stuart mckirdy
January 6, 2022 10:06 am

thank you clonex i think this has great potential are you going to do futher work on this

stuart mckirdy
January 6, 2022 10:27 am

clonex would these snippets not help with the following or am i delusional
i think its a great idea from a trade management point of view as well as risk point of view when you trade a large portfolio
doesnt this allow the market to switch the strats on and off

murty
January 24, 2022 9:41 pm

tomas262
January 26, 2022 2:09 pm

New StrategyQuant X Build 136 Dev 2 is out

Mark FricJune 21, 2022

We are glad to announce that new Dev 2 build of an upcoming 136 version of StrategyQuant X was just published. You can download it from our Download page under …

New Indicators have been implemented for StrategyQuant X – June 2022

clonexJune 21, 2022

We have added several new indicators and snippets to the sharing server in recent months. In today’s blog post, we’ll briefly go through each of them. BH Ergodic The formula …

Clone Army ‐ Development and running of a profitable algorithmic trading system

Kornel MazurApril 28, 2022

Clone Army is a fully automated algorithmic trading system, that trades a portfolio of strategies on different markets and time frames. The strategies are mined and robustness tested with a …