Krindler

Price Sandwich

For the script in question
This script acts as an indicator that a potential short term or long term trend reversal is coming. Note that not every candle can be used as an indication and the smaller ones tend to have little to no effect, however they can be used alongside orderblocks or future support/resistance areas.
The best timeframes I've found these to be useable are on the 1m, 2m, or second charts.
You may use this as an added confluence that a trend is ending either short term or long term.
You may also decide to use this with other indicators to build further confluence.
Note that this is just something I've noticed personally most likely does not apply to all trend reversals.
Some ideas on how to use it:
If you extend a rectangle out from the block itself, you can often find the next high or low overlaps with said rectangle.
They may also overlap with a fair value gap that could make that gap have more potential.

Hope this is of use and can help with that added confluence or early warning signal of a potential reversal. This should not be used alone and it's recommended to not use this as a surefire indication of whether to take a trade.//Krindler

Script Breakdown
//@version=5 // this makes the script v5 friendly
indicator("Price Sandwich", overlay=true) //makes this script an indicator, overlay=true to make it a part of the main chart

// User input for the highlight color
userColor = input(color.green, title="Highlight Color") //This allows you to choose what color you want the candle to be in the settings

//Function to check the custom candle pattern based on whether the candle is being englulfed by both preceding and latter candle.
isCustomPattern() => //let's me look for a custom candle pattern
high > high and high < high and low < low and low > low
//this checks the candle before and the candle after to check that the candle in the middle doesn't escape the range of the candle before, or the candle afters highs and lows thus making it a sandwiched candle.
//high > high and high < high and low < low and low > low basically says: candle 1 high must be greater than candle 2 high and candle 2 high must be less than candle 3 high and candle 1 low must be less than candle 2 low and candle 2 low must be greater than candle 3 low. Thus making sure that candle 2 is within the range of candle's 1 and 3 and doesn't have a high or low that is either above or below candle 1 and 3. 'and' is the operator to make sure that all of these values must be true in order for that candle to meet the criteria of getting colored.

// Apply bar color to Sandwiched candle if candle is found.
barcolor(isCustomPattern() ? userColor : na, offset=-1) //this targets the findings from isCustomPattern() and uses the user color chosen in settings and colors the middle bar by using offset=-1, otherwise it would color candle 3, so offset goes back 1 candle to color the middle candle.

If this script is already in circulation, please let me know and i'll remove it immediately. I checked but couldn't find one that did it.
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?