This is an intelligent quantitative trading strategy based on TRAMA (Triangular Moving Average) and Simple Moving Average (SMA). The strategy combines two moving average systems for generating trading signals and implements a stop-loss/take-profit mechanism for risk control. It uses 4-period and 28-period SMA crossovers along with the TRAMA indicator to confirm trading signals, improving accuracy through multiple signal confirmation.
The strategy employs two core components for generating trading signals. First is the crossover system based on 4-period and 28-period SMAs, generating long signals when the short-term MA crosses above the long-term MA, and short signals when it crosses below. Second, the strategy incorporates the TRAMA indicator as an auxiliary confirmation system. TRAMA is an improved moving average with faster response time and less lag. Additional trading signals are generated when price breaks through the TRAMA. The strategy also includes percentage-based take-profit and stop-loss mechanisms set at 2% and 1% respectively.
This is a strategy that combines traditional technical analysis with modern quantitative trading concepts. Through multiple signal confirmation and strict risk control, the strategy demonstrates good practicality. While there are areas for optimization, the overall framework design is reasonable with good application prospects. Traders are advised to conduct thorough historical data backtesting and parameter optimization before live trading.
/*backtest start: 2019-12-23 08:00:00 end: 2024-11-27 08:00:00 period: 1d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ivanvallejoc //@version=5 strategy("MANCOS2.0", overlay=true, margin_long=80, margin_short=80) longCondition = ta.crossover(ta.sma(close, 4), ta.sma(close, 28)) if (longCondition) strategy.entry("My Long Entry Id", strategy.long) shortCondition = ta.crossunder(ta.sma(close, 4), ta.sma(close, 28)) if (shortCondition) strategy.entry("My Short Entry Id", strategy.short) // Parámetros de la TRAMA length = input(1.5, title="TRAMA Length") src = close filt = 2 / (length + 1) trama = 0.0 var tramaPrev = na(trama[1]) ? close : trama[1] trama := (src - tramaPrev) * filt + tramaPrev // Plot de la TRAMA plot(trama, color=color.blue, linewidth=2, title="TRAMA") // Señales de compra y venta basadas en TRAMA buySignal = ta.crossover(close, trama) sellSignal = ta.crossunder(close, trama) // Configuración de Take Profit y Stop Loss takeProfitPerc = input(2, title="Take Profit (%)") / 100 stopLossPerc = input(1, title="Stop Loss (%)") / 100 // Precios de TP y SL takeProfitPrice = strategy.position_avg_price * (1 + takeProfitPerc) stopLossPrice = strategy.position_avg_price * (1 - stopLossPerc) // Condiciones de entrada en largo if (buySignal) strategy.entry("Long", strategy.long) // Condiciones de salida para posición larga (TP/SL) if (strategy.position_size > 0) strategy.exit("TP/SL", "Long", limit=takeProfitPrice, stop=stopLossPrice) // Entrada en corto basada en TRAMA if (sellSignal) strategy.entry("Short", strategy.short) // Precios de TP y SL para posiciones cortas takeProfitPriceShort = strategy.position_avg_price * (1 - takeProfitPerc) stopLossPriceShort = strategy.position_avg_price * (1 + stopLossPerc) if (strategy.position_size < 0) strategy.exit("TP/SL", "Short", limit=takeProfitPriceShort, stop=stopLossPriceShort)