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.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?