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:
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:
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:
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:
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)