This strategy combines the 200-day Exponential Moving Average (200 EMA), Volume Weighted Average Price (VWAP), and Money Flow Index (MFI) to generate buy and sell signals. The main idea is to use the combination of these three indicators to determine the trend direction and strength, and generate trading signals when the price breaks through the 200 EMA and is confirmed by the VWAP and MFI indicators. Additionally, a 200 EMA from a higher timeframe is introduced as a trend filter, and trades are only executed when the trends on the current and higher timeframes align. Furthermore, the continuity of price movements is assessed to improve the reliability of signals.
By combining the 200-day EMA, VWAP, and MFI indicators, while considering trends in higher timeframes and the continuity of price movements, this strategy constructs a relatively robust trend-following trading system. The strategy filters false signals by comprehensively analyzing multiple conditions, improving the accuracy of entry timing. At the same time, the flexibility of strategy parameters allows for optimization based on different markets and trading styles. However, the strategy also involves certain risks, such as potential losses in choppy markets or at trend turning points, and poor performance due to improper parameter settings. In the future, the strategy can be further optimized and improved in terms of parameter optimization, introducing auxiliary indicators, risk management, and other aspects. Overall, this strategy provides a comprehensive and feasible framework for trend-following trading.
/*backtest start: 2023-05-08 00:00:00 end: 2024-05-13 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("200 EMA, VWAP, MFI Strategy - Visible Signals", overlay=true, pyramiding=0) // Inputs for dynamic adjustments buffer = input.float(0.2, title="EMA Buffer Percentage", step=0.1) / 100 higherTimeframe = input.timeframe("15", title="Higher Timeframe") mfiBuyThreshold = input(60, title="MFI Buy Threshold") mfiSellThreshold = input(40, title="MFI Sell Threshold") consecutiveCloses = input.int(1, title="Consecutive Closes for Confirmation") // Calculate the 200-period EMA ema200 = ta.ema(close, 200) emaBufferedHigh = ema200 * (1 + buffer) emaBufferedLow = ema200 * (1 - buffer) emaHigher = request.security(syminfo.tickerid, higherTimeframe, ta.ema(close, 200)) // VWAP calculation vwap = ta.vwap(hlc3) // Money Flow Index calculation mfiLength = 14 mfi = ta.mfi(close, mfiLength) // Plotting the indicators plot(ema200, title="200 EMA", color=color.blue) plot(vwap, title="VWAP", color=color.orange) plot(mfi, title="MFI", color=color.purple) hline(50, "MFI Reference", color=color.gray, linestyle=hline.style_dashed) plot(emaHigher, title="Higher TF EMA", color=color.red) // Price action confirmation isUpTrend = ta.rising(close, consecutiveCloses) isDownTrend = ta.falling(close, consecutiveCloses) // Define entry conditions longCondition = close > emaBufferedHigh and close > vwap and mfi > mfiBuyThreshold and close > emaHigher and isUpTrend shortCondition = close < emaBufferedLow and close < vwap and mfi < mfiSellThreshold and close < emaHigher and isDownTrend // Trading execution if (longCondition) strategy.entry("Buy", strategy.long) if (shortCondition) strategy.entry("Sell", strategy.short) // Plot shapes for signals plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, size=size.small, title="Buy Signal", text="Buy") plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, size=size.small, title="Sell Signal", text="Sell")