
This strategy combines MACD (Moving Average Convergence Divergence), RSI (Relative Strength Index), and SMA (Simple Moving Average) to generate reliable buy and sell signals. MACD is used to capture momentum changes in price, RSI is used to identify overbought and oversold conditions, while SMA is used to confirm the trend direction. The strategy employs multiple filters to reduce false signals, providing clear entry and exit points for intraday trading.
The entry and exit conditions for the strategy are as follows:
This strategy combines technical indicators such as MACD, RSI, and SMA to form a multi-filter intraday trading strategy. It utilizes changes in momentum and trend to capture trading opportunities while controlling risk through clear entry and exit rules. Although the strategy may face challenges in choppy markets, with further optimization and risk management, it has the potential to become a reliable tool for intraday trading.
/*backtest
start: 2024-05-07 00:00:00
end: 2024-06-06 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Day Trading Strategy", overlay=true)
// Parametrii pentru MACD
macdLength = input.int(12, title="MACD Length")
signalSmoothing = input.int(9, title="MACD Signal Smoothing")
src = input(close, title="Source")
// Calculul MACD
[macdLine, signalLine, _] = ta.macd(src, macdLength, 26, signalSmoothing)
macdHist = macdLine - signalLine
// Parametrii pentru RSI
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
// Calculul RSI
rsi = ta.rsi(src, rsiLength)
// Filtru suplimentar pentru a reduce semnalele false
longFilter = ta.sma(close, 50) > ta.sma(close, 200)
shortFilter = ta.sma(close, 50) < ta.sma(close, 200)
// Conditii de intrare in pozitie long
enterLong = ta.crossover(macdLine, signalLine) and rsi < rsiOverbought and longFilter
// Conditii de iesire din pozitie long
exitLong = ta.crossunder(macdLine, signalLine) or rsi > rsiOverbought
// Conditii de intrare in pozitie short
enterShort = ta.crossunder(macdLine, signalLine) and rsi > rsiOversold and shortFilter
// Conditii de iesire din pozitie short
exitShort = ta.crossover(macdLine, signalLine) or rsi < rsiOversold
// Adaugarea strategiei pentru Strategy Tester
if (enterLong)
strategy.entry("BUY", strategy.long)
if (exitLong)
strategy.close("BUY")
if (enterShort)
strategy.entry("SELL", strategy.short)
if (exitShort)
strategy.close("SELL")
// Plotarea MACD si Signal Line
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
hline(0, "Zero Line", color=color.gray)
plot(macdHist, color=color.red, style=plot.style_histogram, title="MACD Histogram")