力道K線突破戦略は,K線形状と力道指標を利用して株式の買入販売を実現する量化取引戦略である.この戦略は,複数の技術指標を組み合わせて,株価の傾向と力道信号を識別し,突破点でポジションを立て,止損止まりの退出を設定し,取引リスクを効果的に制御することができる.
K線を突破する戦略は,以下の要点に基づいています.
商品通路指数 (CCI) を用いて,株価が超買超売領域にあるかどうかを判断する.CCIが100を超えると超買信号とみなされ,CCIが100を超えると超売信号とみなされる。
K線形状を判断し,突破信号を識別する.閉盘価格が開盤価格より高い赤いK線が現れたときは上昇傾向と判断し,閉盘価格が開盤価格より低い緑のK線が現れた場合は下降傾向と判断する.
取引量指標を組み合わせると,取引量が大きくなった場合にのみ,買入と売却のシグナルを発信することを考慮する.
上昇傾向が認識されCCI指標が超売りを示しているときに買取操作を行う. 下降傾向が認識されCCI指標が超買いを示しているときに売出操作を行う.
ストップ・ストップ・ストップを設定する. 購入後に一定割合のストップ・ストップを設定し,下行リスクを制御し,同時に一定割合のストップ・ストップを設定し,利益をロックする.
具体的には,この戦略は,CCI指標を判断し,K線形を判断し,トレンドの方向を判断し,volum指標判断力道. 条件が合っている場合,ロング (買って多頭開く) またはショート (空頭を売って空頭売る) の操作を行う. 損失の止まりを停止してリスクを制御し,利益をロックする.
K線を突破する戦略には以下の利点があります.
複数の指標を組み合わせて意思決定を行うことで,取引信号をより信頼できます.CCI指標は,買入・売却のポイントを決定し,K線はトレンドの方向を判断し,volumeは市場勢いを反映します.
K線形を用いてトレンドの方向を判断することで,価格逆転のチャンスをより正確に捉えることができる.例えば,赤いK線とCCIのオーバーセルは買い時である.
ストップ・ストップ・メカニズムは,リスクを効果的に制御し,損失の拡大を防止し,利益をロックすることができます.
偽信号をフィルタリングするために,取引量が増大したときにのみ取引信号を考慮してください.
戦略は明確で分かりやすく,パラメータ設定は柔軟で,異なる株や市場環境で最適化できます.
戦略の安定性や収益率を向上させるため,例えば,より多くの要素,機械学習などの戦略を拡張して最適化することができます.
K線を突破する戦略には以下のリスクがあります.
CCI指標から発せられる買入シグナルが遅れて,最適なエントリーポイントを逃してしまう可能性があります.CCIのパラメータを適切に最適化して,感度を増やすことができます.
K線形判断による偽突破信号は不必要な損失を招く可能性がある。確認のためにより多くの指標を追加したり,あるいは止損比率を調整したりできる。
取引量の増加は市場操作の反映であり,価格の関係に注目し,落とし穴に踏み込まないようにする必要があります.
静的な止損停止の設定は,早めに止損するか,より大きな動きを逃す可能性があります.動的に止損停止の比率を調整することを考慮することができます.
株ごとに設定されたパラメータは,必ずしも他の株に適用されず,異なる株の特徴に応じてテスト最適化が必要である.
長期の反省データは必ずしも実盤の表現を表しているわけではないので,実盤では操縦リスクに注意する必要がある.
この戦略は,以下の観点から最適化できる:
CCIパラメータの最適化,CCI指標の取引先の判断感度を向上させる.
MACD,Bollinger Bandなどの他の補助指標を追加し,買入シグナルの正確性を向上させる.
機械学習のアルゴリズムを組み込み,過去データで予測する.
ダイナミックなストップ・ストップ方式を採用し,市場の波動程度に応じてストップ・ストップの比率を調整する.
取引量拡大の判断論理を最適化し,価格偏差を防止する.
異なる株の特徴と市場環境に応じてパラメータ設定を最適化し,戦略の安定性を高める.
トレンド追跡機能を追加し,戦略の各段階のパフォーマンスを最適化します.
戦略構造の改善,モジュール管理の導入,コードの柔軟性と拡張性の向上.
力道K線突破戦略は,全体的に比較的シンプルで明確な短線取引戦略である.それは,多くの一般的な技術指標の優位性を組み合わせ,判断論理が明確で分かりやすく,止損ストップでリスクを制御する.この戦略は,短線価格の逆転点をキャプチャするために,中期トレンドを追跡するために,自社のニーズに応じて柔軟に最適化することができます.しかし,指標の遅れや偽突破のリスクを防ぐことに注意する必要があります.
/*backtest
start: 2023-09-06 00:00:00
end: 2023-10-06 00:00:00
period: 2h
basePeriod: 15m
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/
// © vikris
//@version=4
strategy("[VJ]War Machine PAT Intra", overlay=true, calc_on_every_tick = false)
// ********** Strategy inputs - Start **********
// Used for intraday handling
// Session value should be from market start to the time you want to square-off
// your intraday strategy
// Important: The end time should be at least 2 minutes before the intraday
// square-off time set by your broker
var i_marketSession = input(title="Market session", type=input.session,
defval="0915-1455", confirm=true)
// Make inputs that set the take profit % (optional)
longProfitPerc = input(title="Long Take Profit (%)",
type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01
shortProfitPerc = input(title="Short Take Profit (%)",
type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01
// Set stop loss level with input options (optional)
longLossPerc = input(title="Long Stop Loss (%)",
type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01
shortLossPerc = input(title="Short Stop Loss (%)",
type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01
trendFactor = input(title="Trend Factor(Lower means trending)", type=input.integer, minval=1, step=1, defval=50)
oversold = input(title="Oversold", type=input.integer, minval=1, step=1, defval=25)
overbought = input(title="Overbought", type=input.integer, minval=1, step=1, defval=75)
// ********** Strategy inputs - End **********
// ********** Supporting functions - Start **********
// A function to check whether the bar or period is in intraday session
barInSession(sess) => time(timeframe.period, sess) != 0
// Figure out take profit price
longExitPrice = strategy.position_avg_price * (1 + longProfitPerc)
shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc)
// Determine stop loss price
longStopPrice = strategy.position_avg_price * (1 - longLossPerc)
shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)
// ********** Supporting functions - End **********
// ********** Strategy - Start **********
// See if intraday session is active
bool intradaySession = barInSession(i_marketSession)
// Trade only if intraday session is active
//=================Strategy logic goes in here===========================
//Vol Confirmation
vol = volume > volume[1]
//Engulfing candle confirm
bullishEC = close > open[1] and close[1] < open[1]
bearishEC = close < open[1] and close[1] > open[1]
//Candles colors
greenCandle = (close > open)
redCandle = (close < open)
length = input(title="Length", type=input.integer, defval=14, minval=1, maxval=2000)
src = hlc3
upper = sum(volume * (change(src) <= 0 ? 0 : src), length)
lower = sum(volume * (change(src) >= 0 ? 0 : src), length)
_rsi(upper, lower) =>
100.0 - (100.0 / (1.0 + upper / lower))
mf = _rsi(upper, lower)
ci = 100 * log10(sum(atr(1), length) / (highest(length) - lowest(length))) / log10(length)
//tradeSignal = ((rsiOS or rsiOS[1]) and bullishEC) or ((rsiOB or rsiOB[1]) and bearishEC)
//Final Long/Short Condition
longCondition = redCandle and mf < oversold and ci <trendFactor and vol
shortCondition = greenCandle and mf >overbought and ci <trendFactor and vol
//Long Strategy - buy condition and exits with Take profit and SL
if (longCondition and intradaySession)
stop_level = longStopPrice
profit_level = longExitPrice
strategy.entry("My Long Entry Id", strategy.long)
strategy.exit("TP/SL", "My Long Entry Id", stop=stop_level, limit=profit_level)
//Short Strategy - sell condition and exits with Take profit and SL
if (shortCondition and intradaySession)
stop_level = shortStopPrice
profit_level = shortExitPrice
strategy.entry("My Short Entry Id", strategy.short)
strategy.exit("TP/SL", "My Short Entry Id", stop=stop_level, limit=profit_level)
// Square-off position (when session is over and position is open)
squareOff = (not intradaySession) and (strategy.position_size != 0)
strategy.close_all(when = squareOff, comment = "Square-off")
// ********** Strategy - End **********