OPEN-SOURCE SCRIPT

Signs of the Times [LucF]

Cập nhật
█ OVERVIEW

This oscillator calculates the directional strength of bars using a primitive weighing mechanism based on a small number of what I consider to be fundamental properties of a bar. It does not consider the amplitude of price movements, so can be used as a complement to momentum-based oscillators. It thus belongs to the same family of indicators as my Bar Balance, ​Volume Ticks, Efficient work, ​Volume Buoyancy or my Delta ​Volume indicators.



█ CONCEPTS


The calculations underlying Signs of the Times (SOTT) use a simple, oft-explored concept: measure bar attributes, assign a weight to them, and aggregate results to provide an evaluation of a bar's directional strength. Bull and bear weights are added independently, then subtracted and divided by the maximum possible weight, so the final calculation looks like this:

SOTT has a zero centerline and oscillates between +1 and -1. Ten elementary properties are evaluated. Most carry a weight of one, a few are doubly weighted. All properties are evaluated using only the current bar's values or by comparing its values to those of the preceding bar. The bull conditions follow; their inverse applies to bear conditions:

 Weight of 1
 • Bar's close is greater than the bar's open (bar is considered to be of "up" polarity)
 • Rising open
 • Rising high
 • Rising low
 • Rising close
 • Bar is up and its body size is greater than that of the previous bar
 • Bar is up and its body size is greater than the combined size of wicks

 Weight of 2
 • Gap to the upside
 • Efficient Work when it is positive
 • Bar is up and ​volume is greater than that of the previous bar (this only kicks in if ​volume is actually available on the chart's data feed)

Except for the Efficient Work weight, which is a +1 to -1 float value multiplied by 2, all weights are discrete; either zero or the full weight of 1 or 2 is generated. This will cause any gap, for example, to generate a weight of +2 or -2, regardless of the gap's size. That is the reason why the oscillator is oblivious to the amplitude of price movements.

You can see the code used to calculate SOTT in my ta library's `sott()` function.



█ HOW TO USE THE INDICATOR


No videos explain this indicator and none are planned; reading this description or the script's code is the only way to understand what Signs of the Times does.

Load the indicator on an active chart (see here if you don't know how).

The default configuration displays:
 • An Arnaud-Legoux moving average of length 20 of the instant SOTT value. This is the signal line.
 • A fill between the MA and the centerline.
 • Levels at arbitrary values of +0.3 and -0.3.
 • A channel between the signal line and its MA (a simple MA of length 20), which can be one of four colors:
  • Bull (green): The signal line is above its MA.
  • Strong bull (lime): The bull condition is fulfilled and the signal line is above the centerline.
  • Bear (red): The signal line is below its MA.
  • Strong bear (pink): The bear condition is fulfilled and the signal line is below the centerline.

The script's "Inputs" tab allows you to:
 • Choose a higher timeframe to calculate the indicator's values. This can be useful to get a wider perspective of the indicator's values.
  If you elect to use a higher timeframe, make sure that your chart's timeframe is always lower than the higher timeframe you specified,
  as calculating on a timeframe lower than the chart's does not make much sense because the indicator is then displaying only the value of the last intrabar in the chart bar.
 • Specify the type of MA used to produce the signal line. Use a length of 1 or the Data Window to see the instant value of SOTT. It is quite noisy, thus the need to average it.
 • Specify the type of MA applied to the signal line. The idea here is to provide context to the signal.
 • Control the display and colors of the lines and fills.

The first pane of this publication's chart shows the default setup. The second one shows only a monochrome signal line.

Using the "Style" tab of the indicator's settings, you can change the type and width of the lines, and the level values.



█ INTERPRETATION


Remember that Signs of the Times evaluates directional bar strength — not price movement. Its highs and lows do not reflect price, but the strength of chart bars. The fact that SOTT knows nothing of how far price moves or of trends is easy to forget. As such, I think SOTT is best used as a confirmation tool. Chart movements may appear to be easy to read when looking at historical bars, but when you have to make go-no-go decisions on the last bar, the landscape often becomes murkier. By providing a quantitative evaluation of the strength of the last few bars, which is not always easily discernible by simply looking at them, SOTT aims to help you decide if the short-term past favors the bets you are considering. Can SOTT predict the future? Of course not.

While SOTT uses completely different calculations than classical momentum oscillators, its profile shares many of their characteristics. This could lead one to infer that directional bar strength correlates with price movement, which could in turn lead one to conclude that indicators such as this one are useless, or that they can be useful tools to confirm momentum oscillators or other models of price movement. The call is, of course, up to you. You can try, for example, to compare a Wilder MA of SOTT to an RSI of the same length.

One key difference with momentum oscillators is that SOTT is much less sensitive to large price movements. The default Arnaud-Legoux MA used for the signal line makes it quite active; you can use a more quiet SMA or EMA if you prefer to tone it down.

In systems where it can be useful to only enter or exit on short-term strength, an average of SOTT values over the last 3 to 5 bars can be used as a more quiet filter than a momentum oscillator would.



█ NOTES


My publications often go through a long gestation period where I use them on my charts or in systems before deciding if they are worth a publication. With an incubation period of more than three years, Signs of the Times holds the record. The properties SOTT currently evaluates result from the systematic elimination of contaminants over that lengthy period of time. It was long because of my usual, slow gear, but also because I had to try countless combinations of conditions before realizing that, contrary to my intuition, best results were achieved by:
 • Keeping the number of evaluated properties to the absolute minimum.
 • Limiting the evaluation's ​scope to the current and preceding bar.
 • Choosing properties that, in my view, were unmistakably indicative of ​bullish/​bearish conditions.


Repainting

As most oscillators, the indicator provides live realtime values that will recalculate with chart updates. It will thus repaint in real time, but not on historical values. To learn more about repainting, see the Pine Script™ User Manual's page on the subject.
Phát hành các Ghi chú
v2
• Added the possibility to color chart bars using one of four modes.
Candlestick analysisOscillators

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 đồ?


"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

tradingview.com/u/PineCoders/
tradingview.com/u/TradingView/
Ngoài ra, trên:

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