TradingView
Julien_Eche
30 mag 2023 13:40

US Market Sentiment 

S&P 500SP

Descrizione

The "US Market Sentiment" indicator is designed to provide insights into the sentiment of the US market. It is based on the calculation of an oscillator using data from the High Yield Ratio. This indicator can be helpful in assessing the overall sentiment and potential market trends.

Key Features:

Trend Direction: The indicator helps identify the general trend direction of market sentiment. Positive values indicate a bullish sentiment, while negative values indicate a bearish sentiment. Traders and investors can use this information to understand the prevailing market sentiment.

Overbought and Oversold Levels: The indicator can highlight overbought and oversold conditions in the market. When the oscillator reaches high positive levels, it suggests excessive optimism and a potential downside correction. Conversely, high negative levels indicate excessive pessimism and the possibility of an upside rebound.

Divergence Analysis: The indicator can reveal divergences between the sentiment oscillator and price movements. Divergences occur when the price reaches new highs or lows, but the sentiment oscillator fails to confirm the move. This can signal a potential trend reversal or weakening of the current trend.

Confirmation of Trading Signals: The "US Market Sentiment" indicator can be used to confirm other trading signals or indicators. For instance, if a momentum indicator generates a bullish signal, a positive reversal in the sentiment oscillator can provide additional confirmation for the trade.

Usage and Interpretation:

Positive values of the "US Market Sentiment" indicate a bullish sentiment, suggesting potential buying opportunities.
Negative values suggest a bearish sentiment, indicating potential selling or shorting opportunities.
Extreme positive or negative values may signal overbought or oversold conditions, respectively, and could precede a market reversal.
Divergences between the sentiment oscillator and price trends may suggest a potential change in the current market direction.
Traders and investors can combine the "US Market Sentiment" indicator with other technical analysis tools to enhance their decision-making process and gain deeper insights into the US market sentiment.

Note di rilascio

Minor change
Commenti
Julien_Eche
// © Julien_Eche

//@version=4
study(title="Smart Reg channel", overlay=true)

f_array_polyreg(_X, _Y)=>

//| Resources:
//| language D: rosettacode.org/wiki/Polynomial_regression

int _sizeY = array.size(id=_Y)
int _sizeX = array.size(id=_X)
//
float _meanX = array.sum(id=_X) / _sizeX
float _meanY = array.sum(id=_Y) / _sizeX
float _meanXY = 0.0
float _meanY2 = 0.0
float _meanX2 = 0.0
float _meanX3 = 0.0
float _meanX4 = 0.0
float _meanX2Y = 0.0
if _sizeY == _sizeX
for _i = 0 to _sizeY - 1
float _Xi = array.get(id=_X, index=_i)
float _Yi = array.get(id=_Y, index=_i)
_meanXY := _meanXY + (_Xi * _Yi)
_meanY2 := _meanY2 + pow(_Yi, 2)
_meanX2 := _meanX2 + pow(_Xi, 2)
_meanX3 := _meanX3 + pow(_Xi, 3)
_meanX4 := _meanX4 + pow(_Xi, 4)
_meanX2Y := _meanX2Y + pow(_Xi, 2) * _Yi
_meanXY := _meanXY / _sizeX
_meanY2 := _meanY2 / _sizeX
_meanX2 := _meanX2 / _sizeX
_meanX3 := _meanX3 / _sizeX
_meanX4 := _meanX4 / _sizeX
_meanX2Y := _meanX2Y / _sizeX

float _sXX = _meanX2 - _meanX * _meanX
float _sXY = _meanXY - _meanX * _meanY
float _sXX2 = _meanX3 - _meanX * _meanX2
float _sX2X2 = _meanX4 - _meanX2 * _meanX2
float _sX2Y = _meanX2Y - _meanX2 * _meanY

float _b = (_sXY * _sX2X2 - _sX2Y * _sXX2) / (_sXX * _sX2X2 - _sXX2 * _sXX2)
float _c = (_sX2Y * _sXX - _sXY * _sXX2) / (_sXX * _sX2X2 - _sXX2 * _sXX2)
float _a = _meanY - _b * _meanX - _c * _meanX2

float[] _predictions = array.new_float(size=0, initial_value=0.0)
float _max_dev = 0.0
float _min_dev = 0.0
float _stdev = 0.0
for _i = 0 to _sizeX - 1
float _Xi = array.get(id=_X, index=_i)
float _vector = _a + _b * _Xi + _c * _Xi * _Xi
array.push(id=_predictions, value=_vector)
//
float _Yi = array.get(id=_Y, index=_i)
float _diff = _Yi - _vector
if _diff > _max_dev
_max_dev := _diff
if _diff < _min_dev
_min_dev := _diff
_stdev := _stdev + abs(_diff)

[_predictions, _max_dev, _min_dev, _stdev/_sizeX]

int length = input(50)
var float[] prices = array.new_float(size=length, initial_value=open)
var int[] indices = array.new_int(size=length, initial_value=0)
if pivothigh(2, 2)
e = array.pop(id=prices)
i = array.pop(id=indices)
array.insert(id=prices, index=0, value=high[2])
array.insert(id=indices, index=0, value=bar_index[2])
if pivotlow(2, 2)
e = array.pop(id=prices)
i = array.pop(id=indices)
array.insert(id=prices, index=0, value=low[2])
array.insert(id=indices, index=0, value=bar_index[2])

[P, Pmax, Pmin, Pstdev] = f_array_polyreg(indices, prices)

color _pr_mid_col = input(color.gray, "Mid")
color _pr_std_col = input(color.gray, "Dev 1")
color _pr_max_col = input(color.gray, "Dev 2")

f_init_mid()=>line.new(x1=bar_index, y1=0.0, x2=bar_index, y2=0.0, color=_pr_mi
Altro