bharath_kaipparedan

tlc with False Breakout

The strategy aims to identify a trend line channel with the potential for a false breakout. Here's an explanation of the strategy:

The script starts by defining the input parameters. The lookback parameter determines the number of previous bars to consider for detecting the trend lines, and the threshold parameter controls the sensitivity of the trend line detection.

The script then initializes variables to store the trend lines, tap count, and the false breakout signal.

Inside the loop, the script iterates over the specified number of bars (lookback) to identify the trend lines. It checks if the current high is greater than the previous and next highs to identify an upper trend line and sets it using the line.new function. Similarly, it checks if the current low is smaller than the previous and next lows to identify a lower trend line and sets it.

The script also keeps track of the price levels of the upper and lower trend lines using the variables upperTrendLinePrice and lowerTrendLinePrice. These price levels are obtained using the line.get_y1 function.

After the fourth tap (when tapCount is equal to 4), the script checks if the current close price is above the upper trend line or below the lower trend line. If this condition is met, it sets the falseBreakout variable to true, indicating a potential false breakout.

Finally, the script plots a shape marker (plotshape) when a false breakout occurs. This is represented by an orange label displayed below the bar.

At the end of the script, the line.delete function is used to remove the old trend lines when the script reaches the last bar (barstate.islast).

By using this strategy, you can visually identify trend line channels where the upper and lower lines touch higher highs or lower highs and higher lows or lower lows. Additionally, it provides a false breakout signal when the price breaks above the upper trend line or below the lower trend line on the fifth tap.
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 đồ?