OPEN-SOURCE SCRIPT

Prometheus Topological Persistent Entropy

已更新
Persistence Entropy falls under the branch of math topology. Topology is a study of shapes as they twist and contort. It can be useful in the context of markets to determine how volatile they may be and different from the past.

The key idea is to create a persistence diagram from these log return segments. The persistence diagram tracks the "birth" and "death" of price features:

A birth occurs when a new price pattern or feature emerges in the data.
A death occurs when that pattern disappears.

By comparing prices within each segment, the script tracks how long specific price features persist before they die out. The lifetime of each feature (difference between death and birth) represents how robust or fleeting the pattern is. Persistent price features tend to reflect stable trends, while shorter-lived features indicate volatility.

Entropy Calculation: The lifetimes of these patterns are then used to compute the entropy of the system. Entropy, in this case, measures the amount of disorder or randomness in the price movements. The more varied the lifetimes, the higher the entropy, indicating a more volatile market. If the price patterns exhibit longer, more consistent lifetimes, the entropy is lower, signaling a more stable market.

Calculation:

We start by getting log returns for a user defined look back value. In the compute_persistent_entropy function we separate the overall log returns into windows. We then compute persistence diagrams of the windows. It tracks the birth and death of price patterns to see how persistent they are. Then we calculate the entropy of the windows.

After we go through that process we get an array of entropies, we then smooth it by taking the sum of all of them and dividing it by how many we have so the indicator can function better.



快照

This image illustrates how the indicator works for traders. The purple line is the actual indicator value. The line that changes from green to red is a SMA of the indicator value, we use this to determine bullish or bearish. When the smoothed persistence entropy is above it’s SMA that signals bearishness.

快照

The indicator tends to look prettier on higher time frames, we see TSLA on a 4 hour here and below we see it on the 5 minute.

快照

On a lower time frame it looks a little weird but still functions the same way.

Prometheus encourages users to use indicators as tools along with their own discretion. No indicator is 100% accurate. We encourage comments about requested features and criticism.
版本注释
Fixed the red and green coloring; was backwards.
Chart patternsCycles

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?


更多:

免责声明