
This strategy is a technical analysis-based trading strategy that uses support and resistance levels to make trading decisions. The strategy utilizes the pivothigh() and pivotlow() indicators to determine support and resistance levels. It goes long when the closing price is above the resistance level and goes short when the closing price is below the support level, and the previous high is also below the support level. Positions are closed when the price crosses the support or resistance levels in the opposite direction. The strategy is suitable for the Russian stock market and uses daily data.
This strategy is a technical analysis-based trading strategy that uses support and resistance levels to generate trading signals. The strategy logic is straightforward, making it suitable for beginners to learn. However, when applying the strategy in practice, risk management and optimization need to be considered. By introducing other technical indicators, risk control measures, position sizing, and other enhancements, the robustness and profitability of the strategy can be further improved. Before deploying the strategy in a live trading environment, it is recommended to conduct comprehensive backtesting and parameter optimization on historical data.
/*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"}]
*/
//@version=5
strategy("Торговая стратегия от уровней", overlay=true)
// Функция для определения уровней поддержки и сопротивления
findSR() =>
// Получаем данные для поиска уровней
data = request.security(syminfo.tickerid, "D", close)
// Находим уровни поддержки и сопротивления
pivot_high = ta.pivothigh(data, 7, 7)
pivot_low = ta.pivotlow(data, 7, 7)
[pivot_high, pivot_low]
[support, resistance] = findSR()
// Условия входа в длинную позицию
longCondition = close > resistance
// Условия входа в короткую позицию
shortCondition = close < support and high[1] < support
// Условия выхода из позиции
exitCondition = close < resistance and close > support
// Отображение уровней поддержки и сопротивления на графике
plot(support, color=color.green, style=plot.style_stepline)
plot(resistance, color=color.red, style=plot.style_stepline)
// Вход в позицию
if (longCondition)
strategy.entry("Длинная", strategy.long)
if (shortCondition)
strategy.entry("Короткая", strategy.short)
// Выход из позиции
if (exitCondition)
strategy.close("Длинная")
strategy.close("Короткая")