一目均衡表ロング・ショート戦略


作成日: 2023-12-28 12:12:51 最終変更日: 2023-12-28 12:12:51
コピー: 0 クリック数: 664
1
フォロー
1623
フォロワー

一目均衡表ロング・ショート戦略

概要

この戦略は,一目平衡取引システムの基礎で改良された.主な考えは,均線理論指標一目平衡と資金管理規則を組み合わせて,ショートラインと多頭取引機会の識別である.

戦略原則

戦略は,クラシックの一目均衡システムを基本的参照として用いる.主要構成要素は,以下のとおりである.

ターニングライン: 中間線。 中間トレンドを反映する。

基準線:長期線. 長期のトレンドを反映する.

先行線:未来を予測する線. 将来の傾向を反映する線.

落後線:過去線。 過去のトレンドを反映する。

この戦略は,以下のように改善されています.

  1. タイムパラメータの選択は奇数平方理論に従っており,市場法則とより合致している.

  2. 資金管理のルールを追加し,取引リスクをコントロールする.

  3. 戦略テストの範囲を調整して,戦略テストを全般的に行うことができます.

具体的には,多頭入場条件は,回転線上での基準線穿越,落後線が価格より高く,価格がクラウドグラフより高く,クラウドグラフが将来の牛市を予測するなどを含む.空頭入場条件は,回転線下での基準線穿越,落後線が価格より低いなどを必要とする.

資金管理規則は,多頭ストップを30%とストップを5%要求し,空頭ストップがターニングラインの3倍ATRを超えるとストップする.

優位分析

この戦略の利点は,平均線指標と資金管理を組み合わせることで,以下のように示されています.

  1. 一見均衡システム自体は,短期・中期・長期のトレンドを反映しており,エントリー/エグジットは合理的である.

  2. 奇数平方理論の最適化パラメータは,市場統計法則に合致する.

  3. 資金管理規則は,単一の損失を効果的に制御し,損失よりも利益が大きいことを保証します.

  4. 検知範囲は調整可能で,テストはより全面的にROUND。

全体として,この戦略は,トレンド,パラメータ選択,リスク制御などの多面的な要因を総合的に考慮し,短時間,多くの機会を効果的に識別し,取引リスクを制御し,強力な実用性を持っています.

リスク分析

この戦略の主なリスクは以下の通りです.

  1. 一目均衡システムは偽突破に騙されやすいため,不要な入場を招く。より多くの指標のフィルター信号と組み合わせることができる。

  2. 固定ストップ・ストップ・レギュラーは,簡単に套装され,ダイナミックストップ・ストップ・ストップを導入することができる.

  3. 戦略の効果を過大評価する可能性があるため,より長い時間,より多くの市場での反射が必要である.

  4. この戦略は,トレンドマーケットに適しており,収束市場では不良なパフォーマンスを発揮することがあります.トレンドを識別するために入場条件を最適化することができます.

最適化の方向

この戦略は,以下のような点で最適化できます.

  1. MACD,KDJなどの補助判断指標.

  2. 動的ストップストップ.例えば,平均線を突破してN倍ATRをストップし,サポート位ストップを下回る.

  3. 複数の品種で再テストを検証 戦略の安定性をより多くの市場とより長いデータで検証する

  4. トレンドを識別し,市場をまとめます. 入場メカニズムを最適化して,異なる状況に適応します.

要約する

この戦略は,トレンド,資金管理などの多面的な要因を総合的に考慮し,一目均衡指標を使用して短線多頭取引の機会を識別し,また,リスク管理ルールを使用して単価損失を制御する.原始の一目均衡システムと比較して大きく改善された.この戦略は,さらなる最適化によって,非常に実用的なショート・マルチ戦略になる見通しがある.

