OPEN-SOURCE SCRIPT

Previous Day High and Low Count with Probabilities

Telah dikemas kini


Indicator Explanation

This indicator displays the number of days on which the previous day's high or low prices were not reached and calculates probabilities for future price movements based on this information. It stores the high and low values of the last 45 days and checks daily whether these levels were touched. Based on the number of days without touching either the high or the low, the indicator calculates the probability of future price movements in either direction (Up or Down).

The indicator offers customization options for label placement and color on the chart. The counts for the high and low touches, along with the calculated probabilities (in percentages), are displayed as labels on the chart. These labels can be shifted along the X-axis by up to 50 bars and can be customized in color and size. Additionally, the text for the labels can be freely chosen, giving the user improved flexibility and overview.

In summary, this indicator helps to:
- Track how often previous day's high and low levels were not reached.
- Estimate probabilities for future price movements based on this information.
- Customize the chart display for easier interpretation.

Strategy Concept
Probability and Touch Conditions:
A long position is entered only if:

The probability of reaching the high is at least 60%.
The price has not touched the previous day’s high in the last three days.
Similarly, for short positions:

The probability of reaching the low is at least 60%.
The price has not touched the previous day’s low in the last three days.
Incremental Position Size Increase:
On the 3rd consecutive day without a high/low touch and with the probability condition met, an initial position of 0.01 lots is opened.
On the 4th day, an additional position of 0.01 lots is added.
On the 5th day, an extra position of 0.02 lots is opened.
After a two-day pause, the situation is re-evaluated, and if conditions are still met, a 0.04-lot position is considered.
Trend Reversal Detection:
The strategy also includes a simple trend reversal check. If the market shows clear reversal signals, no new positions will be opened.

Adjustments and Risk Management
This strategy can be adjusted by modifying the probability values, the number of days without a high/low touch, and the lot sizes. Additionally, stop-loss and take-profit levels can be added to further control the risk and secure profits.

Strategy Concept
Probability and Touch Conditions:
A long position is entered only if:

The probability of reaching the high is at least 60%.
The price has not touched the previous day’s high in the last three days.
Similarly, for short positions:

The probability of reaching the low is at least 60%.
The price has not touched the previous day’s low in the last three days.
Incremental Position Size Increase:
On the 3rd consecutive day without a high/low touch and with the probability condition met, an initial position of 0.01 lots is opened.
On the 4th day, an additional position of 0.01 lots is added.
On the 5th day, an extra position of 0.02 lots is opened.
After a two-day pause, the situation is re-evaluated, and if conditions are still met, a 0.04-lot position is considered.
Trend Reversal Detection:
The strategy also includes a simple trend reversal check. If the market shows clear reversal signals, no new positions will be opened.

Risk Disclaimer
The author of this strategy does not assume any liability for potential losses or gains that may arise from the use of this strategy. Trading involves significant risk, and it is important to only trade with capital that you can afford to lose. The strategy presented is for educational purposes only and should not be considered as financial advice. Always conduct your own research and consider seeking advice from a professional financial advisor before making any trading decisions.
Nota Keluaran








Indicator Explanation

This indicator displays the number of days on which the previous day's high or low prices were not reached and calculates probabilities for future price movements based on this information. It stores the high and low values of the last 45 days and checks daily whether these levels were touched. Based on the number of days without touching either the high or the low, the indicator calculates the probability of future price movements in either direction (Up or Down).

The indicator offers customization options for label placement and color on the chart. The counts for the high and low touches, along with the calculated probabilities (in percentages), are displayed as labels on the chart. These labels can be shifted along the X-axis by up to 50 bars and can be customized in color and size. Additionally, the text for the labels can be freely chosen, giving the user improved flexibility and overview.

In summary, this indicator helps to:
- Track how often previous day's high and low levels were not reached.
- Estimate probabilities for future price movements based on this information.
- Customize the chart display for easier interpretation.

Strategy Concept
Probability and Touch Conditions:
A long position is entered only if:

The probability of reaching the high is at least 60%.
The price has not touched the previous day’s high in the last three days.
Similarly, for short positions:

The probability of reaching the low is at least 60%.
The price has not touched the previous day’s low in the last three days.
Incremental Position Size Increase:
On the 3rd consecutive day without a high/low touch and with the probability condition met, an initial position of 0.01 lots is opened.
On the 4th day, an additional position of 0.01 lots is added.
On the 5th day, an extra position of 0.02 lots is opened.
After a two-day pause, the situation is re-evaluated, and if conditions are still met, a 0.04-lot position is considered.
Trend Reversal Detection:
The strategy also includes a simple trend reversal check. If the market shows clear reversal signals, no new positions will be opened.

Adjustments and Risk Management
This strategy can be adjusted by modifying the probability values, the number of days without a high/low touch, and the lot sizes. Additionally, stop-loss and take-profit levels can be added to further control the risk and secure profits.

Strategy Concept
Probability and Touch Conditions:
A long position is entered only if:

The probability of reaching the high is at least 60%.
The price has not touched the previous day’s high in the last three days.
Similarly, for short positions:

The probability of reaching the low is at least 60%.
The price has not touched the previous day’s low in the last three days.
Incremental Position Size Increase:
On the 3rd consecutive day without a high/low touch and with the probability condition met, an initial position of 0.01 lots is opened.
On the 4th day, an additional position of 0.01 lots is added.
On the 5th day, an extra position of 0.02 lots is opened.
After a two-day pause, the situation is re-evaluated, and if conditions are still met, a 0.04-lot position is considered.
Trend Reversal Detection:
The strategy also includes a simple trend reversal check. If the market shows clear reversal signals, no new positions will be opened.

Risk Disclaimer
The author of this strategy does not assume any liability for potential losses or gains that may arise from the use of this strategy. Trading involves significant risk, and it is important to only trade with capital that you can afford to lose. The strategy presented is for educational purposes only and should not be considered as financial advice. Always conduct your own research and consider seeking advice from a professional financial advisor before making any trading decisions.








Update 12.11.2024
Summary of bug fixes and improvements:
The counter logic has been improved by correctly using highTouched and lowTouched so that the counter is only incremented if the previous day's high or low is not touched.
The label initialization and update has been adjusted to fix the previous bugs and display the labels correctly in the chart.
User customizations for label colors, positions and font sizes have been added to improve the visualization.
These changes and enhancements ensure that the script works correctly and is user-friendly and customizable!
Candlestick analysisChart patternsCycles

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian