スーパー・イチ戦略

作者: リン・ハーンチャオチャン, 日付: 2023年11月6日 16:32:11
タグ:

img

概要

スーパー・イチ戦略は,スーパー・イチ指標に基づいて取引決定を行うトレンド・トレーディング戦略である.現在のトレンド方向を決定するために,テンカン線,キジュン線,スーパー・イチ指標のイチモク・クラウドとの関係を利用し,価格の引き下げを入力する.

スーパー・イチ戦略は,主に中長期トレンド取引に適しており,主要なトレンドから利益を得ることを目的としています.また,強力なトレンド識別機能を持っています.

戦略の論理

スーパー・イチ戦略は,主に取引の方向性を決定するために以下の要素を判断します.

  1. テンカンとキジュンの関係: テンカンが上を向いていると上昇し,下を向いていると低下します

  2. 雲の色: 雲が緑になったら上昇し,赤になったら下落

  3. 価格リバック: 入る前にラインから引き下がる必要があります

取引シグナルとは

長い信号:

  • キジュンの上のテンカン
  • テンカンとキジュンの上での価格
  • テンカンとキジュンは 雲の上
  • 価格がテンカンとキジュンの下まで下がる

短信号:

  • キジュンの下にあるテンカン
  • テンカンとキジュンの価格を下回る
  • テンカンとキジュンは 雲の下にある
  • 価格がテンカンとキジュンの上から下がる

ロング/ショートシグナルが起動すると,現在のポジションに基づいてポジションが開きます.

利点分析

スーパー・イチ戦略には以下の利点があります

  1. イチモク組み合わせを使って 傾向を正確に判断します

  2. テンカン/キジュンは短期傾向を示し,クラウドは長期傾向を示しています

  3. 引き戻し要求は,偽の脱出を回避する

  4. リスク管理は,損失を制限するために,ストップロスの最近のスイング高/低を使用します.

  5. 安定した利益に対する合理的なリスク/報酬比

  6. 中期から長期間のトレンド取引の異なる時間枠に適用される

  7. 明確な論理と大きな最適化空間

  8. 様々な市場条件で良い業績を上げている

リスク分析

スーパー・イチ戦略には次のリスクもあります

  1. 利潤に影響を与えるため,Stop Lossは変動市場において頻繁に行われる可能性があります.

  2. 傾向が急激に変化すると,ポジションを迅速に逆転させない場合,損失を引き起こす可能性があります.

  3. デフォルトリスク/リターン比はすべてのインstrumentに適合しない可能性があり,細かな調整が必要

  4. クラウドブレイクがフォローアウトを制限している場合,上向きの可能性が限られている.

  5. インディケーターパラメータは,アクティブ・インストラクションの広範なテストと最適化が必要です

リスクは以下によって軽減できます.

  1. 異なるタイムフレームとインストラクションのためのパラメータの最適化

  2. フレームワーク市場における誤ったブレイクエントリーを避けるためにフィルターを追加する

  3. 停止を減らすために動的ストップ損失を使用する

  4. リスク/報酬比の異なる設定をテストする

  5. 信号の強さを確認するチャートパターンなど

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

スーパー・イチ戦略は以下の側面で最適化できます

  1. 取引対象の商品に最適化するために Tenkan/Kijun パラメータを最適化

  2. より良い長期動向評価のために Cloud パラメータを最適化

  3. ストップ・ロスのアルゴリズムを改良する,例えばATRベースのストップやトライリングストップ

  4. 誤ったエントリを減らすために他の指標を使用してフィルターを追加します

  5. 異なる楽器と時間枠のリスク/報酬比を精細調整する

  6. マルティンゲール型ポジションサイズを使用して,変動する市場波動に対応する.

  7. パラメータ最適化と安定性のために機械学習を利用する

  8. 昼間のセッションと夜間のセッションの別々のパラメータを設定する

概要

スーパー・イチ戦略は,全体的に中長期トレンド取引に適しています.イチモクを使用してトレンド方向を決定するのに優れていますが,引き戻し要件は誤ったエントリを避けます.パラメータ最適化により,より多くの楽器やタイムフレームで安定した利益を達成できます.理解しやすいが,高度に最適化可能で,スーパー・イチ戦略は研究と学習のための優れた基本トレンドフォロー戦略として機能します.


