RCMG

Precision Trader Indicator, v1.01

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精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?