INVITE-ONLY SCRIPT
Historical Similarities

Happy trading! This tool provides short-term trend estimations. It is a further evolution of my earlier ANN Trend Prediction indicator, but it uses a completely new feature-vector composition and a different type of neural network.
1. Concept
The underlying idea is that history tends to repeat—not exactly, but with recognizable similarities. When recent market conditions resemble past situations, it is reasonable to assume that price may behave similarly again. That is the foundation of this indicator.
In the image below, you can see the general setup. The most recent bar (the “now” point) separates the past from the future. A sequence of recent bars is interpreted as a pattern and fed into a pre-trained LSTM network, which then produces the prediction for the current bar.

The focus of this tool is to deliver predictions as early as possible—ideally just before a trend reversal—to support short-term trades lasting approximately 5 to 20 bars. While perfect early detection is not reached here, this indicator often identifies reversals within one bar after they occur, which is usually early enough to capture meaningful moves.
There are other indicators capable of signaling trend reversals within a single bar—such as Shooting Star or Hammer candle patterns, or certain indicator setups. They were effective when they were new, but widespread use has reduced their reliability, and sometimes those patterns simply do not appear or appear without trend reversal.
This tool, by contrast, is new and it successfully identifies many trend reversals, as demonstrated in the image below:

2. Experimental Part
Furthermore, because this approach offers multiple settings that influence its behavior, you can configure it to focus on larger trends and ignore smaller fluctuations. The following images show several examples:
The default settings
with only-Body Smoothing enabled
with Generalized Trends enabled
with both Smoothing enabled
However, as you may notice, when targeting larger trends, a number of false-negative predictions may also appear. These still need to be filtered out. Please keep in mind that this version is experimental, requiring further investigation and research, and I would appreciate any feedback or suggestions.
3. Results
The prediction output is shown through a label and background colors as shown in the following image. It provides probabilities for three market directions:

