
この戦略は,両均線交差とRSI指標を組み合わせて,トレンドの方向を識別し,超買いと超売りの状況を超買いし,買い条件が合っているときに多めにし,売り条件が合っているときに平仓する. この戦略は,均線交差を利用してトレンドの方向を決定し,同時にRSI指標を利用して,市場のトップで多めにし,市場の底で空白を避けるようにして,より良い利益を得る.
速い9周期平均線でゆっくりとした50周期平均線を横切るときは,短期トレンドの上昇が長期トレンドの上昇を重ねて表示され,典型的な多頭シグナルである.また,もしRSI指標が前の周期の5点より大きく70点未満であるならば,超買い前の領域にあることを示し,このとき多頭することがより適切なタイミングである.
急速9周期平均線の下を通過すると,空頭市場であり,平仓が必要である.
この戦略は,双均線交差判定方向とRSIを回避し,上下追尾を避け,中長線トレンドを有効に利用して安定した利益を得ることができる.しかし,均線交差信号の遅滞性とRSIパラメータの調整に注意する必要もあります.価格と取引量の関係にも注意してください.継続的なテストと最適化により,この戦略は,より良い効果が得られることが期待されています.
/*backtest
start: 2022-11-14 00:00:00
end: 2023-11-20 00:00:00
period: 1d
basePeriod: 1h
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/
// © joshuajcoop01
//@version=5
strategy("Bitpanda Coinrule Template",
overlay=true,
initial_capital=1000,
process_orders_on_close=true,
default_qty_type=strategy.percent_of_equity,
default_qty_value=30,
commission_type=strategy.commission.percent,
commission_value=0.1)
showDate = input(defval=true, title='Show Date Range')
timePeriod = time >= timestamp(syminfo.timezone, 2020, 1, 1, 0, 0)
notInTrade = strategy.position_size <= 0
// RSI
length = input(14)
vrsi = ta.rsi(close, length)
// Moving Averages for Buy Condition
buyFastEMA = ta.ema(close, 9)
buySlowEMA = ta.ema(close, 50)
buyCondition1 = ta.crossover(buyFastEMA, buySlowEMA)
increase = 5
if ((vrsi > vrsi[1]+increase) and buyCondition1 and vrsi < 70 and timePeriod)
strategy.entry("Long", strategy.long)
// Moving Averages for Sell Condition
sellFastEMA = ta.ema(close, 9)
sellSlowEMA = ta.ema(close, 50)
plot(request.security(syminfo.tickerid, "60", sellFastEMA), color = color.blue)
plot(request.security(syminfo.tickerid, "60", sellSlowEMA), color = color.green)
condition = ta.crossover(sellSlowEMA, sellFastEMA)
//sellCondition1 = request.security(syminfo.tickerid, "60", condition)
strategy.close('Long', when = condition and timePeriod)