クローン陰陽定量取引戦略


作成日: 2023-09-27 17:11:30 最終変更日: 2023-09-27 17:11:30
コピー: 0 クリック数: 733
1
フォロー
1617
フォロワー

概要

クローン陰陽数量取引戦略は,日内量価関係に基づくショートライン取引戦略である.この戦略は,日内株取引の陰陽方向情報を利用し,量能確認シグナルと組み合わせて,低リスクのショートライン操作を実現する.

戦略原則

この戦略は,ATR指標と組み合わせた,株の毎日の開場価格,閉場価格,最高価格,最低価格を計算して,Renkoブロックを生成する.陰陽ブロックが反転したときに取引信号を生成する.

具体的には,戦略はまず,Renkoのブロックの開値o2と閉値c2を計算する.o2c2なら陰線を表示する.陽線が陰線に転じるときに売り信号を生じ,陰線が陽線に転じるときに買い信号を生じする.

偽突破をフィルターするために,戦略はまた,前回の陽線と陰線の周期数を統計する.陽線周期数が多いと,信号はより信頼性が高い.さらに,戦略は,買取と売却の後に止損ストップの論理を設定する.

戦略的優位性

  1. レンコのブロックは市場騒音をフィルターし,取引信号を明確にします.

  2. 結合量エネルギー関係により,偽突破のリスクを回避する.

  3. DAPMモデルはシンプルで有効で,日中のショートライン操作に適しています.

  4. ATRパラメータをカスタマイズして取引頻度を調整します.

  5. カスタマイズ可能なストップ・ストップ・ストップ戦略の最適化リスク管理.

リスク分析

  1. 偽の突破の危険は依然として存在し,その傾向は不明である.

  2. レンコのパラメータを正しく設定しない場合,トレンドを逃したり,取引頻度を増加させることもあります.

  3. ストップポイントが小さすぎると,軽微な損失が反転ストップに繋がる可能性があります.

最適化の方向

  1. 他の技術指標と組み合わせたフィルタリング信号を考慮することができる.

  2. 移動停止または追跡停止機能を追加することも検討できます.

  3. 異なる品種のパラメータに対して最適化テストを行う.

  4. 異なる時間周期の組み合わせを考慮して,複数の時間枠での取引を行う.

要約する

この戦略は,全体的に非常に実用的なショートライン取引戦略である.それは,量と価格の関係を利用して効率的なフィルタリングを行い,ショートライン価格の上下をキーポイントに捉えることができる.また,合理的なパラメータ設定,適切なリスク管理とストップダスの戦略に注意する必要がある.これは,戦略の安定性と収益性を大幅に向上させる.継続的にテストを最適化することによって,この戦略は,日中のショートライントレーダーにとって不可欠な強力なツールになることができます.

ストラテジーソースコード
/*backtest
start: 2022-09-26 00:00:00
end: 2023-09-26 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/
// © dman103
strategy(title="Renko Strategy V2", shorttitle="Renko Strategy V2", overlay=true,precision=3, commission_value=0.025, default_qty_type=strategy.cash, default_qty_value=10000, initial_capital=10000)
// Version 2.0 of my previous renko strategy using Renko calculations, this time without Tilson T3 and without using security with Renko to remove repaints!
// Seems to work nicely on cryptocurrencies on higher time frames.

//== Description ==
// Strategy gets Renko values and uses renko close and open to trigger signals.
// Base on these results the strategy triggers a long and short orders, where green is uptrending and red is downtrending.
// This Renko version is based on ATR, you can Set ATR (in settings) to adjust it.

// == Notes ==
// Supports alerts.
// Supports backtesting time ranges.
// Shorts are disabled by default (can be enabled in settings).
// Link to previous Renko strategy V1: https://www.tradingview.com/script/KeWBWLGT-Renko-Strategy-T3-V1/
//
// Stay tuned for version V3 in the future as i have an in progress prototype, Follow to get updated: https://www.tradingview.com/u/dman103/#published-scripts

// === INPUT BACKTEST RANGE ===
useDate = input(true,     title='---------------- Trade Range ----------------', type=input.bool)
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromYear  = input(defval = 2017, title = "From Year", minval = 2000)
ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToYear    = input(defval = 2099, title = "To Year", minval = 2010)
start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)  // backtest start window
finish    = timestamp(ToYear, ToMonth, ToDay, 23, 59)        // backtest finish window
window()  => time >= start and time <= finish ? true : false // create 

settings = input(true,     title='---------------- Settings ----------------', type=input.bool)

allow_short = input(false,title="Allow Short")
atr_len = input(10,"ATR Length")

atr = atr(atr_len)
// Thanks to renko snippet calculations from @RafaelZioni  https://www.tradingview.com/script/2vKhpfVH-Renko-XZ/
Renko1() =>
    p1 = 0.0
    p1 := close > nz(p1[1]) + atr ? nz(p1[1]) + atr : close < nz(p1[1]) - atr ? nz(p1[1]) - atr : nz(p1[1])
    p1
Renko2() =>
    p2 = 0.0
    Br_1 = Renko1()
    p2 := Renko1() != Renko1()[1] ? Br_1[1] : nz(p2[1])
    p2

Renko3() =>
    p3 = 0.0
    p3 := open > nz(p3[1]) + atr ? nz(p3[1]) + atr : open < nz(p3[1]) - atr ? nz(p3[1]) - atr : nz(p3[1])
    p3

Renko4() =>
    open_v = 0.0
    Br_2 = Renko3()
    open_v := Renko3() != Renko3()[1] ? Br_2[1] : nz(open_v[1])
    open_v

o2 = Renko4()
c2 = Renko1()
l2 =low
h2 = high

//=== Plotting ===

crossPlot= 0.0
if (o2 < c2)
    crossPlot :=o2
else 
    crossPlot := o2

// Used to make sure that even if o2 and c2 are equal, the result (short or long) will be based on previous trend.
bars_since_up=barssince(o2 < c2)
bars_since_down=barssince(o2 > c2)
go_long= (bars_since_up<bars_since_down) and  o2<c2
go_short = (bars_since_up>bars_since_down) and o2>c2
plotColor = go_long and  o2<c2 ? color.green : go_short and o2>c2?  color.red : color.white 
plot(crossPlot, color = plotColor, style = plot.style_circles, linewidth = 2,join=true)
changeCond = plotColor != plotColor[1]

//=== Buy/Sell ===
closeStatus =  strategy.openprofit > 0 ? "win" : "lose"
long_entry = plotColor == color.green and window()  and changeCond
long_exit_entry = plotColor == color.red //or (allow_alternative_sl and close < low_result  )
short_entry = plotColor == color.red  and window() and changeCond
short_exit_entry = plotColor == color.green   // or (allow_alternative_sl and close > high_result )

strategy.entry("long", true, when = long_entry)
strategy.close("long",when=long_exit_entry,comment=closeStatus)

if (allow_short)
    strategy.entry("short",false, when = short_entry)
strategy.close("short",when=short_exit_entry,comment=closeStatus)
//=== Alerts ===
alertcondition(go_long and changeCond , title='Renko Buy Signal', message='Renko Revered to Buy Signal')
alertcondition(go_short and changeCond , title='Renko Sell Signal', message='Renko Revered to Sell Signal')