OPEN-SOURCE SCRIPT
Telah dikemas kini

Camarilla Pivot Plays

1 851
OVERVIEW

This indicator implements the Camarilla Pivot Points levels and a system for suggesting particular plays. It only calculates and shows the 3rd, 4th, and 6th levels, as these are the only ones used by the system. In total, there are 12 possible plays, grouped into two groups of six. The algorithm constantly evaluates conditions for entering and exiting the plays and indicates them in real time, also triggering user-configurable alerts.

CREDITS

The Camarilla pivot plays are defined in a strategy developed by Thor Young, and the whole system is explained in his book "A Complete Day Trading System". The indicator is published with his permission, and he is a user of it. The book is not necessary in order to understand and use the indicator; this description contains sufficient information to use it effectively.

FEATURES
  • Automatically draws plays, suggesting an entry, stop-loss, and maximum target
  • User can set alerts on chosen ticker to call these plays, even when not currently viewing them
  • Highly configurable via many options
  • Works for US/European stocks and US futures (at least)
  • Works correctly on both RTH and ETH charts
  • Automatically switches between RTH and ETH data
  • Optionally also shows the "other" set of pivots (RTH vs ETH data)
  • Configurable behaviour in the pre-market, not active in the post-market
  • Configurable sensitivity of the play detection algorithm
  • Can also show weekly and monthly Camarilla pivots
  • Well-documented options tooltips
  • Sensible defaults which are suitable for immediate use
  • Well-documented and high-quality open-source code for those who are interested

HOW TO USE

The defaults work well; at a minimum, just add the indicator and watch the plays being called. To avoid having to watch securities, by selecting the three dots next to the indicator name, you can set an alert on the indicator and choose to be alerted on play entry or exit events—or both. The following diagram shows several plays activated in the past (with the "Show past plays" option selected).

syot kilat

By default, the indicator draws plays 5 days back; this can be changed up to 20 days. The labels can be shifted left/right using the "label offset" option to avoid overlapping with other labels in this indicator or those of another indicator.

An information box at the top-right of the chart shows:
  • The data currently in use for the main pivots. This can switch in the pre-market if the H/L range exceeds the previous day's H/L, and if it does, you will see that switch at the time that it happens
  • Whether the current day's pivots are in a higher or lower range compared to the previous day's. This is based on the RTH close, so large moves in the post-market won't be reflected (there is an advanced option to change this)
  • The width of the value relationship in the current day compared to the previous day
  • The currently active play. If multiple plays are active in parallel, only the last activated one is shown

The resistance pivots are all drawn in the same colour (red by default), as are the support pivots (green by default). You can change the resistance and support colours, but it is not possible to have different colours for different levels of the same kind. Plays will always use the correct colour, drawing over the pivots. For example, R4 is red by default, but if a play treats R4 as a support, then the play will draw a green line (by default) over the red R4 line, thereby hiding it while the play is active.

There are a few advanced parameters; leave these as default unless you really know what they do. Please note the script is complicated—it does a lot. You might need to wait a few seconds while it (re)calculates on new tickers or when changing options. Give it time when first loading or changing options!

CONCEPTS

The indicator is focused around daily Camarilla pivots and implements 12 possible plays: 6 when in a higher range, 6 when in a lower range. The plays are labelled by two letters—the first indicates the range, the second indicates the play—as shown in this diagram:

syot kilat

The pivots can be calculated using only RTH (Regular Trading Hours) data, or ETH (Extended Trading Hours) data, which includes the pre-market and post-market. The indicator implements logic to automatically choose the correct data, based on the rules defined by the strategy. This is user-overridable. With the default options, ETH will be used when the H/L range in the previous day's post-market or current day's pre-market exceeds that of the previous day's regular market. In auto mode, the chosen pivots are considered the main pivots for that day and are the ones used for play evaluation. The "other" pivots can also be shown—"other" here meaning using ETH data when the main pivots use RTH data, and vice versa.

When displaying plays in the pre-market, since the RTH open is not yet known (and that value is needed to evaluate play pre-conditions), the pre-market open is used as a proxy for the RTH open. After the regular market opens, the correct RTH open is used to evaluate play conditions.

NOTE FOR FUTURES

Futures always use full ETH data in auto mode. Users may, however, wish to use the option "Always use RTH close," which uses the 3 p.m. Central Time (CME/Chicago) as a basis for the close in the pivot calculations (instead of the 4 p.m. actual close).

Futures don't officially have a pre-market or post-market like equities. Let's take ES on CME as an example (CME is in Chicago, so all times are Central Time, i.e., 1 hour behind Eastern Time). It trades from 17:00 Sunday to 16:00 Friday, with a daily pause between 16:00 and 17:00. However, most of the trading activity is done between 08:30 and 15:00 (Central), which you can tell from the volume spikes at those times, and this coincides with NYSE/NASDAQ regular hours (09:30–16:00 Eastern). So we define a pseudo-pre-market from 17:00 the previous day to 08:30 on the current day, then a pseudo-regular market from 08:30 to 15:00, then a pseudo-post-market from 15:00 to 16:00.

The indicator then works exactly the same as with equities—all the options behave the same, just with different session times defined for the pre-, regular, and post-market, with "RTH" meaning just the regular market and "ETH" meaning all three. The only difference from equities is that the auto calculation mode always uses ETH instead of switching based on ETH range compared to RTH range. This is so users who just leave all the defaults are not confused by auto-switching of the calculation mode; normally you'll want the pivots based on all the (ETH) data. However, both "Force RTH" and "Use RTH close with ETH data" work the same as with equities—so if, in the calculations, you really want to only use RTH data, or use all ETH H/L data but use the RTH close (at 15:00), you can.

LIMITATIONS

The pivots are very close to those shown in DAS Trader Pro. They are not to-the-cent exact, but within a few cents. The reasons are:
  1. TradingView uses real-time data from CBOE One, so doesn't have access to full exchange data (unless you pay for it in TradingView), and
  2. the close/high/low are taken from the intraday timeframe you are currently viewing, not daily data—which are very close, but often not exactly the same. For example, the high on the daily timeframe may differ slightly from the daily high you'll see on an intraday timeframe.

I have occasionally seen larger than a few cents differences in the pivots between these and DAS Trader Pro—this is always due to differences in data, for example a big spike in the data in TradingView but not in DAS Trader Pro, or vice versa. The more traded the stock is, the less the difference tends to be. Highly traded stocks are usually within a few cents. Less traded stocks may be more (for example, 30¢ difference in R4 is the highest I've seen). If it bothers you, official NYSE/NASDAQ data in TradingView is quite inexpensive (but even that doesn't make the 8am candle identical).

The 6th Camarilla level does not have a standard definition and may not match the level shown on other platforms. It does match the definition used by DAS Trader Pro.

The indicator is an intraday indicator (despite also being able to show weekly and monthly pivots on an intraday chart). It deactivates on a daily timeframe and higher. It is untested on sub-minute timeframes; you may encounter runtime errors on these due to various historical data referencing issues. Also, the play detection algorithm would likely be unpredictable on sub-minute timeframes. Therefore, sub-minute timeframes are formally unsupported.

The indicator was developed and tested for US/European stocks and US futures. It may or may not work as intended for stocks and futures in different locations. It does not work for other security types (e.g., crypto), where I have no evidence that the strategy has any relevance.
Nota Keluaran
- User feature request: Added option for prices on labels

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.