This is a quantitative trading strategy that combines trend following and momentum analysis. The strategy utilizes Triple Exponential Moving Average (TEMA), multiple moving average crossovers, and a MACD variant to identify market trends and entry points. It implements strict risk control mechanisms, including fixed stop-loss, profit targets, and trailing stops to optimize risk-reward balance.
The strategy determines trading signals through three core technical indicator systems:
Trade signals are triggered when all conditions are met:
The strategy builds a robust trading system by integrating multiple technical indicator systems. Its core strengths lie in multiple confirmation mechanisms and comprehensive risk control systems. While there are certain lag risks, the strategy has significant improvement potential through parameter optimization and functional expansion. Suitable for traders seeking stable returns.
/*backtest start: 2024-10-01 00:00:00 end: 2024-10-31 23:59:59 period: 2h basePeriod: 2h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("ITG Scalper Strategy", shorttitle="lokesh_ITG_Scalper_Strategy", overlay=true) // General inputs len = input(14, title="TEMA period") FfastLength = input.int(13, title="Filter fast length") FslowLength = input.int(18, title="Filter slow length") FsignalLength = input.int(14, title="Filter signal length") sl_points = 7 // 5 points stop loss tp_points = 100 // 100 points target profit trail_points = 15 // Trailing stop loss every 10 points // Validate input if FfastLength < 1 FfastLength := 1 if FslowLength < 1 FslowLength := 1 if FsignalLength < 1 FsignalLength := 1 // Get real close price realC = close // Triple EMA definition ema1 = ta.ema(realC, len) ema2 = ta.ema(ema1, len) ema3 = ta.ema(ema2, len) // Triple EMA trend calculation avg = 3 * (ema1 - ema2) + ema3 // Filter formula Fsource = close FfastMA = ta.ema(Fsource, FfastLength) FslowMA = ta.ema(Fsource, FslowLength) Fmacd = FfastMA - FslowMA Fsignal = ta.sma(Fmacd, FsignalLength) // Plot EMAs for visual reference shortema = ta.ema(close, 9) longema = ta.ema(close, 15) yma = ta.ema(close, 5) plot(shortema, color=color.green) plot(longema, color=color.red) plot(yma, color=#e9f72c) // Entry conditions firstCrossover = ta.crossover(Fmacd, Fsignal) and avg > avg[1] secondCrossover = ta.crossover(shortema, longema) // Assuming you meant to cross shortema with longema thirdCrossover = ta.crossover(close, yma) var bool entryConditionMet = false if (firstCrossover) entryConditionMet := true longSignal = entryConditionMet and secondCrossover and thirdCrossover // Strategy execution if (longSignal) strategy.entry("Long", strategy.long) entryConditionMet := false // Reset the entry condition after taking a trade // Calculate stop loss and take profit prices var float long_sl = na var float long_tp = na if strategy.position_size > 0 // Long position long_sl := close - sl_points long_tp := close + tp_points // Adjust stop loss with trailing logic if (close - long_sl > trail_points) long_sl := close - trail_points strategy.exit("Exit Long", "Long", stop=long_sl, limit=long_tp) // Plotting Buy signals plotshape(series=longSignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal") // Alerts alertcondition(longSignal, title="Buy Signal", message="Buy Signal")