Tags:

This strategy calculates the highest and lowest prices of recent N bars to set double breakout conditions combined with moving average line to implement low-buying and high-selling trading strategy.

The strategy is mainly based on the following principles:

- Calculate the minimum low price minLow of recent 7 bars to determine the breakout buy condition
- Calculate the maximum high price maxHigh of recent 7 bars to determine the breakout sell condition
- Calculate the 200-period simple moving average line mma to determine the trend direction combined with mma
- Buy condition: close price breaks through minLow and is higher than mma
- Sell condition: close price breaks through maxHigh or is higher than maxHigh

By calculating the extremes of recent N bars, it judges whether the market is extremely oversold or overbought. Combined with the moving average line to determine the trend direction, it sets double conditions to achieve the breakout trading strategy of low-buying and high-selling.

The strategy has the following advantages:

- The double condition setting makes the trading signals of the strategy more reliable
- Using the extremes of K lines to judge the oversold and overbought status can seize the chance of reversal
- Combining the moving average line to determine the trend direction avoids reverse operations
- It implements the idea of low-buying and high-selling, which is consistent with the trading psychology of most traders
- The logic of the strategy is simple and clear, easy to understand and implement

Through double confirmation, the signal quality of the strategy is relatively high, and the space for parameter optimization is large, which is suitable for different market environments.

The strategy also has some risks:

- The double condition limit the frequency of signals, possibly missing some trading opportunities
- Improper settings of computing cycle for K line extremes may fail to accurately determine the oversold and overbought status
- Improper parameter settings of the moving average line may incorrectly determine the trend direction
- It needs to optimize multiple parameters simultaneously, making parameter optimization more difficult

These risks can be reduced by adjusting computing cycles, optimizing parameter combinations and other methods. In addition, considering combining with other indicators for optimization.

The strategy can be mainly optimized in the following directions:

- Optimize the computing cycle of K line extremes to find the most appropriate cycle parameters to determine overbought and oversold
- Test the effects of moving average lines of different lengths
- Increase other combined indicators such as BOLL channels, KD indicators, etc.
- Increase stop loss strategies to control single stop loss
- Optimize entry and exit conditions to improve signal quality

Through parameter optimization, indicator optimization, risk control optimization and other means, the profit factor of the strategy can be greatly improved.

In general, this is a very practical breakout strategy. Calculating extremes of K lines to determine oversold and overbought status, using moving average line to determine trend direction, setting double filtering conditions to filter false signals, it implements high-quality low-buying and high-selling strategies. By optimizing computing cycles, adding other indicators and other means, the strategy effect can be further enhanced. The strategy is suitable for both beginners to learn and professional traders to optimize and use.

/*backtest start: 2023-02-22 00:00:00 end: 2024-02-28 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("Larry Connors por RON", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100) value1 = input(7, title="Quantity of day low") value2 = input(7, title="Quantity of day high") entry = lowest(close[1], value1) exit = highest(close[1], value2) lengthMMA = input(200, title="Length of SMA", minval=1) mma = sma(close, lengthMMA) // Calcular el mínimo de los precios bajos de las últimas 'value1' velas minLow = lowest(low, value1) // Calcular el máximo de los precios altos de las últimas 'value2' velas maxHigh = highest(high, value2) // Test Period testStartYear = input(2009, "Backtest Start Year") testStartMonth = input(1, "Backtest Start Month") testStartDay = input(2, "Backtest Start Day") testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, 0, 0) testStopYear = input(2020, "Backtest Stop Year") testStopMonth = input(12, "Backtest Stop Month") testStopDay = input(30, "Backtest Stop Day") testPeriodStop = timestamp(testStopYear, testStopMonth, testStopDay, 0, 0) testPeriod() => true if testPeriod() // Condiciones de entrada conditionMet = (close > mma) and (close < entry) and (low == minLow) strategy.entry("Buy", strategy.long, when=conditionMet) if conditionMet label.new(bar_index, entry, text="↑", style=label.style_arrowup, color=color.green, size=size.small, yloc=yloc.belowbar) // Condiciones de salida conditionExit = close > exit or close > maxHigh strategy.close("Buy", when=conditionExit)template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6