0bps

Strategy vault / Machine learning

Bottom Hunter Strategy

The Bottom Hunter strategy is a short-term trading strategy for cryptocurrencies. This strategy identifies appropriate entry points by recognizing bottoms during downtrends.

Author
ChaoZhang
Complexity
Intermediate · 65 lines
Parameters
7
Backtest bar
1d · swing
Tested on
BTC/USDT · futures

IMG

Overview

The Bottom Hunter strategy is a short-term trading strategy for cryptocurrencies. This strategy identifies appropriate entry points by recognizing bottoms during downtrends.

Strategy Principle

This strategy combines multiple technical indicators to identify bottoms. Specifically, it uses the MACD indicator to judge bottom reversal signals, the RSI indicator to determine oversold status, and Bollinger Bands to determine if the price is below the lower rail. A buy signal is generated when all conditions are met.

Firstly, the strategy uses MACD divergence to judge the bottom. So-called divergence means that the price makes a new low while the MACD indicator does not make a new low. This situation represents a weakening of trading volume and usually presages an impending trend reversal.

Secondly, the strategy requires that the RSI indicator is below 31.1. RSI below 30 represents an oversold state, which provides an opportunity to buy.

Finally, the strategy requires that the closing price is below the middle rail of the Bollinger Bands. This indicates that the price has fallen below the normal range, thus providing a better opportunity to buy.

When all the above conditions are met at the same time, the strategy generates a buy signal and establishes a position.

Advantage Analysis

The Bottom Hunter strategy has the following advantages:

  1. The use of multiple indicators to determine the bottom ensures the accuracy of bottom identification
  2. Utilizing MACD divergence to judge reversal signals is an experienced trading technique
  3. Judging both oversold and anomalies avoids the risk of false breakouts
  4. Conservative position control, only building positions at key points, avoids excessive trading

Risk Analysis

This strategy also has some risks:

  1. The market may fall further without timely stop loss
  2. The combination of multiple conditions to judge the bottom may miss the bottom in some scenarios
  3. Manual determination of parameters such as RSI thresholds may affect strategy performance

In response to the above risks, real-time tracking stop loss, adjusting parameter ranges, etc. can be used for optimization.

Optimization Directions

The strategy can be optimized in the following directions:

  1. Increase adaptive stop loss mechanism to flexibly adjust stop loss position based on market volatility
  2. Test and optimize the criteria for buy signal determination to identify optimal parameters
  3. Increase machine learning algorithms to automatically identify parameters and trading rules
  4. Add a trend judgment module to avoid entering consolidating markets during trending markets
  5. Incorporate additional indicators like volume change to improve bottom identification

Summary

The Bottom Hunter strategy buys on key bottoms in order to achieve excess returns. The rationale for determining the bottom is robust, while combining multiple filter conditions to avoid false signals. With proper parameter tuning and stop loss control, this strategy can perform well in short-term cryptocurrency trading.

Parameters

NameDefaultWhat it controls
v_input_int_112Fast Length
v_input_int_226Slow Length
v_input_int_39Signal Smoothing
v_input_int_414RSI Length
v_input_int_520BB Length
v_input_1_close0Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4
v_input_float_12BB StdDev

Source Pine Script

/*backtest
start: 2023-01-30 00:00:00
end: 2024-02-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("MACD Divergence Strategy", shorttitle="Strategy: MACD Dive", overlay=true)

// MACDSettings
fastLength = input.int(12, "Fast Length")
slowLength = input.int(26, "Slow Length")
signalSmoothing = input.int(9, "Signal Smoothing")

[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)

// Calculation99dayEMAmoving average
ema99 = ta.ema(close, 99)

// CalculationRSI
rsiLength = input.int(14, title="RSI Length")
rsi = ta.rsi(close, rsiLength)

// Calculate the middle track of Bollinger Bands
length = input.int(20, "BB Length")
src = input(close, "Source")
mult = input.float(2.0, "BB StdDev")
basis = ta.sma(src, length)

// Buy filter conditions
priceLow = ta.lowest(low[1], 60)
macdLow = ta.lowest(macdLine[1], 60)
divergence = low < priceLow and macdLine > macdLow

allHighsBelowEma99 = true
for i = 0 to 14
    if high[i] > ema99
        allHighsBelowEma99 := false

rsiBelow = rsi < 31.1
priceDifference = (high - low) / low * 100

buySignal1 = divergence and allHighsBelowEma99 and rsiBelow
buySignal2 = high < ema99 and priceDifference >= 3 and close < open and high < basis 
buySignal3 = buySignal1 or buySignal2

// Define a variable to store the buying price
var float buyPrice = na

// Buy logic
if buySignal3
    buyPrice := close // Store the Price at Purchase
    strategy.entry("Buy", strategy.long)

// Take profit and stop loss conditions
longTakeProfit = buyPrice * 1.1 // Set take profit at 1.2 times the purchase price
longStopLoss = buyPrice * 0.98// Set stop loss to 0.99 times the purchase price

// Apply Take Profit and Stop Loss
strategy.exit("Exit", "Buy", limit=longTakeProfit, stop=longStopLoss)
// Draw buy signal
plotshape(series=buySignal3, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)

Published by ChaoZhang on the FMZ strategy square · last modified 2024-02-06. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Bottom-Hunter-Strategy.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open