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)
릴리즈 노트: Added a shoutout to @Picte for his inspiring idea
릴리즈 노트: Added Alerts for Up/Down Triangle Start
즐겨찾기 스크립트에서 빼기 즐겨찾기 스크립트에 넣기


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 응답
kocurekc PineCoders
@PineCoders, Wow, awesome! #thanksfortheLove
+7 응답
kentskip anantgupta970
@anantgupta970, I am not getting the arrow signals either.
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

코멘트 지워졌음
balipour balipour
@balipour, btw i dont mean its a smooth indicator lol. its just some smooth line. The hvp part is great though.
kocurekc balipour
@balipour, thank you very much for your comments, you have made some wonderful contributions to the Tradingview community.
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.
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?
+1 응답
홈으로 스탁 스크리너 포렉스 스크리너 크립토 스크리너 이코노믹 캘린더 사용안내 차트 특징 프라이싱 프렌드 리퍼하기 하우스룰(내부규정) 헬프 센터 웹사이트 & 브로커 솔루션 위젯 차팅 솔루션 라이트웨이트 차팅 라이브러리 블로그 & 뉴스 트위터
프로화일 프로화일설정 계정 및 빌링 리퍼드 프렌즈 코인 나의 서포트 티켓 헬프 센터 공개아이디어 팔로어 팔로잉 비밀메시지 채팅 로그아웃