Tags:

This is a systematic approach designed to capitalize on the volatility of crude oil futures markets. It measures the average range of candlesticks. If the fast moving average is above the slow one, it means the candles are bigger. If the slow moving average is above the fast one, it means the candles are smaller.

According to this principle, it identifies potential long and short entry points. The position is only held for a fixed number of candles, controlled by the “Exit after bars” input.

- Calculate the highest close price of the most recent 9 bars, as the breakout benchmark
- Calculate the lowest close price of the most recent 50 bars, as the breakout benchmark
- Compare the average volatility of the most recent 5 and 20 bars to judge if the candlestick pattern is expanding or contracting
- Identify long and short signals: when close equals the highest close and candles contracting, go long; when close equals the lowest close and candles contracting, go short
- Close position after a fixed number of bars following breakout: adjustable parameter

- Regression strategy, judge direction by comparing with historical extremes
- Combine with volatility, avoid false breakouts
- Fixed number of bars for exit locks in some profit and avoids drawdown

- Historical extremes change with market structure changes, signals may fail
- False breakouts cause being trapped
- Improper exit interval may lose greater profit or increase loss

- Extremes parameters can be optimized through market statistics
- Add volatility metrics to evaluate true breakout probability
- Optimize number of exit bars through backtest result

This strategy utilizes breakout and regression to determine short-term trends, belonging to volatility strategies. By optimizing parameters and adding volatility metrics to determine false breakout probability, it can increase profitability. Also the fast exit mechanism locks in some profit and controls risk effectively. It can serve as an auxiliary tool for short-term trading, and can also generate longer-term trading signals through parameter tuning.

/*backtest start: 2024-02-01 00:00:00 end: 2024-02-29 23:59:59 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Celestial_Logic //@version=5 strategy("Crudeoil Breakout strategy", overlay = true, initial_capital = 20000, default_qty_type = strategy.fixed, default_qty_value = 1) highestCloseLookback = input(9 , title = 'Highest Close lookback') lowestCloseLookback = input(50, title = 'Lowest Close lookback' ) exitAfter = input(10, title = 'Exit after bars') hc = ta.highest(close,highestCloseLookback) lc = ta.lowest(close,lowestCloseLookback) rangeFilter = (ta.sma( (high - low), 5 ) > ta.sma((high-low), 20) ) // Candles getting bigger. longCondition = (close == hc ) and not rangeFilter shortCondition = (close == lc ) and not rangeFilter if longCondition strategy.entry(id = 'long', direction = strategy.long) if shortCondition strategy.entry(id = 'short', direction = strategy.short) var int longsince = 0 var int shortsince = 0 if strategy.position_size > 0 longsince += 1 else longsince := 0 if strategy.position_size < 0 shortsince += 1 else shortsince := 0 if longsince >= exitAfter strategy.close(id = 'long', comment = 'long close') if shortsince >= exitAfter strategy.close(id = 'short', comment = 'short close')

- 均线突破
- Consecutive Candlestick Reversal Breakout Strategy
- Short-Term Trading Strategy Based on Bollinger Bands
- Multi-EMA and RSI Trend Following Strategy
- Gold Trading with Simons Strategy
- MACD, RSI and EMA Strategy
- Trend Following Moving Average Strategy
- Quant Trading Strategy Based on HullMA Percentage Bands
- RSI and smoothed RSI bullish divergence strategy
- Dual-directional Trailing Stop Moving Average Trend Strategy
- Fast RSI Reversal Trading Strategy
- The Momentum Burst Tracking Strategy
- Elevated Touch Short Triangle Strategy
- Moving Average Crossover Trend Following Strategy
- Double Confirmation Breakthrough Strategy
- Walnut Trend Following Strategy Based on Distance from 200 EMA
- VWAP Trend Following Strategy
- Turtle Trend Strategy
- Market Reversal Momentum Strategy
- Triple BB Bands Breakout with RSI Strategy