Tworzy się INSIDEBAR Następuje wybicie FAKE INSIBAR I teraz jeśli : - FAKE INSIBAR przebije INSIBARA to jest wejscie - FAKE INSIBAR zamknie się wewnątrz INSIDBARA i nastepna świeca przebije FAKE INSIBARA ALERTY SA NATYCHMIAST PO SPEŁNIENIU WARUNKÓW TEN WSKAŹNIK MA DWA RODZAJE STRZAŁKE CIEMNIEJSZA KTÓRA POKAZUJE ZE ZACZYNA SIE TWORZYC FAKEINSIBAR I JASNIEJSZA KTÓRA POKAZUJE KONKRETNE TE DWA WARUNKI I TRZEBA TO DOPRECYZOWAĆ I ZROBIĆ ABY IDEALNIE POKAZYWAŁO WEJSCIA Ciemniejsza strzalka tworzy sie kiedy jest Fake Insibar i daje alert kiedy powstaje ale jak nie spełni jednego z warunków czyli przebije insida lub zamknie sie wewnątrz insibara to wtedy strzalka znika. tA jaśniejsza ona może być tak samo ciemna tylko żeby można było zminic jej kolor. zrobisz jak uważasz dla mnie najważniejsze aby alerty działały w tradingview bo to jest najważniejsze. //@version=6 indicator('Inside Bar Patterns (Reversal + Engulfing + Gaps)', overlay = true, max_bars_back = 5000) // --- Inputs for Plotting & Arrows --- plot_group = 'Plotting & Arrows' arrow_size_str = input.string('normal', 'Arrow Size', options = ['tiny', 'small', 'normal', 'large', 'huge'], group = plot_group) Buy_Arrow_Color = input.color(color.blue, 'Buy Arrow Color', group = plot_group) Sell_Arrow_Color = input.color(color.red, 'Sell Arrow Color', group = plot_group) // --- Core Pattern Detection --- // Bar[2] is the mother bar. // Bar[1] is the inside bar. // The current bar (bar[0]) is the potential signal bar. // 1. Check if the previous bar was an inside bar. is_inside = high[1] < high[2] and low[1] > low[2] // --- PATTERN #1: False Breakout (Closes back INSIDE the Inside Bar) --- // 2a. Check for a breakout in only ONE direction on the current bar. false_break_down_only = low < low[1] and high <= high[1] false_break_up_only = high > high[1] and low >= low[1] // 3a. Check if the current bar closes back inside the range of the inside bar. is_close_inside = close < high[1] and close > low[1] // Signal for Pattern #1 buy_signal_reversal = is_inside and is_close_inside and false_break_down_only sell_signal_reversal = is_inside and is_close_inside and false_break_up_only // --- PATTERN #2: Engulfing Reversal (Closes OUTSIDE the OPPOSITE side) --- // 2b. Check if the current bar breaks one side... break_low = low < low[1] break_high = high > high[1] // 3b. ...and closes outside the opposite side. close_above_high = close > high[1] close_below_low = close < low[1] // Signal for Pattern #2 buy_signal_engulf = is_inside and break_low and close_above_high sell_signal_engulf = is_inside and break_high and close_below_low // --- PATTERN #3: Gap & Go (Breaks out with a Price Gap) --- // 3c. Check if the current bar gaps completely above or below the inside bar. gap_up = low > high[1] // The bar's low is higher than the inside bar's high. gap_down = high < low[1] // The bar's high is lower than the inside bar's low. // Optional: Add a confirmation that the bar is moving in the gap's direction. is_bullish_bar = close > open is_bearish_bar = close < open // Signal for Pattern #3 buy_signal_gap = is_inside and gap_up and is_bullish_bar sell_signal_gap = is_inside and gap_down and is_bearish_bar // --- FINAL Signals (Combine ALL Three Patterns) --- // A final signal is triggered if ANY of the three patterns are true. buy_signal = buy_signal_reversal or buy_signal_engulf or buy_signal_gap sell_signal = sell_signal_reversal or sell_signal_engulf or sell_signal_gap // --- NEW: Custom Alert Logic --- // Alert Scenario 1: An arrow appears (covered by 'buy_signal' and 'sell_signal'). // Alert Scenario 2: The candle AFTER a "false breakout" breaks the high/low of that "false breakout" bar. // First, we check if the PREVIOUS bar was a "false breakout reversal" signal. was_buy_reversal_setup = buy_signal_reversal[1] was_sell_reversal_setup = sell_signal_reversal[1] // Second, we check if the CURRENT bar breaks the high of that previous buy setup bar, or the low of the sell setup bar. break_of_buy_setup_high = high > high[1] break_of_sell_setup_low = low < low[1] // Now, we create the trigger for Alert Scenario 2. alert_buy_scenario_2 = was_buy_reversal_setup and break_of_buy_setup_high alert_sell_scenario_2 = was_sell_reversal_setup and break_of_sell_setup_low // --- FINAL Alert Triggers --- // A final alert is triggered if EITHER the original arrow condition OR the new confirmation break is met. final_buy_alert = buy_signal or alert_buy_scenario_2 final_sell_alert = sell_signal or alert_sell_scenario_2 // --- STRICT alerts: only after full confirmation (Option A) --- // require bar close to avoid mid-bar/probable triggers strict_buy_alert = alert_buy_scenario_2 and barstate.isconfirmed strict_sell_alert = alert_sell_scenario_2 and barstate.isconfirmed // Register strict alertconditions alertcondition(strict_buy_alert, title = 'Strict Buy Alert', message = 'Strict Buy: fake-inside confirmed + breakout (bar close)') alertcondition(strict_sell_alert, title = 'Strict Sell Alert', message = 'Strict Sell: fake-inside confirmed + breakout (bar close)') // Plot markers for strict alerts so you can visually verify them plotshape(series = strict_buy_alert, title = 'Strict Buy Marker', style = shape.triangleup, location = location.belowbar, color = color.new(Buy_Arrow_Color, 50), size = size.small) plotshape(series = strict_sell_alert, title = 'Strict Sell Marker', style = shape.triangledown, location = location.abovebar, color = color.new(Sell_Arrow_Color, 50), size = size.small) // --- Plotting --- // BUY arrows (one plotshape per size) plotshape(series = buy_signal and arrow_size_str == 'tiny', title = 'Buy Arrow (tiny)', style = shape.triangleup, location = location.belowbar, color = Buy_Arrow_Color, size = size.tiny) plotshape(series = buy_signal and arrow_size_str == 'small', title = 'Buy Arrow (small)', style = shape.triangleup, location = location.belowbar, color = Buy_Arrow_Color, size = size.small) plotshape(series = buy_signal and arrow_size_str == 'normal', title = 'Buy Arrow (normal)', style = shape.triangleup, location = location.belowbar, color = Buy_Arrow_Color, size = size.normal) plotshape(series = buy_signal and arrow_size_str == 'large', title = 'Buy Arrow (large)', style = shape.triangleup, location = location.belowbar, color = Buy_Arrow_Color, size = size.large) plotshape(series = buy_signal and arrow_size_str == 'huge', title = 'Buy Arrow (huge)', style = shape.triangleup, location = location.belowbar, color = Buy_Arrow_Color, size = size.huge) // SELL arrows (one plotshape per size) plotshape(series = sell_signal and arrow_size_str == 'tiny', title = 'Sell Arrow (tiny)', style = shape.triangledown, location = location.abovebar, color = Sell_Arrow_Color, size = size.tiny) plotshape(series = sell_signal and arrow_size_str == 'small', title = 'Sell Arrow (small)', style = shape.triangledown, location = location.abovebar, color = Sell_Arrow_Color, size = size.small) plotshape(series = sell_signal and arrow_size_str == 'normal', title = 'Sell Arrow (normal)', style = shape.triangledown, location = location.abovebar, color = Sell_Arrow_Color, size = size.normal) plotshape(series = sell_signal and arrow_size_str == 'large', title = 'Sell Arrow (large)', style = shape.triangledown, location = location.abovebar, color = Sell_Arrow_Color, size = size.large) plotshape(series = sell_signal and arrow_size_str == 'huge', title = 'Sell Arrow (huge)', style = shape.triangledown, location = location.abovebar, color = Sell_Arrow_Color, size = size.huge) // --- Alerts --- alertcondition(final_buy_alert, title = 'Custom Buy Alert', message = 'Custom Buy Signal: Inside Bar Break or Confirmation') alertcondition(final_sell_alert, title = 'Custom Sell Alert', message = 'Custom Sell Signal: Inside Bar Break or Confirmation') alertcondition(buy_signal, title = 'Arrow Buy Alert (Original)', message = 'Buy Signal: Arrow Appeared') alertcondition(sell_signal, title = 'Arrow Sell Alert (Original)', message = 'Sell Signal: Arrow Appeared') alertcondition(buy_signal or sell_signal, title = 'Any Arrow Alert (Original)', message = 'Any Signal: Arrow Appeared')