0bps

Strategy vault / Mean reversion

Ichimoku Kinko Hyo Mean Reversion Strategy

This strategy integrates Ichimoku Kinko Hyo indicator, daily breakout, Gaussian smoothed moving average, MACD and other technical indicators to determine trend direction and find reliable entry points.

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

Overview

This strategy integrates Ichimoku Kinko Hyo indicator, daily breakout, Gaussian smoothed moving average, MACD and other technical indicators to determine trend direction and find reliable entry points.

Strategy Logic

  1. Ichimoku Kinko Hyo judgment: Conversion Line crossover above Base Line is bullish signal.

  2. Daily breakout judgment: Today's close higher than yesterday's close by certain threshold confirms bullish.

  3. Gaussian smoothed MA judgment: Price crossover above MA is bullish.

  4. MACD judgment: DIFF crossover above DEA is bullish.

  5. Combining above factors to determine trend change and entry point.

Advantages

  1. Multiple indicators improve accuracy.

  2. Intraday and multi-timeframe confirmations avoid false breakout.

  3. Ichimoku Kinko Hyo reliably determines trend.

  4. Gaussian smoothed MA has small lag.

  5. MACD judges momentum change.

Risks

  1. Multiple simultaneous conditions reduce chance of entries.

  2. Wrong indicator parameters may generate wrong signals.

  3. Intraday and multi-timeframe signals may conflict.

  4. Fake breakouts still occur, incurring losses.

Possible solutions:

  1. Adjust parameters to increase entries.

  2. Optimize parameters for different products and timeframes.

  3. Coordinate signals from different timeframes.

  4. Use stop loss to limit losses.

Optimization Directions

  1. Test different indicator combinations for better signals.

  2. Add machine learning to improve judgements from more data.

  3. Add trend detection to avoid counter-trend trades.

  4. Optimize money management for robustness.

  5. Optimize stop loss and take profit for profitability.

Summary

This strategy integrates multiple indicators to determine trend direction, and enters on high probability bullish signals verified across timeframes and indicators. It can be improved by adjusting parameters, optimizing indicator combinations and incorporating more data to integrate more signals while maintaining stability for more trading opportunities.

Parameters

NameDefaultWhat it controls
v_input_114Double HullMA
v_input_20.001Decision Threshold (0.001)
v_input_3-500Stop Loss in $
v_input_425000Target Point in $
v_input_57Length
v_input_69Conversion Line Periods
v_input_726Base Line Periods
v_input_852Lagging Span 2 Periods
v_input_926Displacement
v_input_109MACD_Length
v_input_1112MACD_fastLength
v_input_1226MACD_slowLength

Source Pine Script

