Indices Sector SigmaSpikes


“The benchmark [symbol=djy]Dow Jones Industrial Average[/symbol] is off nearly 300 points as of midday today...”
“So what? Is that a lot or a little? Should we care?”
-Adam H Grimes-

This screener aims to provide Bird-Eye view across sector indices, to find which sector is having significant or 'out-of-norm' move in either direction.
The significance of the move is measured based on Sigma Spikes, a method proposed by Adam H. Grimes, where Standard Deviation of returns used as a baseline.

*You can google his blog or read his book, got some gold in there, especially on how he use indicators for trading

█ Understanding Sigma Spikes

As described by Grimes, moves in markets are only meaningful when we consider what “normal” is for that market.
Without that baseline, the daily change number, and even the percent change on the day doesn’t really mean much.

To overcome that problem, Sigma Spikes, as a measure of volatility , attempt to put todays change in price ( aka return) in context of the standard deviation of 20 days daily's return.

Refer chart below:

1. The blue bars refer to each days return
2. The orange line is 1 time standard deviation of past 20days daily's return (today not included)
3. The red line is 2 time standard deviation of past 20days daily's return (today not included)

Using the ratio of today's return over the Std Deviation, determining your threshold (1,2,3,etc) will be the key that tells if today's move is significant or not.
*Threshold referring to times standard deviation, and different market may require different threshold.
*20 Days period are based on the Lookback Period, adjustable from user input window.

█ Features

- Scan up to 13 symbols at a time (Bursa ( MYX ) indices are defaulted, but you may change to any symbols/index from the user input setting)

█ Limitation

- Due to multiple use of security() function required to call other symbols, expect the screener to be slow at certain times
- Custom Timeframe currently accept only Daily and Weekly. I'll try to include lower timeframe in the next update

█ Disclaimer

Past performance is not an indicator of future results.
My opinions and research are my own and do not constitute financial advice in any way whatsoever.
Nothing published by me constitutes an investment recommendation, nor should any data or Content published by me be relied upon for any investment/trading activities.
I strongly recommends that you perform your own independent research and/or speak with a qualified investment professional before making any financial decisions.

Any ideas to further improve this indicator are welcome :)
Catatan Rilis: Updated with max_bars_back to solve referencing issue encountered by some people
Skrip open-source

Sejalan dengan semangat TradingView, penulis skrip ini telah mempublikasikannya secara open-source, sehingga para trader dapat memahami dan memverifikasinya. Salut untuk sang penulis! Anda dapat menggunakannya secara gratis, tetapi penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk dapat menggunakannya didalam sebuah chart.

Inggin menggunakan skrip ini pada chart?


500 koin
+1 Jawab
Great script, can you use this script to do both sectors and industries, and/or compare stocks > Sectors or Industries, and/or by different countries.
+4 Jawab
@Kama181, Thanks, u can change the symbol in the input screen, just find the sectors of your desired country/exchange, or any stock or currency symbols that u want to monitor, the script does not put any limitation on which asset class to scan, although the description text on display is hardcoded to “sector”.
+1 Jawab
@Kama181, you can change the sectors to stocks?
@Kama181, or ETFS
This publication is now featured in our Editors' Picks: https://www.tradingview.com/scripts/editors-picks/ .
In the name of all TradingView traders, thank you for your valuable contribution to the TradingView community, and congrats!
+3 Jawab
fareidzulkifli PineCoders
@PineCoders, Thanks!! I appreciate this
Hi, i really like "Indices Sector SigmaSpikes". I try to understand in deep the outcomes, here are different questions:
- There are 5 columns, i understand the header of each column, but could not figure out the logic behind.
For example, i can see the percentage "return today" and "return 20 days" of a sector in "Sector with Average Gain" that are higher than the one in "Sector with significant Gain".
What are the classification's criteria? On each column, the list is sorted with a certain criteria?
- "Sigma" means the x standard deviation of past 20 days? Does it mean if Sigma is high, it means there is a high volatility? If not, could you explain further?
- "Scan for: Today Sigma Spike Threshold: 2" (Right column): Could you explain further?
+2 Jawab
fareidzulkifli TilekLekti
@TilekLekti, Hi
1) The sectors are sorted by the 'significance' of the gain(or loss). for example, for the past 20 days, sector A have average return of 2% per day while sector B average return is only 0.2% per day. Following this, total return of sector A is much bigger then sector B.
But today, sector A gain is 2.2% (assume this below its 2 standard deviation) while sector B gain is 0.8% (assume this well above its 2 standard deviation). This means that even though sector A absolute return is higher than sector B, Sector B is ranked higher due to the fact that it 'outperform' its average while sector A %gain is considered normal by its own standard.

Since the SigmaSpike Threshold is 2, any sector with sigmaspike below 2 will be placed under the "Average" group while above 2 will be placed in the "Significant" group.

2) Yes Sigmaspike refers to x standard deviation. if its high it might indicate that volatility of the day is higher than usual, or it might also signal that's there's a catalyst for that particular sector that causes the spike. however, as with any other indicators, as long as u understand the underlying principle of the indicator, u may interpret it's result as u see fit.

3) As explained in item 1. it act as a threshold that separate how much x above/below standard deviation for it to be considered average or significant

Hope these helps :)
TilekLekti fareidzulkifli
@fareidzulkifli, thanks for the answer. Is it possible to export the results into a text or excel format? If yes, how?