一面的なトレンドショックブレイク戦略

作者: リン・ハーンチャオチャン開催日:2024年1月18日14時59分
タグ:

img

概要

シングルサイドトレンドショックブレイクアウト戦略は,価格チャネルとトレンド判断を活用したブレイクアウト戦略である.トレンド方向を特定し,レンジ期間中にブレイクアウトを入力し,利益目標に達すると退出することを目的としている.

戦略の論理

この戦略は,最近のN期間の最高価格と最低価格を使用して価格チャネルの上下帯を計算する.その後,価格ミッドラインを計算する.チャネル帯を得るために価格とミッドライン間の距離を平均する.

トレンド検出のために,この戦略は,最近のキャンドルがすべてチャネル上 (上昇) または下 (下落) に閉じるかどうかをチェックします.トレンドの確認後,帯の近くでの価格ショックを待ち,逆方向に進みます.

ボディブレイクは,ボディ長が平均ボディ長の倍数を超えるとエントリー信号を補完する. 戦略はエントリー後に利益目標を設定し,価格がそれを達成すると利益を取ります.

利点分析

この戦略の主な利点は以下の通りです.

  1. 価格チャネルフィルターは,偽のブレイクリスクを減らす
  2. リバース・エントリはトレンドショックから利益を得ています
  3. 身体の脱出が 進出の精度を向上させる
  4. 利益目標で 積極的に利益を得られる

リスク分析

リスクもあります:

  1. 誤ったチャネルパラメータは,チャネルを過剰に広げ/狭める可能性があります.
  2. 強い傾向に逆転すると 大きな損失を伴う
  3. 身体の脱出は,上部に偽信号を生成する傾向があります.
  4. 利潤目標が決まっても 利益は残る

これらの問題はパラメータ調節,強いトレンド時の逆転を回避,出口論理を最適化などによって解決できます.

増進 の 機会

戦略を改善する方法:

  1. 傾向を確認するために傾向指標を追加します
  2. 偽信号を減らすためにボディブレークアウトパラメータを最適化します
  3. 入力時の追加フィルター
  4. 利益目標の動的調整

結論

シングルサイドトレンドショックブレイクアウト戦略は,トレンドに対するブレイクアウトから利益を得る.トレンドの識別と積極的な利益を得る利点があるが,いくつかのリスクも伴う.これらのリスクは,多因子確認,パラメータ最適化などによって軽減することができる.この戦略は短期取引に適しており,トレンドに従う戦略を補完することができる.


/*backtest
start: 2024-01-10 00:00:00
end: 2024-01-17 00:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/


//@version=2
strategy("Noro's Bands Scalper Strategy v1.5", shorttitle = "Scalper str 1.5", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value=100.0, pyramiding=0)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
takepercent = input(0, defval = 0, minval = 0, maxval = 1000, title = "take, %")
needbe = input(true, defval = true, title = "Bands Entry")
needct = input(false, defval = false, title = "Counter-trend entry")
bodylen = input(10, defval = 10, minval = 0, maxval = 50, title = "Body length")
trb = input(1, defval = 1, minval = 1, maxval = 5, title = "Trend bars")
len = input(20, defval = 20, minval = 2, maxval = 200, title = "Period")
needbb = input(true, defval = true, title = "Show Bands")
needbg = input(true, defval = true, title = "Show Background")
src = close

//PriceChannel 1
lasthigh = highest(src, len)
lastlow = lowest(src, len)
center = (lasthigh + lastlow) / 2

//Distance
dist = abs(src - center)
distsma = sma(dist, len)
hd = center + distsma
ld = center - distsma
hd2 = center + distsma * 2
ld2 = center - distsma * 2

//Trend
chd = close > hd
cld = close < ld
uptrend = trb == 1 and chd ? 1 : trb == 2 and chd and chd[1] ? 1 : trb == 3 and chd and chd[1] and chd[2] ? 1 : trb == 4 and chd and chd[1] and chd[2] and chd[3] ? 1 : trb == 5 and chd and chd[1] and chd[2] and chd[3] and chd[4] ? 1 : 0
dntrend = trb == 1 and cld ? 1 : trb == 2 and cld and cld[1] ? 1 : trb == 3 and cld and cld[1] and cld[2] ? 1 : trb == 4 and cld and cld[1] and cld[2] and cld[3] ? 1 : trb == 5 and cld and cld[1] and cld[2] and cld[3] and cld[4] ? 1 : 0
trend = dntrend == 1 and high < center ? -1 : uptrend == 1 and low > center ? 1 : trend[1]

//trend = close < ld and high < center ? -1 : close > hd and low > center ? 1 : trend[1]

//Lines
colo = needbb == false ? na : black
plot(hd2, color = colo, linewidth = 1, transp = 0, title = "High band 2")
plot(hd, color = colo, linewidth = 1, transp = 0, title = "High band 1")
plot(center, color = colo, linewidth = 1, transp = 0, title = "center")
plot(ld, color = colo, linewidth = 1, transp = 0, title = "Low band 1")
plot(ld2, color = colo, linewidth = 1, transp = 0, title = "Low band 2")

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 80)

//Body
body = abs(close - open)
smabody = ema(body, 30) / 10 * bodylen

//Signals
bar = close > open ? 1 : close < open ? -1 : 0
up7 = trend == 1 and ((bar == -1 and bar[1] == -1) or (body > smabody and bar == -1)) ? 1 : 0
dn7 = trend == 1 and ((bar == 1 and bar[1] == 1) or (close > hd and needbe == true)) and close > strategy.position_avg_price * (100 + takepercent) / 100 ? 1 : 0
up8 = trend == -1 and ((bar == -1 and bar[1] == -1) or (close < ld2 and needbe == true)) and close < strategy.position_avg_price * (100 - takepercent) / 100 ? 1 : 0
dn8 = trend == -1 and ((bar == 1 and bar[1] == 1) or (body > smabody and bar == 1)) ? 1 : 0

if up7 == 1 or up8 == 1 
    strategy.entry("Long", strategy.long, needlong == false ? 0 : trend == -1 and needct == false ? 0 : na)

if dn7 == 1 or dn8 == 1
    strategy.entry("Short", strategy.short, needshort == false ? 0 : trend == 1 and needct == false ? 0 : na)

もっと