Это динамическая торговая стратегия, основанная на относительно сильном индикаторе RSI, в сочетании с гибким механизмом остановок. Стратегия заключается в том, чтобы торговать в основном на перепроданные зоны рынка, чтобы получить прибыль, захватывая возможности для восстановления цены.
Стратегия основана на следующих ключевых факторах:
Это хорошо продуманная торговая стратегия, которая, благодаря сочетанию RSI oversold суждения и механизма остановки убытков, достигает хорошего баланса между контролем риска и захватами прибыльных возможностей. Стратегия имеет большую адаптивность и подходит для повышения производительности в различных рыночных условиях с помощью оптимизации параметров. Несмотря на некоторые потенциальные риски, можно еще больше повысить стабильность и прибыльность стратегии с помощью рекомендуемой направленности оптимизации.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("RSI Strategy with Adjustable RSI and Stop-Loss", overlay=false,
default_qty_type=strategy.fixed, default_qty_value=2,
initial_capital=10000, pyramiding=2,
commission_type=strategy.commission.percent, commission_value=0.05,
slippage=1)
// Input fields for RSI parameters
rsi_length = input.int(8, title="RSI Length", minval=1)
rsi_threshold = input.float(28, title="RSI Threshold", minval=1, maxval=50)
// Input for Stop-Loss percentage
stop_loss_percent = input.float(5, title="Stop-Loss Percentage", minval=0.1, maxval=100)
// Calculate the RSI
rsi = ta.rsi(close, rsi_length)
// Condition for buying: RSI below the defined threshold
buyCondition = rsi < rsi_threshold
// Condition for selling: Close price higher than yesterday's high
sellCondition = close > ta.highest(high, 1)[1]
// Calculate the Stop-Loss level based on the entry price
var float stop_loss_level = na
if (buyCondition)
stop_loss_level := close * (1 - stop_loss_percent / 100)
strategy.entry("Long", strategy.long)
// Create Stop-Loss order
strategy.exit("Stop-Loss", from_entry="Long", stop=stop_loss_level)
// Selling signal
if (sellCondition)
strategy.close("Long")
// Optional: Plot the RSI for visualization
plot(rsi, title="RSI", color=color.blue)
hline(rsi_threshold, "RSI Threshold", color=color.red)