Sort
Sort checks the order of the values of an arbitrary number of input features and reports the result by attaching ascending, descending, equal, and not sorted labels to candles. The exact order of features could be used for further analysis. To use this function the following parameters must be set:
Timeframes: The timeframe(s) in which the the function is used
Features: The list of to-be-used columns in the exact order of interest; all columns must be numeric.
Output Column Name(s): The name of the column in which the result is stored
The system uses the order that the features are entered. For example, when it labels a candle as ascending, this means that the first feature has the lowest value, the second feature has the second lowest value and so on.
Example
One of the popular methods for trend detection is using three or more moving averages with different window sizes. In this example, we want to use three moving averages with window sizes of 10, 20, and 50 to detect trends. In this method when MA10 > MA20 > MA50, we are in a bullish trend, and when MA10 < MA20 < MA50, the market is bearish. Sort function is used the way shown in the figure below:

As it is seen in the figure shown below, when ma_sort_state is descending, MA50 > MA20 > MA10.
