This strategy integrates moving average strategy, Ichimoku cloud charts and Keltner channel technical indicators to achieve trend following and breakthrough trading, which is suitable for high-frequency algorithmic trading.
This strategy integrates Ichimoku cloud charts, Keltner channels and moving average strategies with multiple technical indicators to achieve trend tracking and efficient breakthrough trading. Compared with a single indicator, the judgment of this strategy is more comprehensive and accurate, avoiding certain false signals. At the same time, there are also problems that the parameter settings are more complex and need to be optimized for individual stocks. In general, this strategy is suitable for high-frequency algorithmic trading with significant effects.
/*backtest start: 2023-11-19 00:00:00 end: 2023-12-19 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 // Author: Persio Flexa // Description: Ichimoku Clouds with Keltner Channel, perfect for margin trading strategy("Ichimoku Keltner Strategy", overlay=true) // -- Keltner ------------------------------------------------------------------ source = close useTrueRange = input(true) length = input(18, minval=1) mult = input(1.8) ma = sma(source, length) range = useTrueRange ? tr : high - low rangema = sma(range, length) upper = ma + rangema * mult lower = ma - rangema * mult plot(ma, title="BASE", color=orange,transp=85) plot(upper, title="UPPER", color=red) plot(lower, title="LOWER", color=green) //crossUpper = crossover(source, upper) //crossLower = crossunder(source, lower) crossUpper = source > upper crossLower = source < lower bprice = 0.0 bprice := crossUpper ? high+syminfo.mintick : nz(bprice[1]) sprice = 0.0 sprice := crossLower ? low -syminfo.mintick : nz(sprice[1]) crossBcond = false crossBcond := crossUpper ? true : na(crossBcond[1]) ? false : crossBcond[1] crossScond = false crossScond := crossLower ? true : na(crossScond[1]) ? false : crossScond[1] cancelBcond = crossBcond and (source < ma or high >= bprice ) cancelScond = crossScond and (source > ma or low <= sprice ) // --------------------------------------------------------------------- // -- Ichimoku ATRlength = input(200, minval=1) ATRMult = input(2.272, minval=1) ATR = rma(tr(true), ATRlength) len = input(26, minval=1, title="EMA Length") src = input(close, title="Source") out = ema(src, len) emaup = out+(ATR*ATRMult) emadw = out-(ATR*ATRMult) conversionPeriods = input(15, minval=1), basePeriods = input(35, minval=1) laggingSpan2Periods = input(52, minval=1), displacement = input(26, minval=1) donchian(len) => avg(lowest(len), highest(len)) conversionLine = donchian(conversionPeriods) baseLine = donchian(basePeriods) leadLine1 = avg(conversionLine, baseLine) leadLine2 = donchian(laggingSpan2Periods) p1 = plot(leadLine1, offset = displacement, color=green,transp=85, title="Lead 1") p2 = plot(leadLine2, offset = displacement, color=red,transp=85, title="Lead 2") fill(p1, p2,silver) longCond = crossover(conversionLine, baseLine) shortCond = crossunder(conversionLine, baseLine) // ------------------------------------------------------------------------- if (crossUpper and (conversionLine > baseLine)) strategy.entry("long", strategy.long, stop=bprice, comment="LONG") if (crossLower and (conversionLine < baseLine)) strategy.entry("short", strategy.short, stop=sprice, comment="SHORT") strategy.close("long", when = (shortCond and source < lower)) strategy.close("short", when = (longCond and source > upper))