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.
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?