SimpleCryptoLife

Williams Fractal Trailing Stops

SimpleCryptoLife Cập nhật   
Unlike the built-in version, you can configure how many bars it takes to confirm a fractal. This indicator plots all Williams high and low fractals, and a stop line that trails the fractals up and down. Includes long and short stop alerts. You can choose whether the trail flips long-short based on the price being exceeded within a candle or on candle close. This indicator deals only with fractals and doesn't get into the Alligator or anything else.
I've commented it extensively, so that it might be useful for people learning Pinescript. Enjoy!
Phát hành các Ghi chú:
Removed a stray unnecessary input to the f_flip function.
Added comment to f_trail function to make it more portable.
Phát hành các Ghi chú:
Fixed description of the _longTrail and _shortTrail variables.
Fixed edge cases where a wick causes us to try to flip both long and short.
Phát hành các Ghi chú:
Small fix to display the current stop price at the level of the stop itself, not just under or above the bar.
Phát hành các Ghi chú:
NEW FEATURE: This is a major change to how the indicator works. Previously, the Williams Range field covered the entire range. So for example, if the range was 5, it would look 2 candles before the current one and 2 ahead, for 5 in total (including the current one). The assumption was that the current candle would always be in the middle of the range.
Now, you can specify different periods to look back and forwards. To replicate the old behaviour, just make sure the values are the same.
Why would you choose different values? It depends on what you want to achieve.
For example, maybe you want faster confirmation of a fractal, in which case you could lower the forward range.
If you wanted to find a point of interest within a fairly consistent trend that ends in a consolidation, you might lower the backwards period but keep a reasonably long forward period.

Other minor changes: Updated inputs for new group and tooltip options. The descriptions of the settings are no longer in the script comments but in the tooltips for each setting.
Rewrote the function for testing for fractals and fixed a bug where it was confirming a fractal incorrectly.
Phát hành các Ghi chú:
Minor improvement: Suppress fractals if the previous bar was a fractal. This will take care of the edge case where you have two bars closing at the exact same price in a row (which can happen at very low timeframes). If you have many bars closing at the exact same price you will still see repeated fractals, but I think that's ok.

NOTE: The last major change, to allow different lookback and look-forward values, somehow fixed an unnoticed issue where the old version was not always confirming the correct fractals. Now it works as intended. You can add on the standard TradingView Williams Fractals indicator and compare. For example, 2 forward and 2 backward on this version is equivalent to a range of 2 on the TradingView built-in indicator. You should see the same fractals confirmed.
Phát hành các Ghi chú:
Added alerts for when Williams Highs and Lows are confirmed. PLEASE NOTE: You should set this to fire on close. The number of bars that elapse before the High or Low is confirmed depends on the range you set in the settings.

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 đồ?