この戦略は,K線の色の変化を観察して,市場動向を判断し,それに基づいて多額の空調ポジションを確立する.戦略の原理はシンプルで直接であり,ショートラインの動向を捕捉することを目的としている.
この策略は,K線の閉盘価格と開盤価格の関係に基づいてK線の色を判断し,閉盘価格が開盤価格より大きいのは赤のK線,閉盘価格が開盤価格より小さいのは緑のK線である.
指定された数 (… 設定可能) の連続した同色K線が現れたとき,対応する操作を行います:
赤い場合はもっとたくさん
緑の場合は空いてください.
K線の色が変化すると平仓は退場する.
原則は明快でシンプルで,理解しやすい.
短期的なトレンドを追跡し,頻繁に取引することができます.
K線の数をカスタマイズし,戦略の感度を調整する.
取引の頻度を下げるため,多額または空白で取引することができます.
取引の時間帯を設定し,回避する必要がある時間帯を回避します.
市場がどう動いているか分からないので,利回りの危険性があります.
採用のタイミングを把握できず,早期の採用や機会の喪失の危険性がある.
K線の色が変化しても,実質的なトレンドの変化を意味するものではありません.
短線に伴う過度取引が容易で,取引料金の圧力がある.
パラメータを正しく設定しない場合, 策略がうまく機能しない可能性があります.
MACD,KDなどのトレンド判断指標を導入することを検討できます.
ストップ・ロスを設定して,損失のリスクを低減する.
適当に放宽して,頻繁に出場を避ける.
他の要因と組み合わせて,入場タイミングを最適化できます.例えば,取引量が増加し,前期高点を破るなどです.
スライドポイントの影響を減らすために,注文タイプを市販価格に設定できます.
この戦略は,最も単純なK線技術分析から生まれ,K線色を判断することによって最も基本的なトレンド追跡を実現する. 優点は,単純に分かりやすく,取引が頻繁で,パラメータを柔軟に調整できる. しかし,ある種の盲目性があり,トレンド優劣を判断することができない. トレンド判断指標などの方法を追加することによって最適化することができ,シンプルな前提を保ちながら戦略の効果を高める.
/*backtest
start: 2023-09-10 00:00:00
end: 2023-10-10 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
//2018
//Noro
//@version=2
strategy("Noro's Candles Strategy v1.0", shorttitle = "Candles str 1.0", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100.0, pyramiding = 0)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
bq = input(2, defval = 2, minval = 2, maxval = 6, title = "Bars Q")
fromyear = input(2018, defval = 2018, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2018, defval = 2018, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From Day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To Day")
//Bars Q
bar = close > open ? 1 : close < open ? -1 : 0
gb = bar == 1
rb = bar == -1
redbars = bq == 2 and rb and rb[1] ? 1 : bq == 3 and rb and rb[1] and rb[2] ? 1 : bq == 4 and rb and rb[1] and rb[2] and rb[3] ? 1 : bq == 5 and rb[1] and rb[2] and rb[3] and rb[4] ? 1 : bq == 6 and rb[1] and rb[2] and rb[3] and rb[4] and rb[5] ? 1 : 0
greenbars = bq == 2 and gb and gb[1] ? 1 : bq == 3 and gb and gb[1] and gb[2] ? 1 : bq == 4 and gb and gb[1] and gb[2] and gb[3] ? 1 : bq == 5 and gb[1] and gb[2] and gb[3] and gb[4] ? 1 : bq == 6 and gb[1] and gb[2] and gb[3] and gb[4] and gb[5] ? 1 : 0
//Signals
up1 = redbars == 1
dn1 = greenbars == 1
exit = bar != bar[1]
if up1
strategy.entry("Long", strategy.long, needlong == false ? 0 : na)
if dn1
strategy.entry("Short", strategy.short, needshort == false ? 0 : na)
if time > timestamp(toyear, tomonth, today, 00, 00) or exit
strategy.close_all()