Sort pseudo-array

999 2 17
This pine script sorts pseudo-array a(). Kind of.
Remove from Favorite Scripts Add to Favorite Scripts
study("Sort pseudo-array")
length = 5
a(i) => 
    close[i] + close[i+1]

sort(a, i) => 
    min = -10000
    for j = 0 to i
        min_local = 10000
        for l = 0 to length - 1
            if (a(l) <= min)
            min_local := min(min_local, max(min, a(l)))
        min := min_local


plot(sort(a, 0), color=red, linewidth=3)
plot(sort(a, 1), color=orange, linewidth=3)
plot(sort(a, 2), color=green, linewidth=3)
plot(sort(a, 3), color=blue, linewidth=3)
plot(sort(a, 4), color=purple, linewidth=3)
Cool script. Every once a while a(4) gets 10,000 value, and even a(3) gets 10,000, which is shown in the graph. I couldn't figure out why. Do you know? For example, try GLD, IWM, Joe
Yes, this script was just example. I believe it =10000 when two values are the same. Try this one
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out