/*backtest
start: 2022-11-05 00:00:00
end: 2023-11-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// Strategy based on the the SuperIchi indicator.
//
// Strategy was designed for the purpose of back testing. 
// See strategy documentation for info on trade entry logic.
// 
// Credits:
//  - SuperIchi [LUX]: LuxAlgo (https://www.tradingview.com/script/vDGd9X9y-SuperIchi-LUX/)

//@version=5
strategy("SuperIchi Strategy", overlay=true, initial_capital=1000, currency=currency.NONE, max_labels_count=500, default_qty_type=strategy.cash, commission_type=strategy.commission.percent, commission_value=0.01)

// =============================================================================
// STRATEGY INPUT SETTINGS
// =============================================================================

// ---------------
// Risk Management
// ---------------
swingLength = input.int(15, "Swing High/Low Lookback Length", group='Strategy: Risk Management', tooltip='Stop Loss is calculated by the swing high or low over the previous X candles')
accountRiskPercent = input.float(2, "Account percent loss per trade", step=0.1, group='Strategy: Risk Management', tooltip='Each trade will risk X% of the account balance')
profitFactor = input.float(2, "Profit Factor (R:R Ratio)", step = 0.1, group='Strategy: Risk Management')
useAtrOverride = input.bool(true, "Use Swing High/Low ATR Override", group='Strategy: Risk Management', tooltip='In some cases price may not have a large enough (if any) swing withing previous X candles. Turn this on to use an ATR value when swing high/low is lower than the given ATR value')
atrMultiplier = input.int(1, "Swing High/Low ATR Override Multiplier", group='Strategy: Risk Management')
atrLength = input.int(14, "Swing High/Low ATR Override Length", group='Strategy: Risk Management')

// -----------------
// Strategy Settings
// -----------------
pullbackLength = input.int(5, "Pullback Lookback Length", group='Strategy: Settings', tooltip='Number of candles to consider for a pullback into the moving averages (prerequisite for trade entry)')

// ----------
// Date Range
// ----------
start_year = input.int(title='Start Date', defval=2022, minval=2010, maxval=3000, group='Strategy: Date Range', inline='1')
start_month = input.int(title='', defval=1, group='Strategy: Date Range', inline='1', options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
start_date = input.int(title='', defval=1, group='Strategy: Date Range', inline='1', options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])
end_year = input.int(title='End Date', defval=2023, minval=1800, maxval=3000, group='Strategy: Date Range', inline='2')
end_month = input.int(title='', defval=1, group='Strategy: Date Range', inline='2', options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
end_date = input.int(title='', defval=1, group='Strategy: Date Range', inline='2', options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])
in_date_range = time >= timestamp(syminfo.timezone, start_year, start_month, start_date, 0, 0) and time < timestamp(syminfo.timezone, end_year, end_month, end_date, 0, 0)

// =============================================================================
// INDICATORS
// =============================================================================

// ---------------
// SuperIchi [LUX]
// ---------------
tenkan_len  = input(9,'Tenkan          ',inline='SuperIchi', group='Indicator: SuperIchi Settings')
tenkan_mult = input(2.,'',inline='SuperIchi', group='Indicator: SuperIchi Settings')

kijun_len   = input(26,'Kijun             ',inline='SuperIchi', group='Indicator: SuperIchi Settings')
kijun_mult  = input(4.,'',inline='SuperIchi', group='Indicator: SuperIchi Settings')

spanB_len   = input(52,'Senkou Span B ',inline='SuperIchi', group='Indicator: SuperIchi Settings')
spanB_mult  = input(6.,'',inline='SuperIchi', group='Indicator: SuperIchi Settings')

offset      = input(26,'Displacement', inline='SuperIchi', group='Indicator: SuperIchi Settings')
//------------------------------------------------------------------------------
avg(src,length,mult)=>
    atr = ta.atr(length)*mult
    up = hl2 + atr
    dn = hl2 - atr
    upper = 0.,lower = 0.
    upper := src[1] < upper[1] ? math.min(up,upper[1]) : up
    lower := src[1] > lower[1] ? math.max(dn,lower[1]) : dn
    
    os = 0,max = 0.,min = 0.
    os := src > upper ? 1 : src < lower ? 0 : os[1]
    spt = os == 1 ? lower : upper
    max := ta.cross(src,spt) ? math.max(src,max[1]) : os == 1 ? math.max(src,max[1]) : spt
    min := ta.cross(src,spt) ? math.min(src,min[1]) : os == 0 ? math.min(src,min[1]) : spt
    math.avg(max,min)
//------------------------------------------------------------------------------
tenkan = avg(close,tenkan_len,tenkan_mult)
kijun = avg(close,kijun_len,kijun_mult)

senkouA = math.avg(kijun,tenkan)
senkouB = avg(close,spanB_len,spanB_mult)
//------------------------------------------------------------------------------
tenkan_css = #2157f3 //blue
kijun_css = #ff5d00 //red

cloud_a = color.new(color.teal,80)
cloud_b = color.new(color.red,80)

chikou_css = #7b1fa2

plot(tenkan,'Tenkan-Sen',tenkan_css)
plot(kijun,'Kijun-Sen',kijun_css)

plot(ta.crossover(tenkan,kijun) ? kijun : na,'Crossover',#2157f3,3,plot.style_circles)
plot(ta.crossunder(tenkan,kijun) ? kijun : na,'Crossunder',#ff5d00,3,plot.style_circles)

A = plot(senkouA,'Senkou Span A',na,offset=offset-1)
B = plot(senkouB,'Senkou Span B',na,offset=offset-1)
fill(A,B,senkouA > senkouB ? cloud_a : cloud_b)

plot(close,'Chikou',chikou_css,offset=-offset+1,display=display.none)


// =============================================================================
// STRATEGY LOGIC
// =============================================================================
plotchar(kijun, "kijun", "", location = location.top)
plotchar(senkouA[offset-1], "senkouA", "", location = location.top)


plotchar(tenkan > kijun, "line above", "", location = location.top)
plotchar(close > tenkan, "price above", "", location = location.top)
plotchar(kijun > senkouA[offset-1], "above cloud", "", location = location.top)
// blue line above red line + price above both lines + both lines above cloud
longSen = tenkan > kijun and close > tenkan and kijun > senkouA[offset-1]
// red line below blue line + price below both lines + both lines below cloud
shortSen = tenkan < kijun and close < tenkan and kijun < senkouA[offset-1]

plotchar(longSen, "longSen", "", location = location.top)
plotchar(shortSen, "shortSen", "", location = location.top)

// Cloud is green
longSenkou = senkouA[offset-1] > senkouB[offset-1]
// Cloud is red
shortSenkou = senkouA[offset-1] < senkouB[offset-1]

// price must have pulled back below sen lines before entry
barsSinceLongPullback = ta.barssince(close < kijun and close < tenkan)
longPullback = barsSinceLongPullback <= pullbackLength
// price must have pulled back above sen lines before entry
barsSinceShortPullback = ta.barssince(close > kijun and close > tenkan)
shortPullback = barsSinceShortPullback <= pullbackLength

// plotchar(lowestClose, "lowestClose", "", location = location.top)
// plotchar(highestClose, "highestClose", "", location = location.top)

inLong = strategy.position_size > 0
inShort = strategy.position_size < 0

longCondition = longSen and longSenkou and longPullback and in_date_range
shortCondition = shortSen and shortSenkou and shortPullback and in_date_range

swingLow = ta.lowest(source=low, length=swingLength)
swingHigh = ta.highest(source=high, length=swingLength)

atr = useAtrOverride ? ta.atr(atrLength) * atrMultiplier : 0
longSl = math.min(close - atr, swingLow)
shortSl = math.max(close + atr, swingHigh)

longStopPercent = math.abs((1 - (longSl / close)) * 100)
shortStopPercent = math.abs((1 - (shortSl / close)) * 100)

longTpPercent = longStopPercent * profitFactor
shortTpPercent = shortStopPercent * profitFactor
longTp = close + (close * (longTpPercent / 100))
shortTp = close - (close * (shortTpPercent / 100))

// Position sizing (default risk 2% per trade)
riskAmt = strategy.equity * accountRiskPercent / 100
longQty = math.abs(riskAmt / longStopPercent * 100) / close
shortQty = math.abs(riskAmt / shortStopPercent * 100) / close

if (longCondition and not inLong)
    strategy.entry("Long", strategy.long, qty=longQty)
    strategy.exit("Long  SL/TP", from_entry="Long", stop=longSl, limit=longTp, alert_message='Long SL Hit')
    buyLabel = label.new(x=bar_index, y=high[1], color=color.green, style=label.style_label_up)
    label.set_y(id=buyLabel, y=low)
    label.set_tooltip(id=buyLabel, tooltip="Risk Amt: " + str.tostring(riskAmt) + "\nQty: " + str.tostring(longQty) + "\nSwing low: " + str.tostring(swingLow) + "\nStop Percent: " + str.tostring(longStopPercent) + "\nTP Percent: " + str.tostring(longTpPercent))

if (shortCondition and not inShort)
    strategy.entry("Short", strategy.short, qty=shortQty)
    strategy.exit("Short  SL/TP", from_entry="Short", stop=shortSl, limit=shortTp, alert_message='Short SL Hit')
    sellLabel = label.new(x=bar_index, y=high[1], color=color.red, style=label.style_label_up)
    label.set_y(id=sellLabel, y=low)
    label.set_tooltip(id=sellLabel, tooltip="Risk Amt: " + str.tostring(riskAmt) + "\nQty: " + str.tostring(shortQty) + "\nSwing high: " + str.tostring(swingHigh) + "\nStop Percent: " + str.tostring(shortStopPercent) + "\nTP Percent: " + str.tostring(shortTpPercent))


もっと