Bernoulli Process - Binary Entropy Function

This indicator is the Bernoulli Process or Wikipedia - Binary Entropy Function. Within Information Theory, Entropy is the measure of available information, here we use a binary variable 0 or 1 (P) and (1-P) (Bernoulli Function/Distribution), and combined with the Shannon Entropy measurement. As you can see below, it produces some wonderful charts and signals, using price, volume , or both summed together. The chart below shows you a couple of options and some critical details on the indicator. The best part about this is the simplicity, all of this information in a couple of lines of code.

Using the indicator:
The longer the Entropy measurement the more information you are capturing, so the analogy is, the shorter the signal, the less information you have available to utilize. You'll run into your Nyquist frequencies below a length of 5. I've found values between 9 and 22 work well to gather enough measurements. You also have an averaging summation that measures the weight or importance of the information over the summation period. This is also used for highlighting when you have an information signal above the 5% level (2 sigma) and then can be adjusted using the Percent Rank Variable. Finally, you can plot the individual signals (Price or Volume ) to get another set of measurements to utilize. As can be seen in the chart below, the volume moves before price (but hopefully you already knew that)

At its core, this is taking the Binary Entropy measurement (using a Bernoulli distribution) for price and volume . I've subtracted the volume from the price so that you can use it like a MACD , also for shorter time frames (7, 9, 11) you can get divergences on the histogram. These divergences are primarily due to the weekly nature of the markets (5 days, 10 days is two weeks,...so 9 is measuring the last day of the past two weeks...so 11 is measuring the current day and the past two weeks).

Here are a couple of other examples, assuming you just love BTC , Stocks, or FOREX. I fashioned up a strategy to show the potential of the indicator.

Stock-Strategy (#loveyouNFLX)

FOREX - (for everyone hopped up on 40X leverage)
Phát hành các Ghi chú: Added a shoutout to @Picte for his inspiring idea
Phát hành các Ghi chú: Added Alerts for Up/Down Triangle Start
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích

Bình luận

This publication will be featured in our "Best Scripts of The Month" selection. Thank you for your valuable contribution to the TradingView community, and congrats!
+7 Phản hồi
kocurekc PineCoders
@PineCoders, Wow, awesome! #thanksfortheLove
Phản hồi
+7 Phản hồi
kentskip anantgupta970
@anantgupta970, I am not getting the arrow signals either.
Phản hồi
kocurekc kentskip
@kentskip, @anantgupta970 Thanks for the comments. This is just an indicator and not a strategy which gives you buy and sell signals. You can take this code and turn it into a Tradingview strategy.

You could also add this code to paint bars for a set of rules:
BarColors = input(title="Painting bars", type=input.bool, defval=true)
signal = sma(info2,3)
nColor = BarColors ? signal > 0 and signal >= range ? color.green : signal < 0 and signal <= -range ? color.red : color.blue : na

+1 Phản hồi
Đã xóa bình luận.
balipour balipour
@balipour, btw i dont mean its a smooth indicator lol. its just some smooth line. The hvp part is great though.
Phản hồi
kocurekc balipour
@balipour, thank you very much for your comments, you have made some wonderful contributions to the Tradingview community.
Phản hồi
balipour kocurekc
@kocurekc thanks for the kind words and thank you for publishing your indicators and introducing the concept of entropy to the community. However, as we discussed, entropy as a measure of uncertainty or in broader definition as variability in a distribution can't be a direct product of price because otherwise entropy can only drop if price decreases and rise when price increases. Taking src/sum(src,len) as input isn't uncommon but it doesn't really represent anything related to probabilities of the occurrences or "all possible outcomes" for the variable, here being price. Also, if the variability of the distribution being measured is price, then the distribution and its entropy should be of a log normal distribution. The probabilities of the occurrence in price are based on probability density function of returns and its "safe" to assume returns are normally distributed. problems with that assumption are a different story. Looking forward to your update. Good luck.
Phản hồi
Hi there! This indicator is hitting over 80% at the BTC 1hr for me.
Is there a way I can set alerts for the green and red triangles?
+2 Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Cách thức hoạt động Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Xu Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất