本帖最后由 360 于 2024-10-30 22:45 编辑
indicator("N Bar Reversal Detector [LuxAlgo]", 'LuxAlgo - N Bar Reversal Detector', true, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500)
//---------------------------------------------------------------------------------------------------------------------
// Settings
//---------------------------------------------------------------------------------------------------------------------{
display = display.all - display.status_line
brpGroup = 'Pattern Detection'
brpTypeTT = 'Selects the type of reversal pattern to detect:\n\n' +
' *Normal: Detects standard reversal patterns based on the high and low prices of the sequence.\n\n' +
' *Enhanced: Detects advanced reversal patterns where the most recent closing price must exceed or fall below the high or low of the first candle.\n\n' +
' *All: Includes both normal and enhanced patterns.'
brpType = input.string("All", "Pattern Type", options = ["Normal", "Enhanced", "All"], group = brpGroup, display = display, tooltip = brpTypeTT)
numBarsTT = 'Specifies the number of candles in the sequence used to identify a reversal pattern. The length N includes the initial N-1 candles plus the most recent candle (Nth) for pattern detection.'
numBars = input.int(7, 'Reversal Pattern Sequence Length', minval = 2, group = brpGroup, display = display, tooltip = numBarsTT)
minBrasTT = 'Sets the minimum percentage of the first N-1 candles that must be bullish (for a bearish reversal) or bearish (for a bullish reversal) to qualify as a valid reversal pattern. This setting helps adjust the sensitivity of the pattern detection.'
minBars = input.int(50, 'Min Percentage of Required Candles', minval = 0, maxval = 100, group = brpGroup, display = display, tooltip = minBrasTT) / 100
brpSRTT = 'Shows horizontal support and resistance lines based on the highest high or lowest low of the pattern'
brpSR = input.string("Level", "Derived Support and Resistance", options = ["Level", "None"], group = brpGroup, display = display, tooltip = brpSRTT)
brpAC = input.color(#089981, 'Bullish Reversal Patterns', group = brpGroup)
brpSC = input.color(#f23645, 'Bearish Reversal Patterns', group = brpGroup)
trendIndiGroup = 'Trend Filtering'
trendTT = 'Selects the trend filtering method for detecting reversal patterns and specifies the alignment with the trend.'
trendType = input.string("None", "Filtering", options = ["Moving Average Cloud", "Supertrend", "Donchian Channels", "None"], group = trendIndiGroup, inline = 'flt', display = display, tooltip = trendTT)
trendFilt = input.string("Aligned", "", options = ["Aligned", "Opposite"], group = trendIndiGroup, inline = 'flt', display = display)
trendAC = input.color(#089981, 'Bullish Trend', inline = 'trnd')
trendSC = input.color(#f23645, ' Bearish Trend', inline = 'trnd')
ma_Group = 'Moving Average Settings'
maType = input.string("HMA", "Type", options = ["SMA", "EMA", "HMA", "RMA", "WMA", "VWMA"], group = ma_Group, display = display)
maFLength = input.int(50, 'Fast Length', minval = 1, maxval = 100, group = ma_Group, display = display)
maSLength = input.int(200, 'Slow Length', minval = 100, group = ma_Group, display = display)
st_Group = 'Supertrend Settings'
atrPeriod = input.int(10, 'ATR Length', minval=1, group = st_Group, display = display)
factor = input.float(3, 'Factor', minval = 2, step = 0.1, group = st_Group, display = display)
dc_Group = 'Donchian Channel Settings'
length = input.int(13, 'Length', minval = 1, group = dc_Group, display = display)
|