Overview: The PTI is a custom indicator designed to provide buy and sell signals based on price movements and volatility. It uses the Average True Range (ATR) to calculate stop levels and identifies potential trend changes.
Parameters: The indicator has several customizable parameters that you can adjust according to your preferences. These parameters include: - ATR Period (length): Determines the lookback period for calculating the ATR. - ATR Multiplier (mult): Specifies the multiplier applied to the ATR to determine the stop levels. - Show Buy/Sell Labels (showLabels): Allows you to choose whether to display buy/sell labels on the chart. - Use Close Price for Extremums (useClose): Determines whether the indicator considers the close price for calculating extremums. - Highlight State (highlightState): Enables highlighting of the long and short state on the chart.
Calculation: 1. ATR Calculation: The indicator calculates the Average True Range (ATR) using the specified length parameter and multiplies it by the ATR Multiplier (mult) to obtain the ATR value.
2. Long Stop Calculation: The long stop level is calculated based on the highest price over the specified length period (using either the high or close price, depending on the useClose parameter) minus the ATR value. It ensures that the long stop is below the recent highest point.
3. Short Stop Calculation: The short stop level is calculated based on the lowest price over the specified length period (using either the low or close price) plus the ATR value. It ensures that the short stop is above the recent lowest point.
4. Direction Calculation: The indicator determines the current direction based on the close price compared to the previous long stop and short stop levels. If the close price is above the previous long stop, the direction is set to 1 (indicating a bullish trend). If the close price is below the previous short stop, the direction is set to -1 (indicating a bearish trend). Otherwise, the direction remains unchanged.
Plotting: The indicator plots several visual elements on the chart: - Long Stop: Draws a line representing the long stop level. - Long Stop Start: Plots a small circle marker indicating the start of a long stop (buy signal). - Buy Label: Displays a "Buy" label near the long stop start marker. - Short Stop: Draws a line representing the short stop level. - Short Stop Start: Plots a small circle marker indicating the start of a short stop (sell signal). - Sell Label: Displays a "Sell" label near the short stop start marker. - Long State Filling: Fills the area between the mid price and the long stop line with a color (optional). - Short State Filling: Fills the area between the mid price and the short stop line with a color (optional).
Alerts: The indicator includes three types of alerts: - PTI Direction Change: Triggers an alert when the PTI direction changes (from bullish to bearish or vice versa). - PTI Buy: Triggers an alert when a buy signal occurs (long stop start). - PTI Sell: Triggers an alert when a sell signal occurs (short stop start).
By using the PTI indicator, traders can monitor potential trend changes and receive alerts when buy or sell signals are generated based on price and volatility dynamics.
Please note that the interpretation and effectiveness of this indicator should be evaluated through rigorous backtesting and analysis before making any trading decisions.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.