Algorithmic Trading: Trading Bot Backtests

Abstract

Algorithmic or systematic trading empowered by the community i.e. JUP Catdets with big brain trading Algos! How can we overcome the stigma that crypto traders are only degens and have no substance vs our traditional counterparts.


The problems of the crypto trading ecosystem:

  • Steep learning curve - we have all heard: ‘95% of all traders lose money’ :thinking:.
  • Trading advice or education often consists of a plethora of influencer-traders & influential-cats mixing and matching fundamental and discretionary concepts resulting in foggy insights at best.
  • Should we stumble across sound information, we have no way to verify its effectiveness or authenticity.
  • Poor risk management! Period. We are a community of 1000x from animal jpeg’s. All or nothing approaches and FOMO often lead to watching respectable growth turn into a major losses.

Disclaimer: this post is not meant to discredit fundamental or discretionary trading in any way, neither are we talking about the value of meme coins so please relax cadets.


A systematic approach:

  • Collect and analyze data from reputable sources or take recommendations for backtests.
    • A contributor may have some variables which seem correlated i.e average true range & volume or a simple RSI indicator.
  • Backtest and optimize strategies using code. Returning common portfolio and trading strategy metrics.
  • Implement the execution logic into Jup.
  • Continue to use ML to mine profitable strategies, with the goal of arriving at an AI trader.

An excerpt of how this process might be mobilized in a working group:

Step 1
Insight received from ace trader:

“Volume and range are highly correlated, we can draw a few inferences when price reaches a key level and the price is not correlated. Absorption is the result of buyer and sellers volume activity at key levels. Eg. where we see very high levels of volume yet the range of the candle is small, we can draw the inference that there are sell limit orders holding the price from moving, i.e absorption”

Step 2
Big brain data science guy:

So in Python, I took a 1 hour dataframe of kline data and grouped by daily data then normalized the atr and volume.

So we can a look at a quick scatter plot to see whether there is any correlation between the two metrics:

So it seems that there is a strong correlation between volume and price range in any given 1 hour candle grouped by daily timeframe.

Lets then write an indicator using linear regression to get a predicted value of range and volume spread then measure the deviation for each candle

We can then take a look at whether or not these values have high or low deviation from the predicted value: positive value means that the range is higher than expected given the volume (exhaustion/less resistance) whereas a negative value means that the given range is lower than expected given the volume (absorption / strong resistance). Note: we use 0.8 arbitrarily to identify high and low ranges from the predicted value

Now we can plot these values over a candlestick chart and take a look. Orange dots indicate the strong resistance and blue dots indicate weak resistance.

Step 3
Systematic Trader: Okay lets take a look does this actually work

If it is true that the range_dev is an indication of weak resistance, then I will use the moving average as my trend indicator, lets say if the close is above the 50 period simple moving average and we receive a blue signal we will buy. We will exit the trade if our TP or SL is hit.

Results:

Lets visualize this performance for the last 1000 bars:

looking good here is the equity curve of the entire duration:

image

Hmmmm… not too bad but we can optimize to make this better

Note to properly optimize a wide range of parameters need to be used, this process is computationally very expensive so we only changed a few TP and SL params to illustrate

results of optimization:
image

Step 4
Working group / Community feedback:

  • Something seems off, you are not calculating fees for trades…
  • Okay perhaps you need more in depth research on what is considered a high/low range deviation

The working group then iterates over this and presents the results to the CWG.

Step 5
Big brain machine learning guy:
We will add these insights to our strategy miner.
Results of strategy insights used in a strategy miner with all the big brain, machine learning things in order to get better strategies and realize the dream of a Jupiter AI trading algo

Step 6
CWG: We want this, we need this LFG
We see an implementation using the Jup API and the jup ecosystem is strengthened. We see more volume and sophisticated catdets with good portfolios J4J!


Conclusion

credits: https://www.youtube.com/@neurotrader888 for his analysis on volume spread, his work assisted greatly in calculating the indicator and inspired a backtest of results shown above.

Really looking forward to working with like minded people on this!

Hope you all made it to the end and enjoyed!

Catch you all in the discord user: kevin#9551. LFG Catdets!

6 Likes

New backtests and results coming up! As always your ideas are welcome, if you have an idea post on this thread and we will slot in your backtest requests into our schedule!

The latest backtest below :smiley:

MTF SMA Trading Backtest and Optimization v0

JUP DCA backtest here: