
이 전략은 상대적으로 강한 지표 (RSI) 를 기반으로 한 정량 거래 전략이다. 이 전략은 RSI 지표를 사용하여 시장의 과매매 및 과매매 상태를 판단하고 적절한 시간에 구매 및 판매 작업을 수행한다. 이 전략은 마팅겔 시스템의 개념을 도입하여 조건이 충족되면 거래의 위치를 확대한다.
이 전략의 주요 내용은 다음과 같습니다.
이 전략은 RSI 지표를 기반으로 한 양적 거래 전략이며 마팅겔 시스템을 도입했다. 전략의 장점은 RSI 지표의 유효성과 전략 논리의 명확성이다. 그러나 전략에는 RSI 지표의 실패, 마팅겔 시스템 과장 위험 등과 같은 위험이 있습니다.
/*backtest
start: 2024-04-01 00:00:00
end: 2024-04-30 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Cloudexp1
//@version=5
strategy("RSI Martingale Strategy", overlay=true)
// RSI settings
rsi_length = input(14, title="RSI Length")
overbought_level = input(70, title="Overbought Level")
oversold_level = input(30, title="Oversold Level")
// Martingale settings
initial_quantity = input(1, title="Initial Quantity")
martingale_multiplier = input(2, title="Martingale Multiplier")
// Calculate RSI
rsi = ta.rsi(close, rsi_length)
// Entry conditions
buy_condition = ta.crossover(rsi, oversold_level)
sell_condition = ta.crossunder(rsi, overbought_level)
// Take profit and stop loss
take_profit_percent = 0
stop_loss_percent = 0
// Strategy logic
strategy.entry("Buy", strategy.long, when = buy_condition)
strategy.entry("Sell", strategy.short, when = sell_condition)
// Calculate take profit and stop loss levels
take_profit_level = close * (1 + take_profit_percent / 100)
stop_loss_level = close * (1 - stop_loss_percent / 100)
// Exit conditions
strategy.exit("Exit Buy", "Buy", limit = take_profit_level, stop = stop_loss_level)
strategy.exit("Exit Sell", "Sell", limit = take_profit_level, stop = stop_loss_level)
// Martingale logic
var float last_quantity = na
if (buy_condition)
last_quantity := initial_quantity
if (sell_condition)
last_quantity := initial_quantity
if (strategy.position_size > 0)
strategy.entry("Buy Martingale", strategy.long, qty = last_quantity * martingale_multiplier)
if (strategy.position_size < 0)
strategy.entry("Sell Martingale", strategy.short, qty = last_quantity * martingale_multiplier)