This strategy trades consecutive upside or downside bar breakouts, judging if recent price action exhibits persistence in one direction. It aims to capture short-term trend opportunities.
Strategy Logic:
Check if current bar is up/down versus bars from fixed lookback, e.g. 5 bars ago.
Enter long after multiple bars close higher than open.
Enter short after multiple bars close lower than open.
Use stops to limit loss.
Customizable backtest period for optimizing parameters.
Advantages:
Consecutive up/down bars determine short-term trends.
Real-time alerts possible for monitoring.
Simple backtest optimization enables live trading.
Risks:
No overall mid/long-term bias, risks whipsaws.
Tight stops may prematurely exit.
Beware reversals, prudent to actively take profits.
In summary, this short-term tactical strategy has potential based on backtests, but requires caution on reversals and disciplined loss cutting when live trading.
/*backtest start: 2023-08-13 00:00:00 end: 2023-09-12 00:00:00 period: 3h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 // strategy("BarUpDn Strategy", overlay=true, initial_capital = 10000, default_qty_value = 10000, default_qty_type = strategy.cash) BarsUp = input(1) BarsDown = input(1) // Strategy Backesting startDate = input(timestamp("2021-01-01T00:00:00"), type = input.time) finishDate = input(timestamp("2021-12-31T00:00:00"), type = input.time) time_cond = true // Messages for buy and sell message_buy = input("{{strategy.order.alert_message}}", title="Buy message") message_sell = input("{{strategy.order.alert_message}}", title="Sell message") if (close > open and open > close[BarsUp]) and time_cond strategy.entry("BarUp", strategy.long, stop = high + syminfo.mintick, alert_message = message_buy) if (close < open and open < close[BarsDown]) and time_cond strategy.entry("BarDn", strategy.short, stop = low + syminfo.mintick, alert_message = message_sell) //plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)