上昇トレンドをブレイクアウトするための参考戦略


作成日: 2024-02-21 10:58:01 最終変更日: 2024-02-21 10:58:01
コピー: 0 クリック数: 610
1
フォロー
1617
フォロワー

上昇トレンドをブレイクアウトするための参考戦略

概要

この戦略は,単純な移動平均に基づいてトレンドの方向を決定し,レジスタンスサポートラインと組み合わせて突破シグナルを形成する長線保有戦略である.価格のピボット高点とピボット低点を計算して,レジスタンスラインとサポートラインを図り,価格がレジスタンスラインを破るときに多めにして,サポートラインを破るときに平仓する.この戦略は,傾向が明らかな株に適しており,よりよいリスク・リターン比を得ることができる.

戦略原則

  1. 20日間の移動平均を基準として計算する
  2. Pivot高点とPivot低点をユーザー入力パラメータに基づいて計算します.
  3. Pivot高点とPivot低点に基づいて抵抗線とサポート線を描画する
  4. 閉店価格がレジスタンスラインより高いときは,追加入場を行います.
  5. サポートラインがレジスタンスラインを突破すると平仓

この戦略は,シンプルな移動平均を使用して,全体的なトレンドの方向を判断し,キーポイントを突破して取引シグナルを形成し,典型的な突破型戦略に属します.キーポイントとトレンドの判断によって,偽の突破を効果的にフィルターすることができます.

優位分析

  1. 戦略的な機会が豊富で,波動性の高い株に適しており,トレンドを簡単に捉えることができます.
  2. リスクはコントロールし,利益はリスクに比例する.
  3. 突破信号を利用して偽突破の危険を避ける
  4. パーテムをカスタマイズし,適応性がある

リスク分析

  1. パラメータの最適化により,誤ったパラメータにより偽突破の可能性が増加する.
  2. 突破信号の遅延で,一部の機会が逃れることになった.
  3. 震災の際には 損なわれやすい
  4. サポートラインの調整を遅らせると損失を招く

リスクの軽減は,ストップ・ストップ戦略と組み合わせたリッスル・オプティマイゼーションのパラメータによって可能である.

最適化の方向

  1. 移動平均の周期パラメータを最適化
  2. サポートレジスタンスラインのパラメータを最適化
  3. ストップ・ストップ・ストップ戦略を追加する
  4. 突破確認メカニズムを追加
  5. 取引量などの指標をフィルターする信号

要約する

この戦略全体は,パラメータの最適化と流動性に依存する典型的な突破型戦略であり,トレンドを追跡するトレーダーに適しています. 参照の枠組みとして,実際の需要に応じてモジュールを拡張して,損失停止,信号フィルタなどのメカニズムを使用してリスクを軽減し,安定性を向上させることができます.

ストラテジーソースコード
/*backtest
start: 2023-02-14 00:00:00
end: 2024-02-20 00:00:00
period: 1d
basePeriod: 1h
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/
// © CheatCode1

//@version=5
strategy("Quantitative Trend Strategy- Uptrend long", 'Steady Uptrend Strategy', overlay=true, initial_capital = 1500, default_qty_value = 100, commission_type = strategy.commission.percent, commission_value = 0.01, default_qty_type = strategy.percent_of_equity)


length = input.int(20, minval=1)
src = input(close, title="Source")
basis = ta.sma(src, length)
offset = input.int(0, "Offset", minval = -500, maxval = 500)
plot(basis, "Basis", color=#FF6D00, offset = offset)

inp1 = input.int(46, 'LookbackLeft')
inp2 = input.int(32, 'LookbackRight')

l1 = ta.pivothigh(close, inp1, inp2)
S1 = ta.pivotlow(close, inp1, inp2)

// plot(l1, 'Pivothigh', color.red, 1)
// // plot(S1, 'Pivot Low', color.red)

l1V = ta.valuewhen(l1, close, 0)
S1V = ta.valuewhen(S1, close, 0)

Plotl1 = not na(l1) ? l1V : na
PlotS1 = not na(S1) ? S1V : na

plot(Plotl1, 'Resistance', color.green, 1, plot.style_stepline, true)
plot(PlotS1, 'Support', color.red, 1, plot.style_stepline, true)

Priceforlong = close > l1V ? true : na
Priceforshort = close < S1V ? true : na

plotshape(Priceforlong ? high : na, 'p', shape.arrowup, location.abovebar, color.green, size = size.small)
plotshape(Priceforshort ? low : na, 's', shape.arrowdown, location.belowbar, color.red, size = size.small)

vol = volume
volma = ta.sma(vol, 20)

Plotl1C = ta.valuewhen(na(Plotl1), l1V, 0)
PlotS1C = ta.valuewhen(na(PlotS1), S1V, 0)
//Strategy Execution
volc = volume > volma 

Lc1 = Priceforlong 

Sc1 = Priceforshort

sL = Plotl1 < PlotS1 ? close : na
sS = PlotS1 > Plotl1 ? close : na


if Lc1 
    strategy.entry('Long', strategy.long)
// if Sc1 and C2
//     strategy.entry('Short', strategy.short)

if Priceforshort
    strategy.cancel('Long')
if Priceforlong   
    strategy.cancel('Short')


// Stp1 = ta.crossover(k, d)
// Ltp1 = ta.crossunder(k, d)
// Ltp = d > 70  ? Ltp1 : na
// Stp = d < 30  ? Stp1 : na


if strategy.openprofit >= 0 and sL
    strategy.close('Long')
if strategy.openprofit >= 0 and sS
    strategy.close('Short')
takeP = input.float(2, title='Take Profit') / 100
stopL = input.float(1.75, title='Stop Loss') / 100


// // Pre Directionality

Stop_L = strategy.position_avg_price * (1 - stopL)

Stop_S = strategy.position_avg_price * (1 + stopL)

Take_S= strategy.position_avg_price * (1 - takeP)

Take_L = strategy.position_avg_price * (1 + takeP)
     
// sL = Plotl1 < PlotS1 ? close : na
// sS = PlotS1 < Plotl1 ? close : na
     
// //Post Excecution
if strategy.position_size > 0 and not (Lc1)
    strategy.exit("Close Long", stop = Stop_L, limit = Take_L)

if strategy.position_size < 0 and not (Sc1)
    strategy.exit("Close Short", stop = Stop_S, limit = Take_S)