トレンドキャッチャー戦略

作者: リン・ハーンチャオチャン,日付: 2024-04-26 11時48分28秒
タグ:マルチSMA

img

概要

トレンドキャッチャー戦略は,独自の方法を使用してトレンド形成を検出し,トレンドの方向にポジションを開く戦略である.特定の範囲内の最高値と最低値の間の差を,その範囲内のキャンドルの長さの和で割ることで,limitと呼ばれるパーセント値を計算する.この値が100に近いほど,トレンドは強くなる.この値が設定された限界を超えると,移動平均値が上昇すると,戦略はロングポジションを開く.この値が設定された限界を超えると,移動平均値が下がると,戦略はショートポジションを開く.ポジションを開いた後,価格は一定のレベルに達すると,戦略はポジションの一部を閉じて,トレンドが終わったと考えている点に残りのポジションを移動する.

戦略原則

  1. ある範囲内の最高価格と最低価格の違い,およびその範囲内のすべてのキャンドルの長さの和を計算します.
  2. 違いをキャンドルの長さの和で割って100で掛けると limitと呼ばれるパーセント値が得られます
  3. 制限値が設定値を超え,移動平均値が上昇する場合は,ロングポジションを開く.制限値が設定値を超え,移動平均値が低下する場合は,ショートポジションを開く.
  4. ポジションを開いた後,価格が利潤のレベルに達するとポジションの一部を閉じて,残りのポジションをストップ・ロスのレベルに移動します.
  5. 移動平均値が下がる時,ロングポジションを閉じる.移動平均値が上がる時,ショートポジションを閉じる.

戦略 の 利点

  1. この戦略は,トレンド形成を検出するユニークな方法を使用します.トレンドの強さを決定するための限界値を計算することで,トレンドの開始時にポジションを開くのに役立ちます.
  2. ポジションを開いた後,戦略はポジションの一部を閉じて残りのポジションのストップ・ロスのレベルを移動することによってリスクを制御します.
  3. この戦略は,移動平均の上下交差点を利用し,トレンドの終わりを決定し,タイミングでポジションを閉めるのに役立ちます.

戦略リスク

  1. 戦略はトレンドの開始時にポジションを開く.トレンドが持続できない場合,損失を引き起こす可能性があります.
  2. この戦略は固定的な利益とストップ・ロスのレベルを使用し,一部の場合では柔軟性が十分でない場合もあります.
  3. 戦略は動向平均値のみを使用して,トレンドを決定し,トレンドの機会を逃す可能性があります.

戦略の最適化方向

  1. MACD や RSI などの他の指標を使用することで,トレンドを決定し,開設ポジションの正確性を向上させることができます.
  2. 市場変動に基づいて,収益とストップ損失のレベルを動的に調整し,リスクをより良くコントロールします.
  3. 傾向が確認された後にのみポジションを開くことを検討し,傾向の開始時にリスクを軽減する.

概要

トレンドキャッチャストラテジーは,トレンド形成を検出し,トレンド方向にポジションを開くためのユニークな方法を用い,トレンドの強さを決定するために限界値を計算し,トレンド終了を決定するために移動平均の横断を使用する.戦略は,ポジションの一部を閉鎖し,ポジションを開いた後にストップロスのレベルを移動することによってリスクを制御する.しかし,トレンド開始時にポジションを開くときに,戦略は一定のリスクに直面することがあり,固定テイク・プロフィートとストップロスのレベルを使用することは十分に柔軟ではない可能性があり,トレンドを決定するために移動平均を使用するだけでいくつかの機会を逃す可能性があります.将来,他の指標を導入し,動的にテイク・プロフィートとストップロスのレベルを調整し,トレンドを最適化するためにトレンドが確認された後にのみポジションを開くことを検討することができます.


/*backtest
start: 2023-04-20 00:00:00
end: 2024-04-25 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/
// © faytterro

//@version=5
strategy("Trend Catcher Strategy", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
len = input.int(10)
tp = input.float(2.5, step = 0.1)
sl = input.float(2.5, step = 0.1)
malen = input.int(5)
limit = input.int(50)
ma = ta.sma(close,malen)
sum = 0.0
for i = 0 to len-1
    sum := sum + high[i]-low[i]
frs = 100*(ta.highest(high,len)-ta.lowest(low,len))/sum
//hline(50)
//plot(frs, color = color.white)
l = ta.crossover(frs,limit) and ma>ma[1]
s = ta.crossover(frs,limit) and ma<ma[1]
cl = ma<ma[1]
cs = ma>ma[1]
qty_balance=input.int(50, maxval = 100)
if (l)
    strategy.entry("My Long Entry Id", strategy.long)
    strategy.exit("exit long", "My Long Entry Id", qty_percent = qty_balance, limit = close*(100+tp)/100, stop = close*(100-sl)/100)

if (s)
    strategy.entry("My Short Entry Id", strategy.short)
    strategy.exit("exit short", "My Short Entry Id", qty_percent = qty_balance, limit = close*(100-tp)/100, stop = close*(100+sl)/100)

if (cl)
    strategy.close("My Long Entry Id")
if (cs)
    strategy.close("My Short Entry Id")

l:= l and strategy.opentrades<1
s:= s and strategy.opentrades<1
transp = strategy.opentrades>0? 0 : 100
pma=plot(ma, color = ma<ma[1]? color.rgb(255, 82, 82, transp) : color.rgb(76, 175, 79, transp))
price = open/2+close/2
pprice = plot(price, display = display.none)
fill(pma,pprice, color = ma<ma[1]? color.rgb(255, 82, 82, transp+90) : color.rgb(76, 175, 79, transp+90))

spm=plot(ta.valuewhen(s,close,0), color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.white : color.rgb(1,1,1,100), offset=1)
lpm=plot(ta.valuewhen(l,close,0), color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.white : color.rgb(1,1,1,100), offset=1)

ltp=plot(ta.valuewhen(l,close,0)*(100+ta.valuewhen(l,tp,0))/100,  color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.green : color.rgb(1,1,1,100), offset=1)
lsl=plot(ta.valuewhen(l,close,0)*(100-ta.valuewhen(l,sl,0))/100,  color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.red : color.rgb(1,1,1,100), offset=1)

stp=plot(ta.valuewhen(s,close,0)*(100-ta.valuewhen(s,tp,0))/100, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.green : color.rgb(1,1,1,100), offset=1)
ssl=plot(ta.valuewhen(s,close,0)*(100+ta.valuewhen(s,sl,0))/100, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.red : color.rgb(1,1,1,100), offset=1)
fill(stp,spm, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.rgb(76, 175, 79, 90) : color.rgb(1,1,1,100))
fill(ssl,spm, color = (strategy.opentrades>0 and ma<ma[1] and ma[1]<ma[2])? color.rgb(255, 82, 82, 90) : color.rgb(1,1,1,100))
fill(ltp,lpm, color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.rgb(76, 175, 79, 90) : color.rgb(1,1,1,100))
fill(lsl,lpm, color = (strategy.opentrades>0 and ma>ma[1] and ma[1]>ma[2])? color.rgb(255, 82, 82, 90) : color.rgb(1,1,1,100))

関連性

もっと