OPEN-SOURCE SCRIPT

Nearest Rank For Loop - [JTCAPITAL]

77
Nearest Rank For Loop is used for trend-following using the median of the data.

The indicator works by calculating in the following steps:

1. The median is calculated using the ranking length of the source and using "percentile nearest rank" to determine the middle value. This is done with the original length and the length devided by 3, averaged out to eliminate false signals from extremely fast and temporary market movements.

2. Over the length of the loop values get added based on the median being higher than the previous median.

3. The results of the for loop segment get smoothed out using an EMA.


--Buy and sell conditions--

-When the for loop values get above the long threshold we enter a buying condition, we dont exit the buying condition until the for loop values get below the short condition. Which signals a short.

-When the values stay between the thresholds the signal doesnt change. This and smoothing out the for loop values is used to eliminate false signals as much as possible.


--Features and Parameters--

-Allows the changing of the length of the ranking (median)
-Allows the usage of different sources
-Allows changing of the paramaters over the start and end of the for loop segment
-Allows changing the thresholds for longs and shorts
-Allows changing the parameter for the smoothing using an EMA

--Details--

Both the wide thresholds and the use of an EMA over the for loop values are used to eliminate as much false signals as possible. Aswell as deviding the length by 3 and taking the average from the medians. From testing this indicator we have found that using a very small value for the shorting gives the overall best performance. Since a fast market move wont immediately trigger a false signal, but it also wont massively delay entries and exits.

It is recommended to change the parameter settings for different asset classes and timeframes based off volatility and fast and confusing market movements.

Enjoy!

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。