高速RSIとローソク足の色に基づく反転戦略


作成日: 2023-09-13 17:24:54 最終変更日: 2023-09-13 17:24:54
コピー: 0 クリック数: 693
1
フォロー
1617
フォロワー

この戦略は,急速RSIとK線色に基づく反転戦略と呼ばれる.この戦略は,急速RSIを判断し,超買いと超売りとK線色を判断し,トレンドの方向を判断し,両者が共通の信号を発したときに反転取引を行う.

急速RSI指標のパラメータ設定は小さいので,価格をより早く捉える超買超売現象である. 急速RSIが30を下回ると超売を意味し,70を超えると超買を意味する.

K線は,白色で開場価格の近くで閉店し,緑色で上昇し,赤色で下落している.

取引の論理は以下の通りです.

急速なRSIがオーバーセールを示し,4つの赤いK線が連続して現れるときは,強烈な反転信号として,多額の取引をします.

急速なRSIがオーバーバイを示し,4つの緑のK線が連続して現れるときは,強烈な反転信号とみなして空白する.

現在多頭ポジションを保有している場合,1本の緑色K線が出現すると平仓;現在空頭ポジションを保有している場合,1本の赤色K線が出現すると平仓。

この戦略の優点は,指標の組み合わせが逆転信号を正確に判断できるという点である.しかし,投資の強度が高いため,厳格な資金管理が必要である.止損戦略も不可欠である.

概して,反転取引は指標に依存して正確なタイミングを判断する.RSIなどの指標を合理的に適用し,K線情報で補足することで,戦略の効果を向上させることができます.しかし,いかなる単一の戦略も完璧ではありません.トレーダーは依然として取引思考の柔軟性を維持する必要があります.

||

This strategy is named “Reversal Strategy Based on Fast RSI and Candlestick Colors”. It uses the fast RSI to judge overbought/oversold levels and candlestick colors to determine trend direction, entering reversal trades when both give concurring signals.

The fast RSI has smaller parameters and can more quickly detect price overbought/oversold conditions. RSI below 30 suggests oversold state, while above 70 is overbought.

Candlestick colors show white prices closing near open, green represents rising and red flags falling prices.

The trading logic is:

When fast RSI shows oversold and 4 consecutive red candles appear, it is considered a strong reversal signal for going long.

When fast RSI overbought and 4 straight green candles appear, it signals a strong reversal opportunity for going short.

If already holding long positions, exit when 1 green candle appears. If holding short positions, exit when 1 red candle appears.

The advantage of this strategy is using indicator combos to accurately determine reversal signals. But strict money management is required due to heavy position sizing. Stop loss is also essential.

In summary, reversal trading relies on indicators precisely identifying timing. Reasonable application of RSI plus candlestick information can improve strategy performance. But no single strategy is perfect. Traders still need to maintain flexible trading mindset.

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

//Noro
//2018

//@version=2
strategy(title = "Noro's Hundred Strategy v1.0", shorttitle = "Hundred str 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
lev = input(5, defval = 5, minval = 1, maxval = 100, title = "leverage")
onlyprofit = input(true, defval = true, title = "Only Profit")
fast = input(7, defval = 7, minval = 2, maxval = 50, title = "Fast RSI Period")
limit = input(30, defval = 30, minval = 1, maxval = 100, title = "RSI limit")
rsisrc = input(close, defval = close, title = "RSI Price")
rsibars = input(1, defval = 1, minval = 1, maxval = 20, title = "RSI Bars")
cbars = input(4, defval = 4, minval = 1, maxval = 20, title = "Color Bars")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, 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")

//Fast RSI
fastup = rma(max(change(rsisrc), 0), fast)
fastdown = rma(-min(change(rsisrc), 0), fast)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

//Limits
bar = close > open ? 1 : close < open ? -1 : 0
uplimit = 100 - limit
dnlimit = limit

//RSI Bars
upsignal = fastrsi > uplimit ? 1 : 0
dnsignal = fastrsi < dnlimit ? 1 : 0
uprsi = sma(upsignal, rsibars) == 1
dnrsi = sma(dnsignal, rsibars) == 1

//Signals
long = strategy.position_size >= 0
short = strategy.position_size <= 0
up = sma(bar, cbars) == -1 and long and dnrsi
dn = sma(bar, cbars) == 1 and short and uprsi
profit = (strategy.position_size > 0 and close > strategy.position_avg_price) or (strategy.position_size < 0 and close < strategy.position_avg_price) or onlyprofit == false
exit = ((strategy.position_size > 0 and bar == 1) or (strategy.position_size < 0 and bar == -1)) and profit
lot = strategy.position_size == 0 ? strategy.equity / close * lev : lot[1]

//Trading
if up
    if strategy.position_size < 0
        strategy.close_all()
        
    strategy.entry("Long", strategy.long, needlong == false ? 0 : lot)

if dn
    if strategy.position_size > 0
        strategy.close_all()
        
    strategy.entry("Short", strategy.short, needshort == false ? 0 : lot)
    
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
    strategy.close_all()