トレンド 戦略 から 利益 を 得る

作者: リン・ハーンチャオチャン, 日時: 2023-09-26 11:22:04
タグ:

概要

トレンドによる利益の引き上げ戦略は,長期的傾向と短期的引き下げを検出し,全体的な上昇傾向中に長期的ポジションを保持し,短期的なダウンを把握し,合理的なストップ・ロストと利益の引き上げレベルを設定して,トレンドを順守し,利益を適時に引き上げることを目的としています.

戦略の論理

この戦略は,主に長期および短期トレンドを決定するためにEMAとRSIを使用する.特に,長期トレンドを判断するために50日間のEMAと200日間のEMAを使用し,トレンド強さを測定するためにRSIを使用する.長期が上昇傾向 (200日間のEMA上昇) で強く (50以上のRSI),短期が引き下げ (最後の2個のキャンドルストイッチが低くなって閉じる) を見ると,ロングポジションを取ります.

ポジションに入るとストップ・ロストとテイク・プロフィートの条件を設定する.価格がエントリー価格より2倍以上のBHDユニット上昇すると,利益が取られる.価格がエントリー価格より3倍以上のBHDユニット低下すると,ポジションは停止される.BHDユニットは最後の200個のキャンドルスティックの幅に基づいて計算される.

戦略は長期・短期的傾向を完全に考慮し,リスクをコントロールしながら利益を増やし,タイミングで利益を得ながら傾向を追及します

利点分析

この戦略には以下の利点があります.

  1. 長期および短期的動向を考慮し,強度指標と組み合わせて,様々な市場に盲目に入場することを避ける.

  2. トレンドに沿って入場する 勝率が高い

  3. 利益とストップ・ロスのポイントは 利益とリスクのコントロールを 及時に行うことができます

  4. TPとSLは 波動性に基づいて動いています 比較的合理的です

  5. バックテストは シンボルと時間枠の間で 良い収益と安定性を示しています

  6. シンプルで明快な論理で あらゆるスキルレベルで 簡単に理解し 実行できます

リスク分析

この戦略にはいくつかのリスクもあります:

  1. 長期・短期的な判断が誤って入口方向に繋がる

  2. 崖のような市場崩壊はストップを突破する可能性があります

  3. パラメータの設定が悪ければ 性能が悪くなる

  4. TPが太りすぎて 早く出ない

  5. バックテスト ≠ ライブパフォーマンス,継続的な最適化が必要

解決策:

  1. パラメータを最適化し,MA期間を調整し,クロスバリダーション指標を追加する.

  2. より広いストップ,位置のサイズ,他のリスク制御

  3. パラメータを評価する 広範なバックテスト

  4. 市場状況に基づいて動的TP最適化

  5. バックテスト,最適化, リアルタイム調整

オプティマイゼーションの方向性

戦略は以下によってさらに最適化できます.

  1. パラメータ調整,MA期間,BHD単位期間など

  2. 短期的な精度を高めるために指標,MACD,KDなどを追加します.

  3. TP/SLの最適化 変動性に基づくダイナミックサイズなど

  4. トレンド強度に基づいて ポジションサイズを追加します

  5. より多くのシンボルと時間枠で 安定性をテストする

  6. 罠を避けるために,閉じる価格 > 開く価格のようなフィルターを追加します.

  7. 機械学習を組み込み より多くの自動化と知性を実現します

勝利率,収益率,安定性,適応性なども向上させることができます

結論

トレンド戦略の"Take Profit on Trend"は,長期・短期トレンド,トレンドをフォローし,明確なTP/SLを考慮する利点がある.これは安定した効率的なトレンドフォローアプローチである.しかし,リスクは存在し,継続的な最適化とライブ調整を必要とする.論理は明確で実行が簡単である.トレーダーのために勉強し適用する価値がある.さらなる最適化により,堅牢な量子戦略になることができます.


/*backtest
start: 2023-08-26 00:00:00
end: 2023-09-25 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © BHD_Trade_Bot

// @version=5
strategy(
 shorttitle            = 'Take Profit On Trend',
 title                 = 'Take Profit On Trend (by BHD_Trade_Bot)',
 overlay               = true,
 calc_on_every_tick    = true,
 calc_on_order_fills   = true,
 use_bar_magnifier     = true,
 initial_capital       = 1000,
 default_qty_type      = strategy.percent_of_equity,
 default_qty_value     = 100,
 commission_type       = strategy.commission.percent,
 commission_value      = 0.1)



// Backtest Time Period
start_year   = input(title='Start year'   ,defval=2021)
start_month  = input(title='Start month'  ,defval=1)
start_day    = input(title='Start day'    ,defval=1)
start_time = timestamp(start_year, start_month, start_day, 00, 00)

end_year     = input(title='end year'     ,defval=2050)
end_month    = input(title='end month'    ,defval=1)
end_day      = input(title='end day'      ,defval=1)
end_time = timestamp(end_year, end_month, end_day, 23, 59)

is_back_test_time() => true



// EMA
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)

// RSI
rsi200 = ta.rsi(close, 200)

// EMA_CD
emacd = ema50 - ema200
emacd_signal = ta.ema(emacd, 50)
hist = emacd - emacd_signal

// BHD Unit
bhd_unit = ta.rma(high - low, 200) * 2
bhd_upper = ema200 + bhd_unit
bhd_lower = ema200 - bhd_unit



// All n candles is going down
all_body_decrease(n) =>
    isValid = true
    for i = 0 to (n - 1)
        if (close[i] > close[i + 1])
            isValid := false
            break
    isValid



// ENTRY CONDITIONS

// Long-term uptrend
entry_condition1 = rsi200 > 51 and hist > 0

// Short-term downtrend
entry_condition2 = all_body_decrease(2)

ENTRY_CONDITIONS = entry_condition1 and entry_condition2

if ENTRY_CONDITIONS and is_back_test_time()
    strategy.entry('entry', strategy.long)


// CLOSE CONDITIONS

// Price increase 2 BHD unit
take_profit = close > strategy.position_avg_price + bhd_unit * 2

// Price decrease 3 BHD unit
stop_loss = close < strategy.position_avg_price - bhd_unit * 3

CLOSE_CONDITIONS = take_profit or stop_loss

if CLOSE_CONDITIONS
    strategy.close('entry')



// Draw
plot(ema50, color=color.orange, linewidth=2)
plot(ema200, color=color.purple, linewidth=2)
bhd_upper_line = plot(bhd_upper, color=color.teal)
bhd_lower_line = plot(bhd_lower, color=color.teal)
fill(bhd_upper_line, bhd_lower_line, color=color.new(color.teal, 90))


もっと