This strategy uses LazyBear's Coral Trend indicator to determine the price trend direction by identifying reversals of the Coral Trend indicator to detect potential entry points. To filter out false breakouts, this strategy uses the ADX indicator or a combination of Absolute Strength Histogram and HawkEye Volume indicators as confirmation indicators for more reliable entry.
The exit mechanism uses the highest/lowest price of the most recent N candles multiplied by a configurable risk-reward ratio to set the stop loss and take profit.
## Strategy Logic
After determining the major trend direction based on the Coral Trend indicator, when the indicator color remains unchanged, and the price shows a small pullback in the opposite direction. At this time, if the pullback ends and the price returns to the main trend direction indicated by the Coral Trend, it can be considered a good entry point.
Entry conditions include:
1. Coral Trend indicator direction is consistent with trade direction (long=green, short=red)
2. Since the last time the price fully broke through the Coral Trend indicator (the high point of the last bar exceeds the Coral Trend line), there has been at least 1 bar with low points all above (long) or high points all below (short) the Coral Trend indicator
3. A small pullback occurs in the opposite direction, during which the closing price remains on the opposite side of the Coral Trend
4. After the pullback ends, the closing price returns to the main trend direction indicated by Coral Trend
The above are the main conditions. At the same time, the strategy adopts ADX indicator or Absolute Strength Histogram and HawkEye Volume indicator as confirmation conditions for entry.
The ADX indicator requires its value > 20 and rising over the last 1 bar. And the order of the green and red lines of DI is consistent with the trade direction.
The Absolute Strength Histogram requires that its color is consistent with the trade direction (long=blue, short=red). HawkEye Volume requires its color to be consistent with the trade direction (long=green, short=red).
The exit mechanism uses the highest/lowest price of the most recent N candles multiplied by risk-reward ratio to set the stop loss and take profit. The values of N and risk-reward ratio can be configured through parameters.
## Advantage Analysis
The biggest advantage of this strategy is that after determining the main trend direction using the Coral Trend indicator, it detects entry opportunities by identifying reversals, avoiding drifting around in non-trending markets. At the same time, the use of the Confirm indicator can filter out many false breakouts, thereby improving the success rate of entry.
In addition, this strategy provides a complete risk control mechanism, including setting the stop loss magnitude and controlling the percentage of risk exposure, so that even if individual trades lose money, it will not cause a major impact on the total capital.
## Risk Analysis
The biggest risk of this strategy is that the use of indicators for entry judgment can easily create illusions, believing that you can make money automatically just by relying on parameter configurations. In fact, both parameter optimization and rule configuration need to be combined with the laws of underlying price changes, intuitively judging the effect of indicators and prices, in order to set configurations that are more suitable for your own trading style and products.
In addition, the setting of stop loss and take profit also needs to be appropriate. Excessively large take profit multiples may result in failure to take profit, while excessively small stop loss will result in excessive risk. This needs to be set according to the volatility of different products and personal risk tolerance.
## Optimization Directions
The optimizable directions of this strategy include:
1. Adjust the parameters of the Coral Trend indicator to make it more sensitive to price changes of different products
2. Try different Confirm indicators or indicator combinations, such as KDJ, MACD, etc., to make entry signals more accurate
3. According to the volatility of different products, adjust the calculation method of stop loss and take profit to achieve better risk control
4. Add a funds management module to adjust the single order quantity based on the number of positions held, effectively controlling overall losses
5. Add a trading time control module to make the strategy only run during specific periods to avoid losses during periods of extreme volatility
## Conclusion
This strategy first uses Coral Trend to determine the medium and long term trend of prices, then by judging its reversal, combined with Confirm signals to filter out false breakouts, it builds a relatively reliable trend following strategy. At the same time, the improved risk control settings also enable this strategy to run for a long time with stable capital. With further optimization of parameters and modules, this strategy is expected to adapt to more products and have better stability and profitability.
// C6.2.1: Absolute Strengeh Histogram colour is red
// C6.2.2: HawkEye Volume Indicator colour is red
// NOTE: All the optional confirmation indicators cannot be overlayed with Coral Trend so feel free to add each separately to the chart for visual purposes
//
//
// - Trade exit: Stop Loss: Calculated by recent swing low over previous X candles (configurable with "Local High/Low Lookback")
// Take Profit: Calculated from R:R multiplier * Stop Loss size
//
// @credits
//
// Coral Trend Indicator [LazyBear] by @LazyBear
// Absolute Strength Histogram | jh by @jiehonglim
// Indicator: HawkEye Volume Indicator by @LazyBear
riskReward = input.float(1.5, "Risk : Reward1 :", group = "Strategy: Risk Management", inline = "RM1", minval = 0, step = 0.1, tooltip = "Previous high or low (long/short dependant) is used to determine TP level. 'Risk : Reward' ratio is then used to calculate SL based of previous high/low level.\n\nIn short, the higher the R:R ratio, the smaller the SL since TP target is fixed by previous high/low price data.")
accountRiskPercent = input.float(1, "Portfolio Risk %", group = "Strategy: Risk Management", inline = "RM2", minval = 0, step = 0.1, tooltip = "Percentage of portfolio you lose if trade hits SL.\n\nYou then stand to gain\n Portfolio Risk % * Risk : Reward\nif trade hits TP.")
localHlLookback = input.int (5, "Local High/Low Lookback ", group = "Strategy: Stop Loss Settings", inline = "SL1", minval = 1, tooltip = "This strategy calculates the Stop Loss value from the recent local high/low. This lookback period determines the number of candles to include for the local high/low.")
// ----------
// Date Range
// ----------
startYear = input.int (2010, "Start Date", group = "Strategy: Date Range", inline = "DR1", minval = 1900, maxval = 2100)
showTpSlBoxes = input.bool(true, "Show TP / SL Boxes", group = "Strategy: Drawings", inline = "D1", tooltip = "Show or hide TP and SL position boxes.\n\nNote: TradingView limits the maximum number of boxes that can be displayed to 500 so they may not appear for all price data under test.")
showLabels = input.bool(false, "Show Trade Exit Labels", group = "Strategy: Drawings", inline = "D2", tooltip = "Useful labels to identify Profit/Loss and cumulative portfolio capital after each trade closes.\n\nAlso note that TradingView limits the max number of 'boxes' that can be displayed on a chart (max 500). This means when you lookback far enough on the chart you will not see the TP/SL boxes. However you can check this option to identify where trades exited.")
confirmationInd = input.string("ADX and DI", "Entry Confirmation Method ", group = "Confirmation Indicator: Indicator Selection", inline = "IS1", options=["None", "ADX and DI", "Absolute Strength Histogram + HawkEye Volume"], tooltip = "Select one of the possible confirmation indicator(s) which can be used to confirm entry signals from the main Coral Trend indicator conditions. See strategy conditions to understand the logic behind each confirmation indicator")
// ADX and DI
adxLen = input.int(14, "ADX Length ", group = "Confirmation Indicator: ADX and DI Settings", inline = "AD1")
midLine = input.int(20, "Mid Line ", group = "Confirmation Indicator: ADX and DI Settings", inline = "AD2", tooltip = "Mid line on standard ADX and DI indicator. In this strategy the DI must be above this line for entry confirmation.")
// Absolute Strength Histogram
ashLength = input.int(9, "Period of Evaluation ", group = "Confirmation Indicator: Absolute Strength Histogram Settings", inline = "ASH1")
ashSmooth = input.int(6, "Period of Smoothing ", group = "Confirmation Indicator: Absolute Strength Histogram Settings", inline = "ASH2")
label.new(x = x, y = y, text = labelStr, color = pnl > 0 ? color.new(color.green, 60) : color.new(color.red, 60), textcolor = color.white, style = label.style_label_down)
printVerticalLine(col) => line.new(bar_index, close, bar_index, close * 1.01, extend = extend.both, color = col)
// ----------
// CONDITIONS
// ----------
inDateRange = true
// Condition 1: Coral Trend color matches trend direction (long=green, short=red)
isCoralBullish = bfr > nz(bfr[1])
isCoralBearish = bfr < nz(bfr[1])
// Condition 2: At least 1 candle completely above/below (long/short) Coral Trend since last cross above/below (long/short) Coral Trend (could potentially try also with only close above)