When the model cannot confidently classify the current market conditions, it deliberately withholds a prediction and leaves the background uncolored. In most cases, however, it displays a label with all three probabilities whenever a new dominant prediction emerges, and it remains visible until the next dominant signal appears.
4. Conclusion
In its default settings, this indicator is quite capable when short-term trends last at least five or more bars. A support-and-resistance indicator can be helpful for setting take-profit and stop-loss levels.
5. Settings Menu
The script is delivered with its default settings, all turned off. However, several configuration options are available:
Input Preparation
Filters
6. Alert Signals Available
Trend Signal
Signal Age - counts the number of bars since last change
7. Declaration for TradingView House Rules on Script Publishing
The unique feature of the Historical Similarities Indicator is it's nearby real-time detection capability for up trends, down trends and side way price action in most cases.
This script is closed-source and invite-only, to support and compensate for years of development work.
8. Disclaimer
Trading involves risk, and losses can and do occur. This script is intended for informational and educational purposes only. All examples are hypothetical and not financial advice.
Decisions to buy, sell, hold, or trade securities, commodities, or other assets should be based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Use this script at your own risk. It may contain bugs, and I cannot be held responsible for any financial losses resulting from its use.
Cheers!
1. Concept
The underlying idea is that history tends to repeat—not exactly, but with recognizable similarities. When recent market conditions resemble past situations, it is reasonable to assume that price may behave similarly again. That is the foundation of this indicator.
In the image below, you can see the general setup. The most recent bar (the “now” point) separates the past from the future. A sequence of recent bars is interpreted as a pattern and fed into a pre-trained LSTM network, which then produces the prediction for the current bar.
The focus of this tool is to deliver predictions as early as possible—ideally just before a trend reversal—to support short-term trades lasting approximately 5 to 20 bars. While perfect early detection is not reached here, this indicator often identifies reversals within one bar after they occur, which is usually early enough to capture meaningful moves.
There are other indicators capable of signaling trend reversals within a single bar—such as Shooting Star or Hammer candle patterns, or certain indicator setups. They were effective when they were new, but widespread use has reduced their reliability, and sometimes those patterns simply do not appear or appear without trend reversal.
This tool, by contrast, is new and it successfully identifies many trend reversals, as demonstrated in the image below:
2. Experimental Part
Furthermore, because this approach offers multiple settings that influence its behavior, you can configure it to focus on larger trends and ignore smaller fluctuations. The following images show several examples:
However, as you may notice, when targeting larger trends, a number of false-negative predictions may also appear. These still need to be filtered out. Please keep in mind that this version is experimental, requiring further investigation and research, and I would appreciate any feedback or suggestions.
3. Results
The prediction output is shown through a label and background colors as shown in the following image. It provides probabilities for three market directions:
- Up - green
- Sideways - blue
- Down - red
When the model cannot confidently classify the current market conditions, it deliberately withholds a prediction and leaves the background uncolored. In most cases, however, it displays a label with all three probabilities whenever a new dominant prediction emerges, and it remains visible until the next dominant signal appears.
4. Conclusion
In its default settings, this indicator is quite capable when short-term trends last at least five or more bars. A support-and-resistance indicator can be helpful for setting take-profit and stop-loss levels.
5. Settings Menu
The script is delivered with its default settings, all turned off. However, several configuration options are available:
Input Preparation
Smoothing – Using Heikin Ashi or using only Bar Body are two methods that help remove outliers from the incoming bars.
Generalize Trends – Merges nearby trends together and removes smaller, insignificant trends.
Generalize Patterns – Checks the incoming pattern for artifacts and reduces it when possible. This is a trade-off between removing noise and keeping meaningful features.
Shifting – Examines the incoming pattern for consistency and adjusts it when reasonable.
Speed – Determines how quickly a prediction is calculated. A longer calculation time can improve accuracy, but may also risk the script timing out.
Filters
Intrabar – Off by default, allowing new dominant predictions only at bar close. When enabled, predictions may also be updated intrabar, but this introduces repainting on the current open bar.
Start of Classification – Sets the date from which classifications may begin.
Minimum Gains After Pattern – Defines how much price must rise or fall for a pattern to be considered an up, down, or sideways pattern.
Minimum Classification Probability – If the highest probability is below this threshold, no prediction is selected and the background stays translucent. If one probability exceeds the threshold, the largest one is chosen as the prediction.
Minimum Pattern Strength – Removes patterns whose strength is below this threshold.
6. Alert Signals Available
Trend Signal
- 2 = possible High
- 1 = Uptrend
- 0 = Ranging
- -1 = Downtrend
- -2 = possible Low
- na = no prediction
Signal Age - counts the number of bars since last change
7. Declaration for TradingView House Rules on Script Publishing
The unique feature of the Historical Similarities Indicator is it's nearby real-time detection capability for up trends, down trends and side way price action in most cases.
This script is closed-source and invite-only, to support and compensate for years of development work.
8. Disclaimer
Trading involves risk, and losses can and do occur. This script is intended for informational and educational purposes only. All examples are hypothetical and not financial advice.
Decisions to buy, sell, hold, or trade securities, commodities, or other assets should be based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Use this script at your own risk. It may contain bugs, and I cannot be held responsible for any financial losses resulting from its use.
Cheers!
僅限邀請腳本
僅作者批准的使用者才能訪問此腳本。您需要申請並獲得使用許可,通常需在付款後才能取得。更多詳情,請依照作者以下的指示操作,或直接聯絡BerlinCode42。
TradingView不建議在未完全信任作者並了解其運作方式的情況下購買或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
You can get access to this Script for 40$ per month or 440$ per year. Just write me a message here on TradingView. Free trials possible.
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
僅限邀請腳本
僅作者批准的使用者才能訪問此腳本。您需要申請並獲得使用許可,通常需在付款後才能取得。更多詳情,請依照作者以下的指示操作,或直接聯絡BerlinCode42。
TradingView不建議在未完全信任作者並了解其運作方式的情況下購買或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
You can get access to this Script for 40$ per month or 440$ per year. Just write me a message here on TradingView. Free trials possible.
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。