適応型移動平均とトレンドブレイクアウトに基づく取引戦略


作成日: 2023-09-19 15:49:37 最終変更日: 2023-09-19 15:49:37
コピー: 0 クリック数: 793
1
フォロー
1617
フォロワー

概要

この戦略は,移動平均とトレンドラインの突破を自律的に適応して入場を判断し,RSI指標を使用して出場を決定する.その目標は,トレンド条件を満たしているときに市場に入って,オーバーバイゾーンで止まり,退出し,月1回の取引のみを制御する.

戦略原則

  1. 全体のトレンドの方向性を判断するために,長さ99の自律移動平均を計算します.

  2. 圧力の線を線上に描いて,長さ14のローカルピークを計算します.

  3. 閉店価格が上昇し,今月の注文がまだない場合,追加入場を行う

  4. 14サイクルRSIを計算し,RSIが70を超えると (超買区) ポジションを平止する

  5. “月”回だけ取引する”

優位分析

  1. 動向変化を動的に追跡できる

  2. トレンドラインの突破と組み合わせると,入場精度が向上します.

  3. RSI指標は,過剰買いと過剰売りを効果的に判断し,リアルタイムでリスクを制御します.

  4. 取引頻度や手数料を減らすために月1回のみの取引

  5. 規則はシンプルで明快で,理解し実行しやすい.

リスク分析

  1. パラメータを正しく設定しない場合,入場地点を間違える可能性があります.

  2. 固定出場指標は市場の変化に間に合わない

  3. 退却のリスクはある

  4. 長期投資のリスクをコントロールできない

  5. フィルタリング条件が多すぎると入場できない

最適化の方向

  1. 異なるパラメータの設定をテストし,最適なパラメータを探します.

  2. 戦略の安定性を高めるために,他のフィルタリング指標を追加

  3. ダイナミック・ストップ・ストップとストップ・ストップ・ストップ・ストラトジーを開発する

  4. スタートロジックを最適化し,より強力な突破を特定する.

  5. 適用される品種と周期パラメータ

  6. トレンド指数と偽突破信号のフィルタリング

要約する

この戦略は,トレンド分析と超買い超売り指標を統合し,比較的安定したトレンド追跡効果を実現している.さらに最適化パラメータ設定,動的出場機構などにより,信頼できる定量取引システムになることができる.全体的に,この戦略は操作が容易で,さらなる改善と検証に値する.

ストラテジーソースコード
/*backtest
start: 2023-09-11 00:00:00
end: 2023-09-18 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy('Bannos Strategy', shorttitle='Bannos', overlay=true)

//The provided script is an indicator for TradingView written in Pine Script version 5. The indicator is used to determine entry and exit points for a trading strategy. Here's a detailed breakdown of what the script does:

// Strategy Definition:

// Bannos Strategy is the full name, with a short title Bannos.
// The overlay=true option indicates that the strategy will be overlayed on the price chart.
// Tracking Entry Month:

// A variable lastEntryMonth is set up to track the month of the last entry.
// currentMonth identifies the current month.
// Trend Regularity Adaptive Moving Average (TRAMA):

// It takes an input of length 99 as default.
// It uses adaptive calculations to track trend changes.
// Trendlines with Breaks:

// Identifies local peaks over a given period (in this case, 14) and calculates a slope based on these peaks.
// Relative Strength Index (RSI):

// Uses a length of 14 (default) to calculate the RSI.
// RSI is an oscillation indicator that indicates overbought or oversold conditions.
// Strategy Logic for Long Entry:

// A long position is opened if:
// The close price is above the TRAMA.
// There's a crossover of the close price and the upper trendline.
// The position is taken only once per month.
// Strategy Logic for Long Exit:

// The long position is closed if the RSI exceeds 70, indicating an overbought condition.
// Plotting:

// The TRAMA is plotted in red on the chart.
// A horizontal line is also drawn at 70 to indicate the RSI's overbought zone.
// In summary, this strategy aims to enter a long position when certain trend and crossover conditions are met, and close the position when the market is considered overbought as per the RSI. Additionally, it ensures entries only occur once a month.
//



// Variable pour suivre le mois de la dernière entrée
var float lastEntryMonth = na
currentMonth = month(time)

// Parameters for Trend Regularity Adaptive Moving Average (TRAMA)
length_trama = input(99)
src_trama = close
ama = 0.
hh = math.max(math.sign(ta.change(ta.highest(length_trama))), 0)
ll = math.max(math.sign(ta.change(ta.lowest(length_trama)) * -1), 0)
tc = math.pow(ta.sma(hh or ll ? 1 : 0, length_trama), 2)
ama := nz(ama[1] + tc * (src_trama - ama[1]), src_trama)

// Parameters for Trendlines with Breaks
length_trend = 14
mult = 1.0
ph = ta.pivothigh(length_trend, length_trend)
upper = 0.
slope_ph = 0.
slope_ph := ph ? mult : slope_ph
upper := ph ? ph : upper - slope_ph

// Parameters for RSI
rsiLength = 14
up = ta.rma(math.max(ta.change(close), 0), rsiLength)
down = ta.rma(-math.min(ta.change(close), 0), rsiLength)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

// Strategy Logic for Long Entry
longCondition = close > ama and ta.crossover(close, upper) and (na(lastEntryMonth) or lastEntryMonth != currentMonth)
if (longCondition)
    lastEntryMonth := currentMonth
    strategy.entry('Long', strategy.long)

// Strategy Logic for Long Exit
exitCondition = rsi > 70
if (exitCondition)
    strategy.close('Long')

// Plotting
plot(ama, 'TRAMA', color=color.red)
hline(70, 'Overbought', color=color.red)