
これは,TRAMA ((Triangular Moving Average) とSMA ((Simple Moving Average) をベースにしたスマートエネルギー化取引戦略である.この戦略は,2つの均線システムによる取引シグナル生成を組み合わせ,リスク管理のためのストップ・ストップ・ロスのメカニズムを設定している.この戦略は,4サイクルと28サイクルSMAの交差とTRAMA指数を使用して取引シグナルを確認し,複数のシグナルによって取引の正確性を高めています.
策略は2つのコアコンポーネントを使用して取引信号を生成する.第一は,4周期と28周期SMAの交差システムに基づいており,短期平均線が長期平均線を上向きに横切るときに多信号を生成し,下向きに横切るときに空白信号を生成する.次に,策略はTRAMA指標を補助的な確認システムとして導入する.TRAMAは改良された移動平均で,より迅速な応答速度とより低い遅滞性を持つ.価格がTRAMAを突破すると,追加の取引信号が生成される.策略は,百分比ベースのストップ・ストップ・メカニズムを設定し,2%のストップと1%のストップ・ストップ・メカニズムを設定する.
これは,伝統的な技術分析と近代的な量化取引理念を組み合わせた戦略である. 多重信号確認と厳格なリスク管理により,戦略は優れた実用性を示している. いくつかの最適化が必要な場所があるが,全体的なフレームワークの設計は合理的で,良いアプリケーションの見通しがある. 交易者は,実用化する前に,十分な歴史的データリテックとパラメータ最適化を行うことをお勧めする.
/*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)