This strategy uses the 9-period Exponential Moving Average (9EMA) as the basis for trend determination. Within the first 10 minutes of the trading day, if there are two consecutive 5-minute candles with closing prices very close to the high (greater than or equal to 99% of the high) and above the 9EMA, it is considered a strong breakout signal. At this point, the position size is calculated based on the current closing price, and a long position is opened. The position is held until the first 5-minute candle with a close below the 9EMA, at which point the position is closed.
This strategy is based on the following principles:
This strategy aims to capture strong breakout moves during the opening period of a trading day and participates with dynamic position sizing, seeking to achieve high returns with low risk. At the same time, the strategy also employs strict stop-loss conditions, promptly closing positions once the trend reverses to control drawdowns.
To address the above risks, the following aspects can be considered for optimization and improvement:
Through the above optimizations, the strategy is expected to better control risks while capturing trends, improving the stability and sustainability of strategy returns. Of course, any optimization needs to be validated through rigorous backtesting and dynamically adjusted based on actual conditions.
This strategy uses the 9EMA as the core and captures strong upward trends within the first 10 minutes of a trading day by having two consecutive 5-minute candles with closing prices strongly breaking above the 9EMA. It trades using a fixed monetary amount to dynamically adjust position size. The strategy logic is simple and straightforward, easy to understand and execute, and suitable for most traders to use. At the same time, the strategy also has certain limitations and risks, such as insufficient adaptability to ranging markets and downward trending markets, as well as the risk of rapid reversals after opening positions. To address these issues, improvements and optimizations can be made in terms of trend determination, position sizing, stop-loss optimization, filtering conditions, etc., to enable the strategy to better capture market opportunities and control risks. Overall, this strategy has a clear thought process and strong plasticity, and is worth further exploration and practice.
/*backtest start: 2023-03-13 00:00:00 end: 2024-03-18 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Two 5min Closes Above 9EMA Strategy with Dynamic Position Size", overlay=true) // Define the fixed amount for position sizing fixedAmount = 1000 // Calculate the 9-period EMA ema9 = ta.ema(close, 9) // Define time constraints (9:30 AM to 9:40 AM EST, adjust for your timezone) sessionStart = 0930 sessionEnd = 0940 timeCondition = (hour * 100 + minute) >= sessionStart and (hour * 100 + minute) < sessionEnd // Detect two consecutive 5-min bars where close is near 0.99 times the high and above 9 EMA closeNearHighAndAboveEMA = close >= high * 0.99 and close > ema9 twoConsecutiveBars = closeNearHighAndAboveEMA and closeNearHighAndAboveEMA[1] // Entry condition: Within the first 10 minutes of the day and two consecutive bars match criteria entryCondition = twoConsecutiveBars // Exit condition: First 5-min close below 9 EMA after entry exitCondition = close < ema9 // Plot EMA for visualization plot(ema9, color=color.blue, linewidth=2, title="9 EMA") // Calculate position size positionSize = fixedAmount / close // Strategy execution if (entryCondition) strategy.entry("Buy", strategy.long, qty=positionSize) if (exitCondition) strategy.close("Buy")