ストラテジーソースコード
/*backtest
start: 2023-11-27 00:00:00
end: 2023-12-27 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// Author Obarut
//@version=5
strategy("İchimoku Strategy With MM Short-Long",overlay=true,process_orders_on_close=true)

//Ichimoku Inputs
ts_period = input.int(8, minval=1, title="Tenkan-Sen Period")
ks_period = input.int(16, minval=1, title="Kijun-Sen Period")
ssb_period = input.int(24, minval=1, title="Senkou-Span B Period")
cs_offset = input.int(16, minval=1, title="Chikou-Span Offset")
ss_offset = input.int(8, minval=1, title="Senkou-Span Offset")
long_entry = input(true, title="Long Entry")
short_entry = input(true, title="Short Entry")

// Back Testing Period Inputs

fromday = input.int(defval=1,title="Start Date",minval=1,maxval=31) 
frommonth = input.int(defval=1,title="Start Month",minval=1,maxval=12)
fromyear = input.int(defval=1980,title="Start Year",minval=1800, maxval=2100)
today = input.int(defval=1,title="En Date",minval=1,maxval=31)
tomonth = input.int(defval=1,title="End Month",minval=1,maxval=12)
toyear =input.int(defval=2100,title="End Year",minval=1800,maxval=2200)
start=timestamp(fromyear,frommonth,fromday,00,00)
finish=timestamp(toyear,tomonth,today,00,00)
timewindow= time>=start and time<=finish

//Ichimoku Componenets Calculation Function
middle(len) => math.avg(ta.lowest(len), ta.highest(len))

// Ichimoku Components

tenkan = middle(ts_period)
kijun = middle(ks_period)
senkouA = math.avg(tenkan, kijun)
senkouB = middle(ssb_period)
//Senkou Span Lines slopes
slopetenkan=(tenkan-tenkan[2])/tenkan
slopekijun= (kijun-kijun[2])/kijun
//Avarage True Range 
atr = ta.atr(14)
//Senkou Span Lines
ss_above = math.max(senkouA[ss_offset-1], senkouB[ss_offset-1])
ss_below = math.min(senkouA[ss_offset-1], senkouB[ss_offset-1])

// Price Distance From Tenkan
distance = close - tenkan

// Price Distance from Kijun
distancek = close - kijun

// Entry/Exit Signals

tk_cross_kijun_bull = tenkan >= kijun//Tenkan Sen is greater than or equal to  Kijun Sen
tk_cross_kijun_bear = tenkan <= kijun//Tenkan Sen is smaller than or equal to Kijun Sen
cs_cross_bull = close > high[cs_offset-1]//Chikou is above the price
cs_cross_bear = close < close[cs_offset-1]//Chikou is below the price
price_above_kumo = close > ss_above//Price is above the Kumo cloud
pbsenkA = close < ss_above // Price is below the Senkou Span which is higher
pasenkB = close > ss_below// Price is above the Senkou span which is lower
price_below_kumo = close < ss_below // Price is below Kumo cloud
future_kumo_bull = senkouA > senkouB and (ta.roc(senkouA,3)>0) and (ta.roc(senkouB,3)>=0) // Future Kumo cloud is bullish
pbtenkan=close<tenkan
tkbelowkij=tenkan<kijun
future_kumo_bear = senkouA < senkouB//Future Kumo cloud is bearish
// Price Distance From Tenken
disbull = distance < 2*atr
//Price Distance From Kijun
disbullk = distancek < 3*atr
//Price Above Tenkan Condition
patk = close > tenkan
// Kijun Above Senkou Span Condition
kjasenkA = kijun > ss_above
// Price Below Kijun Condition
pbkijun = close < kijun
//Consolidation Tenkan and Kijun are inside Kumo cloud
kijuninsidekumo= kijun<ss_above and kijun>ss_below
tenkaninsidekumo= tenkan<ss_above and tenkan>ss_below
consolidation=kijuninsidekumo and tenkaninsidekumo

//Bullish Entry Condition

bullish= tk_cross_kijun_bull and cs_cross_bull and price_above_kumo and future_kumo_bull and disbull and patk 
     and not consolidation
//Bullish exit
bearish=tk_cross_kijun_bear and pbsenkA and cs_cross_bear  and future_kumo_bear
      or price_below_kumo     
// Bearish Entry Condition

bearish2=tk_cross_kijun_bear and pbtenkan and tkbelowkij and tkbelowkij and cs_cross_bear and future_kumo_bear

if(bullish and timewindow and long_entry )
    strategy.entry("Long Entry", strategy.long)


if(bearish2 and timewindow and short_entry)
    strategy.entry("Short Entry",strategy.short)
// Bearish Condition



lastentryprice = strategy.opentrades.entry_price(strategy.opentrades - 1)

// Take Profit or Stop Loss in Bearish

exit1= (close-tenkan)>3*atr and slopetenkan<=0
exit2= (close-lastentryprice)>5*atr and close<(tenkan-0.04*atr)

if(bearish and timewindow and not short_entry or exit1 or exit2  or (close>1.30*lastentryprice  ) or (close< 0.95*lastentryprice))
    strategy.close("Long Entry")
if(bullish and timewindow and not long_entry)
    strategy.close("Short Entry")
if(time>finish)
    strategy.close_all("time up")

plot(tenkan, color=#0496ff, title="Tenkan-Sen")
plot(kijun, color=#991515, title="Kijun-Sen")
plot(close, offset=-cs_offset+1, color=#2e640e, title="Chikou-Span")
sa=plot(senkouA, offset=ss_offset-1, color=color.rgb(17, 122, 21), title="Senkou-Span A")
sb=plot(senkouB, offset=ss_offset-1, color=color.rgb(88, 8, 8), title="Senkou-Span B")
fill(sa, sb, color = senkouA > senkouB ? color.rgb(198, 234, 198) : color.rgb(208, 153, 153), title="Cloud color")