OPEN-SOURCE SCRIPT

Central Pivot Range (CPR)

Central Pivot Range (CPR) Indicator
The Central Pivot Range (CPR) indicator is designed to help traders identify key levels of support and resistance based on pivot points calculated from the previous day's price action. The CPR levels act as critical areas of price convergence and potential reversal, which can help in anticipating future price movements. This version of the CPR indicator includes customizable features to enhance your trading strategy.

Key Features:
Custom Timeframe Support: The indicator allows you to select a custom timeframe for calculating the CPR levels. By default, it uses the daily timeframe ('D'), but you can adjust it to any other timeframe of your choosing. The indicator calculates the CPR and support/resistance levels based on the data from the selected timeframe.

Central Pivot (CP), Below Central Pivot (BC), and Top Central Pivot (TC):

Pivot (CP): The central pivot point is calculated as the average of the high, low, and close prices of the selected timeframe.
Below Central Pivot (BC): This is the midpoint between the high and low prices of the selected timeframe.
Top Central Pivot (TC): This is calculated based on the central pivot and below central pivot, providing a range between support and resistance levels.
Support and Resistance Levels (S1, S2, S3, R1, R2, R3):

Support Levels (S1, S2, S3): These are calculated based on the central pivot, providing potential areas where price may find support and reverse.
Resistance Levels (R1, R2, R3): These are calculated similarly but indicate potential resistance zones where price may face challenges to move higher.
Dynamic Plotting Based on User Input:

The indicator allows you to choose which levels to display on the chart, including the Central Pivot (CP), Support Levels (S1, S2, S3), and Resistance Levels (R1, R2, R3), all of which can be toggled on or off via checkboxes.
CP is displayed in white, BC and TC in blue, Support levels (S1, S2, S3) in green, and Resistance levels (R1, R2, R3) in red.
Daywise Calculations:

The CPR and levels are based on the previous day’s price action, providing historical support and resistance levels that can be useful for intraday analysis.
The request.security function is used to fetch the pivot data from the custom timeframe, ensuring the levels are calculated based on the last completed period (previous day) without repainting.
Customization Options:
CPR Plot: Toggle the visibility of the central pivot range (CPR) lines.
Support Levels (S1, S2, S3): Choose to show or hide the support levels.
Resistance Levels (R1, R2, R3): Choose to show or hide the resistance levels.
Custom Timeframe: Set a custom timeframe for calculating the CPR, allowing for more flexible and tailored analysis.
educationalmultitimeframePivot points and levels

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明