OPEN-SOURCE SCRIPT

Probability of Candle Close Higher Than Open

The "Probability of Candle Close Higher Than Open" indicator is designed to help traders assess the likelihood of a given candle closing higher than its open based on the previous candle's price action. It does this by calculating a probability score between 0 and 1 and displaying it on the chart, along with a horizontal line representing a user-defined probability threshold.

The indicator uses three input variables to determine the probability score:

lookback_period: This input defines the number of previous candles to consider when calculating the probability. By default, it is set to 2, meaning the indicator considers the previous two candles.

prev_high and prev_low: These variables are calculated using the highest() and lowest() functions, respectively, and represent the highest high and lowest low of the previous lookback_period candles.

prev_body: This variable calculates the absolute value of the difference between the open and close prices of the previous candle.

The probability score is then calculated based on the following conditions:

If the current candle's open price is higher than the previous lookback_period candles' highest high, the probability score is set to 0.1 (indicating a low probability of the candle closing higher than its open).

If the current candle's open price is lower than the previous lookback_period candles' lowest low, the probability score is set to 0.9 (indicating a high probability of the candle closing higher than its open).

If neither of the above conditions apply, the probability score is calculated using the following formula:

If the previous candle closed higher than its open, the probability score is set to 0.5 plus half of the previous candle's body (i.e., the absolute difference between its open and close prices).

If the previous candle closed lower than its open, the probability score is set to 0.1 plus half of the previous candle's body.

If the previous candle closed at the same price as its open, the probability score is set to 0.1.

Finally, the indicator plots the probability score as a label on the chart and a horizontal line representing the probability threshold.

Disclaimer:
Trading involves significant risk and is not suitable for all investors. The "Probability of Candle Close Higher Than Open" indicator is for informational purposes only and should not be used as the sole basis for making trading decisions. Always conduct your own research and due diligence before entering any trades. No guarantee or warranty is given as to the accuracy or completeness of the information provided by this indicator, and any reliance on this information is at your own risk. Past performance is not necessarily indicative of future results. Trading with margin carries the risk of losing more than your initial investment. Only trade with risk capital that you can afford to lose.
candleformationCandlestick analysisict

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


GH05T 1N TH3 MACH1N3
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm