Data Science

Creating Better Trading Strategies — The Future

Albert Lai

And here we have it: the last installment of the data science article series! In our previous article, we created some correlated clusters and came away with some pretty incredible results. To wrap the series up, I’ll be going over how creators can apply these findings and what this research means for the future of Tuned!

Combining Your Strategies

As seen from our results in the last article, high performing strategies can result from combining two or more lesser performing ones. If you’re a creator, it could be worthwhile experimenting with your own strategies to explore whether combining some of them will yield superior results. 

To help you along, Christiaan made a sample Tuned Script to combine two strategies. In the script, both are HMA crossover strategies, but you can replace them with the scripts of your own strategies, as well as the set stop loss, take profit, and combination option you’d like to use. 

Here it is:

//Inputs
 
candle_overlap_allowance = seriesOf(numInput("Max Candle Count Between Signals",2.0))
 
//HMA crossover 1
   A1_MA_Long = intInput("A1_Long",9)
   A1_MA_Short = intInput("A1_Short",21)
 
   A1_SL = numInput("A1_Stop Loss",0.15)
   A1_TSL = boolInput("A1_trailing SL", false)
   A1_TP = numInput("A1_Take Profit",0.25)
 
      
   A1_MAL = hullma(close,A1_MA_Long)
   A1_AMA = hullma(close,A1_MA_Short)
   A1_MABuy = crossover(A1_AMA,A1_MAL)
   A1_MASell = crossunder(A1_AMA,A1_MAL)
 
//HMA Crossover 2
   A2_MA_Long = intInput("A2_Long",8)
   A2_MA_Short = intInput("A2_Short",18)
    A2_SL = numInput("A2_Stop Loss",0.04)
   A2_TSL = boolInput("A2_trailing SL", true)
   A2_TP = numInput("A2_Take Profit",0.2)
    A2_MAL = hullma(close,A2_MA_Long)
   A2_AMA = hullma(close,A2_MA_Short)
 
   A2_MABuy = crossover(A2_AMA,A2_MAL)
   A2_MASell = crossunder(A2_AMA,A2_MAL)
 
//buy sell combo switch
 
    Order_Type= strInput("Order_Type", "Order_Type", "Order_Type", "All_Strict", ["All_Strict", "Strict_Buy_Any_Sell", "Strict_Sell_Any_Buy", "Strict_Buy_A1_Sell","Strict_Buy_A2_Sell","Only_A1","Only_A2"])
 
 
    if (Order_Type == "All_Strict") {
       buy = and(lt(barssince(A1_MABuy),candle_overlap_allowance),lt(barssince(A2_MABuy),candle_overlap_allowance))
       sell = and(lt(barssince(A1_MASell),candle_overlap_allowance), lt(barssince(A2_MASell),candle_overlap_allowance))
    } else if (Order_Type == "Strict_Buy_Any_Sell") {
       buy = and(lt(barssince(A1_MABuy),candle_overlap_allowance),lt(barssince(A2_MABuy),candle_overlap_allowance))
       sell = or(lt(barssince(A1_MASell),candle_overlap_allowance), lt(barssince(A2_MASell),candle_overlap_allowance))
    } else if (Order_Type == "Strict_Sell_Any_Buy") {
       buy = or(lt(barssince(A1_MABuy),candle_overlap_allowance), lt(barssince(A2_MABuy),candle_overlap_allowance))
       sell = and(lt(barssince(A1_MASell),candle_overlap_allowance), lt(barssince(A2_MASell),candle_overlap_allowance))
    } else if (Order_Type == "Strict_Buy_A1_Sell") {
       buy = and(lt(barssince(A1_MABuy),candle_overlap_allowance),lt(barssince(A2_MABuy),candle_overlap_allowance))
       sell = A1_MASell
    } else if (Order_Type == "Strict_Buy_A2_Sell") {
       buy = and(lt(barssince(A1_MABuy),candle_overlap_allowance),lt(barssince(A2_MABuy),candle_overlap_allowance))
       sell = A2_MASell
    } else if (Order_Type == "Only_A1") {
       buy = A1_MABuy
       sell = A1_MASell
    } else if (Order_Type == "Only_A2") {
       buy = A2_MABuy
       sell = A2_MASell
    }
 
 
//SL & TP
 
    StopLoss = iff(gt(seriesOf(A1_SL),seriesOf(A2_SL)), seriesOf(A2_SL), seriesOf(A1_SL))
    TakeProfit = iff(gt(seriesOf(A1_TP),seriesOf(A2_TP)), seriesOf(A2_TP), seriesOf(A1_TP))
 
    conf_stopLossPercent.set(StopLoss)
    conf_takeProfitPercent.set(TakeProfit)
    conf_takeProfitTrailingPercent.set(seriesOf(0.0))
 
//plot
 
    // plot(AMA, "kamaShort", "#ff0000", 1)
    // plot(MAL, "smaLong", "#42f682", 1)
    // plot(LRR1, "LRR1", "#0000ff", 1)
    // plot(LRR2, "LRR2", "#9999ff", 1)
    // //plot(LRR, "LRR", "#9999ff", 1)
 
//signal Push
    out(signalIf(buy, sell))

Feel free to reach out on our Discord if you need any help using this script to combine your strategies!

Just for fun, let’s see how this specific correlated pair performs over the batch test period (from May 21, 2021 to December 15, 2021):

StrategyProfit/LossProfitable TradesMDD# TradesProfitable MonthsAverage Lose MonthAverage Win MonthAverage Monthly Profit
Combined Pair180.97%51.97%-21.70%12775%-1.49%17.02%14.47%
Strategy 112.72%29.71%-46.75%27150%-10.54%12.66%2.59%
Strategy 234.22%51.97%-42.17%48950%-10.33%16.71%5.28%

As you can see, we’re using different metrics to evaluate these strategies as we did in the last article. That’s because these metrics are directly from the Tuned editor! Nonetheless, we see the combined pair significantly outperforming each individual strategy, with half the Maximum Drawdown and nearly 3x the average monthly profit of the best of the two. The individual strategies had profit factors of 1.04 and 1.07, while the combined pair takes it up to 1.63. Moreover, averaging 18.6 trades a month, we are likely not overfitting on the data. 

Finally, here’s how the combined pair does long term over a backtest:

The backtest ran from February 2020 to December 2021, with each bar representing the profit for a single month.

Not too shabby, right? But before you get started, you might want to consider…

Collaborating with Other Creators

From my research, I’ve seen that most of the time, it’s the strategies with different creators that correlate well together. Each creator has a unique way of thinking about and building strategies and by collaborating with each other, even better results can be achieved. It’s like finding confluence, but between different minds! 

Tuned has many incredible creators and the following are just a handful of them:

If you’re a creator, we encourage you to reach out to other creators on Discord and perhaps strike up a collaboration! 

Also, consider broadening your scope. For instance, trend trading strategies such as those using moving averages or momentum might correlate the best with strategies using other indicators like Bollinger Bands. Looking at other concepts can improve your strategies.

The Future of Tuned

Throughout the lifetime of this research project, the Tuned team has been excited about its implications. While we’re currently focusing on other features that will be going live early 2022, the team really likes the idea and it’s something we’re keeping in mind for later this year. 

A sneak peek into what we’re thinking: the idea is to enable strategy creators to opt-in to allow their signals to be used by other creators and receive a profit share in return. Obviously, it’s still very much in the works and will likely change, but we’re just as excited as you are to see what comes of this research.

Wrap Up

I hope you’ve enjoyed reading about the work I’ve been doing at Tuned to create better trading strategies. Thanks to the help of many Tuners, especially Christiaan, I’ve been able to do some really incredible work and share it with you all. Whether you’re an experienced strategy creator or just reading to learn more about the whole world of quantitative analysis, I hope you’ve learned a thing or two. Happy trading!

Disclaimer: The opinions expressed here are for general informational purposes only and are not intended to provide specific advice or recommendations for any specific security or investment product. You should never invest money that you cannot afford to lose. Before trading using complex financial products, please ensure to understand the risks involved. Past performance is no guarantee of future results.

Get started now

for free, in the cloud, wherever you are.

All investing involves risk, including the possible loss of all the money you invest, and past performance does not guarantee future performance. Historical returns expected returns, and probability projections are provided for informational and illustrative purposes, and may not reflect actual future performance.

Tuned is not a broker-dealer, exchange, custodian, wallet provider, or counterparty. Investing is highly speculative and volatile. Tuned is only suitable for investors who fully understand the risk of loss and may experience large drawdowns. Investors should never invest more than they can afford to lose.

Apple, the Apple logo, iPhone, and iPad are trademarks of Apple Inc., registered in the U.S. and other countries and regions. App Store is a service mark of Apple Inc.

Google Play and the Google Play logo are trademarks of Google LLC.