/*backtest
start: 2022-09-17 00:00:00
end: 2023-09-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
// Any timeFrame ok but good on 15 minute & 60 minute , Ichimoku + Daily-Candle_cross(DT) + HULL-MA_cross + MacD combination 420 special blend
strategy("Ichimoku + Daily-Candle_X + HULL-MA_X + MacD", shorttitle="٩(̾●̮̮̃̾•̃̾)۶", overlay=true, default_qty_type=strategy.percent_of_equity, max_bars_back=26, default_qty_value=100, calc_on_order_fills= true, calc_on_every_tick=true, pyramiding=0,precision=6)
keh=input(title="Double HullMA",defval=14, minval=1)
dt = input(defval=0.0010, title="Decision Threshold (0.001)", type=float, step=0.0001)
SL = input(defval=-500.00, title="Stop Loss in $", type=float, step=1)
TP = input(defval=25000.00, title="Target Point in $", type=float, step=1)
ot=1
p = input(7, minval=1, title="Length")
pi=3.1415926535
w=2*pi/p
beta = (1 - cos(w))/(pow(1.414,2.0/3) - 1)
alfa = -beta + sqrt(beta*beta + 2*beta)
ret1= pow(alfa,4)*close+4*(1-alfa)*nz(ret1[1])-6*pow(1-alfa,2)*nz(ret1[2])+4*pow(1-alfa,3)*nz(ret1[3])-pow(1-alfa,4)*nz(ret1[4])
ret2= pow(alfa,4)*close[1]+4*(1-alfa)*nz(ret1[1])-6*pow(1-alfa,2)*nz(ret1[2])+4*pow(1-alfa,3)*nz(ret1[3])-pow(1-alfa,4)*nz(ret1[4])
confidence=(security(syminfo.tickerid, 'D', close)-security(syminfo.tickerid, 'D', close[1]))/security(syminfo.tickerid, 'D', close[1])
conversionPeriods = input(9, minval=1, title="Conversion Line Periods")
basePeriods = input(26, minval=1, title="Base Line Periods")
laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods")
displacement = input(26, minval=1, title="Displacement")
donchian(len) => avg(lowest(len), highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
LS=close, offset = -displacement
MACD_Length = input(9)
MACD_fastLength = input(12)
MACD_slowLength = input(26)
MACD = ema(close, MACD_fastLength) - ema(close, MACD_slowLength)
aMACD = ema(MACD, MACD_Length)
closelong = ret1<ret2 and close<ret2 and confidence<dt or strategy.openprofit<SL or strategy.openprofit>TP
if (closelong)
    strategy.close("Long")
longCondition = ret1>ret2 and strategy.opentrades<ot and confidence>dt and close>ret2 and leadLine1>leadLine2 and open<LS and MACD>aMACD
if (longCondition)
    strategy.entry("Long",strategy.long)
//                         /L'-, 
//                               ,'-.           /MM . .             /  L '-, 
//     .                    _,--dMMMM\         /MMM  `..           /       '-, 
//     :             _,--,  )MMMMMMMMM),.      `QMM   ,<>         /_      '-,' 
//     ;     ___,--. \MM(    `-'   )M//MM\       `  ,',.;      .-'* ;     .' 
//     |     \MMMMMM) \MM\       ,dM//MMM/     ___ < ,; `.      )`--'    / 
//     |      \MM()M   MMM)__   /MM(/MP'  ___, \  \ `  `. `.   /__,    ,' 
//     |       MMMM/   MMMMMM( /MMMMP'__, \     | /      `. `-,_\     / 
//     |       MM     /MMM---' `--'_ \     |-'  |/         `./ .\----.___ 
//     |      /MM'   `--' __,-  \""   |-'  |_,               `.__) . .F. )-. 
//     |     `--'       \   \    |-'  |_,     _,-/            J . . . J-'-. `-., 
//     |         __  \`. |   |   |         \    / _           |. . . . \   `-.  F 
//     |   ___  /  \  | `|   '      __  \   |  /-'            F . . . . \     '` 
//     |   \  \ \  /  |        __  /  \  |  |,-'        __,- J . . . . . \ 
//     |    | /  |/     __,-  \  ) \  /  |_,-     __,--'     |. .__.----,' 
//     |    |/    ___     \    |'.  |/      __,--'           `.-;;;;;;;;;\ 
//     |     ___  \  \     |   |  `   __,--'                  /;;;;;;;;;;;;. 
//     |     \  \  |-'\    '    __,--'                       /;;;;;;;;;;;;;;\ 
// \   |      | /  |      __,--'                             `--;;/     \;-'\ 
//  \  |      |/    __,--'                                   /  /         \  \ 
//   \ |      __,--'                                        /  /           \  \ 
//    \|__,--'                                          _,-;M-K,           ,;-;\ 
//                                                     <;;;;;;;;           '-;;;; 
//a1=plot(n1,color=c)
//a2=plot(n2,color=c)
//plot(cross(n1, n2) ? n1 : na, style = circles, color=b, linewidth = 4)
//plot(cross(n1, n2) ? n1 : na, style = line, color=d, linewidth = 4)
//plot(conversionLine, color=#0496ff, title="Conversion Line")
//plot(baseLine, color=#991515, title="Base Line")
//plot(close, offset = -displacement, color=#459915, title="Lagging Span")
//p1=plot (leadLine1, offset = displacement, color=green,  title="Lead 1")
//p2=plot (leadLine2, offset = displacement, color=red,  title="Lead 2")
//fill(p1, p2, color = leadLine1 > leadLine2 ? green : red)
// remove the "//" from before the plot script if want to see the indicators on chart

Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-24. 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/Ichimoku-Kinko-Hyo-Mean-Reversion-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