# Bernoulli Process - Binary Entropy Function

7399 뷰
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.
BTC-Strategy

Stock-Strategy (#loveyouNFLX)

FOREX - (for everyone hopped up on 40X leverage)
릴리즈 노트: Added a shoutout to @Picte for his inspiring idea

## 코멘트

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!
응답
PineCoders
@PineCoders, Wow, awesome! #thanksfortheLove
응답
I AM NOT GETTING SIGNALS ON PRICE CHART ?
응답
anantgupta970
@anantgupta970, I am not getting the arrow signals either.
응답
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
barcolor(nColor)

응답
코멘트 지워졌음
balipour
@balipour, btw i dont mean its a smooth indicator lol. its just some smooth line. The hvp part is great though.
응답
balipour