双底逆転 平均逆転 DCAグリッド戦略

作者: リン・ハーンチャオチャン,日付: 2024-02-20 11:09:33
タグ:

img

概要

ダブルボトムリバーサル・メイン・リバーサルDCAグリッド戦略は,主に平均リバーサル価格とDCA戦略を適用し,段階的なポジション構築を実施する.ダブルボトムリバーサル・パターンをベースにリバーサル・チャンスを決定する.リバーサル・パターンが起動すると,段階的なグリッドポジションを確立するために,DCAと組み合わせた異なる価格で複数のリミットオーダーを使用する.

戦略の論理

ストラテジーはまず,キャンドルストックチャート上の底に等しい2つの連続閉値があるかどうかをチェックし,これは"ダブルボトム"と呼ばれる.ダブルボトムが検出された場合,価格逆転の機会がある可能性があると考えます.この時点で,ストラテジーは底値の周りに複数の制限オーダーを設定します.これらのオーダーの価格はATRと波動性に基づいて計算され,グリッドゾーンを形成します.これはDCA効果を達成し,トレーダーは逆転後に異なる価格で徐々にポジションを構築することができます.

ATR指標は,最近14のキャンドルストイックにおける価格変動を計算する.このグラッドには4つの価格レベル - 底値 + 変動,底値 + 0.75 * 変動等が含まれています.ダブルボタン条件が起動すると,この式に従って4つの同じサイズの制限オーダーが表示されます.未完了オーダーは数個のキャンドルストイック後にキャンセルされます.

さらに,ストップ・ロスト価格とテイク・プロフィート価格も設定します.ストップ・ロスト価格はダブルボトムマイナス1つのティックサイズの下位価格に設定され,テイク・プロフィート価格はエントリー価格プラスATRの5倍に設定されます.この2つの価格はポジションサイズが0を超える場合にリアルタイムで更新されます.

優位性

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

  1. 逆転を判断するためにダブルボトムを使用すると,正確性が向上し,誤ったブレーキを避ける.
  2. DCAグリッドは,トレーダーが異なる価格で段階的にポジションを構築し,コストベースを下げることを可能にします.
  3. ダイナミックATRと波動性パラメータは,市場の変化に基づいてグリッドと利益範囲を調整します.
  4. 自動ストップ損失は,取引損失額を効果的に制御します.

リスク分析

主なリスク:

  1. 価格が逆転せずにサポートを突破し,ストップ損失と損失を誘発します. 保護のためにストップ損失距離を拡大します.
  2. DCAグリッドの設定が不適切である場合,充填率が低下する可能性があります.充填率を確保するために異なるパラメータをテストします.
  3. 波動的な市場では,頻繁に利得を上げます.より広い利得倍数を許可することを検討してください.

改善 の 分野

改善できる部分:

  1. トレンド判断を加え,損失を避けるために主要トレンドに沿った反転のみを取引します.
  2. 資本利用効率を最適化するために,最初のエントリに大きいサイズとグリッドエントリに小さいサイズを考慮してください.
  3. 異なるパラメータの組み合わせをテストして 最適なパラメータを見つけるか ダイナミックな調整ロジックを設計する
  4. 自動パラメータ最適化を実現するために 機械学習を高度なプラットフォームに統合します

概要

ダブルボトムリバーサルミアンスリバーサルDCAグリッド戦略は,価格パターン,指標技術,グリッド取引を統合する.正確なタイミング,制御可能なコストベース,引き下げ保護があります.まだ最適化余地があり,調査に値します.適切に構成されれば,範囲限定市場で良い結果を達成することができます.


/*backtest
start: 2024-02-12 00:00:00
end: 2024-02-19 00:00:00
period: 3m
basePeriod: 1m
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/
// © cherepanovvsb

//@version=5
strategy("Reversal (only long)", overlay=true, margin_long=1, margin_short=1,initial_capital=1000,commission_type = strategy.commission.percent,commission_value =0.1,currency='USD', process_orders_on_close=true)
plotshape(low == low[1], style=shape.triangleup, location=location.belowbar, color=color.blue, title="1 Setup")
plotshape(low == low[1] and low[1]==low[2], style=shape.triangleup, location=location.belowbar, color=color.red, title="Triple Setup")

ATRlenght   = input.int(title="ATR length for taking profit", defval=14, group="Strategy Settings")
rewardMultiplier= input.int(title="ATR multiplier", defval=5, group="Strategy Settings")
Volatility_length=input.int(title='Volatility length',defval=5,group="Strategy Settings")
Volatility_multiplier=input.float(title='Volatility multiplier',defval=0.5,step=0.1, group="Strategy Settings")
Candles_to_wait=input.int(title='How many candles to wait after placing orders grid?',defval=4,group="Strategy Settings")

// Get ATR
atr1 = ta.atr(ATRlenght)

//Get volatility values (not ATR) 
float result = 0
for i = 0 to Volatility_length
	result+=high[i]-low[i]
volatility=result*Volatility_multiplier/Volatility_length

//Validate entrance points
validlow =  low [2]== low[1] and not na(atr1) 
validlong = validlow and strategy.position_size == 0  and low[1]<low


// Calculate SL/TP
longStopPrice = low[1]-syminfo.mintick
longStopDistance = close - longStopPrice
longTargetPrice = close + (longStopDistance * rewardMultiplier)
strategy.initial_capital = 50000
//Assign all variables
var tradeStopPrice = 0.0
var tradeTargetPrice = 0.0
var point1=0.0
var point2=0.0
var point3=0.0
var point4=0.0
var contracts = int(strategy.initial_capital/close)/4
if validlong 
    tradeStopPrice := longStopPrice
    tradeTargetPrice := longTargetPrice
    point1:=low[1]+volatility
    point2:=low[1]+volatility*0.75
    point3:=low[1]+volatility*0.5
    point4:=low[1]+volatility*0.25

strategy.entry ("Long1", strategy.long,limit=point1,qty=contracts, when=validlong)
strategy.entry ("Long2", strategy.long,limit=point2,qty=contracts, when=validlong)
strategy.entry ("Long3", strategy.long,limit=point3,qty=contracts, when=validlong)
strategy.entry ("Long4", strategy.long,limit=point4,qty=contracts, when=validlong)

stopcondition = ta.barssince(validlong) == Candles_to_wait

strategy.cancel("Long1",when=stopcondition)
strategy.cancel("Long2",when=stopcondition)
strategy.cancel("Long3",when=stopcondition)
strategy.cancel("Long4",when=stopcondition)
    
strategy.exit(id="Long Exit", limit=tradeTargetPrice, stop=tradeStopPrice, when=strategy.position_size > 0)

plot(strategy.position_size != 0 or validlong ? tradeStopPrice : na, title="Trade Stop Price", color=color.red, style=plot.style_linebr, linewidth=3)
plot(strategy.position_size != 0 or validlong ? tradeTargetPrice : na, title="Trade Target Price", color=color.green, style=plot.style_linebr, linewidth=3)

plot(strategy.position_size != 0? point1 : na, title="Long1", color=color.green, style=plot.style_linebr, transp=0)
plot(strategy.position_size != 0? point2 : na, title="Long2", color=color.green, style=plot.style_linebr, transp=0)
plot(strategy.position_size != 0? point3 : na, title="Long3", color=color.green, style=plot.style_linebr, transp=0)
plot(strategy.position_size != 0? point4 : na, title="Long4", color=color.green, style=plot.style_linebr, transp=0)



もっと