The description below is copied from the script's comments. Because TradingView does not allow me to edit this description, please refer to the script's comments section, as well as the release notes, for the most up-to-date information.



The inputs define the trend and the volatility stop .

The trend is defined by a moving average crossover. When the short
(or fast) moving average is above the long (slow) moving average, the
trend is up. Otherwise, the trend is down. The inputs are:

long: the number of periods in the long/slow moving average.
short: the number of periods in the short/fast moving average.

The slow moving average is shown in various colors (see explanation
below. The fast moving average is a faint blue.

Volatility stop:
The volatility stop has two modes, percentage and rank. The percentage
stop is given in terms of annualized volatility . The rank stop is given
in terms of percentile.

stop_pct and stop_rank are initialized with "-1". You need to set one of
these to the values you want after adding the indicator to your chart.
This is the only setting that requires your input.

mode: choose "rank" for a rank stop, "percentage" for a percentage stop.
vol_window: the number of periods in the historical volatility
calculation. e.g. "30" means the volatility will be a weighted
average of the previous 30 periods. applies to both types of stop.
stop_pct: the volatility limit, annualized. for example, "50" means
that the trend will not be followed when historical volatility rises
above 50%.
stop_rank: the trend will not be followed when the volatility is in the
N-th percentile. for example, "75" means the trend will not be
followed when the current historical volatility is greater than 75%
of previous volatilities.
rank_window: the number of periods in the rank percentile calculation.
for example, if rank_window is "252" and "stop_rank" is "80", the
trend will not be followed when current historical volatility is
greater than 80% of the previous 252 historical volatilities.


The outputs include moving averages, to visually identify the trend,
a volatility table, and a performance table.

Moving averages:
The slow moving average is colored green in an uptrend, red in a
downtrend, and black when the volatility stop is in place.

Volatility table:
The volatility table gives the current historical volatility , annualized
and expressed as a whole number percentage. E.g. "65" means the
instrument's one standard deviation annual move is 65% of its price.

The current rank is expressed, also as a whole number percentage. E.g.
"15" means the current volatility is greater than 15% of previous
volatilities. For convenience, the volatilities corresponding to the
0, 25, 50, 75, and 100th percentiles are also shown.

Performance table:
The performance table shows the current strategy's performance versus
buy-and-hold . If the trend is up, the instrument's return for that
period is added to the strategy's return, because the strategy is long.
If the trend is down, the negative return is added, because the strategy
is short. If the volatility stop is in (the slow moving average is
black), that period's return is excluded from the strategy returns.

Every period's return is added to the buy-and-hold returns.

The table shows the average return, the standard deviation of returns,
and the sharpe ratio (average return / standard deviation of returns).
All figures are expressed as per-period, whole number percentages.
For exmaple, "0.1" in the mean column on a daily chart means a
0.1% daily return.

The number of periods (samples) for each strategy is also shown.
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?