• Produtos
  • Comunidade
  • Mercados
  • Corretoras
  • Mais
Começar
  • Comunidade
  • /
  • /Masorting

Masorting

ma sorter ('sort by array' example)- JD//////////////////////////////////////////////////////////////// //////////////// ma sorter / Array sorting function ////////////////// //////////////////////////////////////////////////////////////// This script gives an example how you can sort the items in one array, by using the values in another array. In the example here, we want to sort moving averages of different lengths by there values as we don't have mixed arrays (yet) in Pinescript, one solution could be to store this in 2 arrays: - one (string) array to store the ma names - one (float) array to store the ma values The "f_sort_by_array( )" function in this script allows you to sort the ma names by using the ma values and sorts the two arrays together, as if the were one 2D matrix, where the rows are sorted. With the "f_sort_by_array" function, both the (string) array1 and array2 are sorted by the values of array2, the function returns the two sorted arrays. IMPORTANT NOTE: the output has to be stored in TWO NEW (sorted) ARRAYS, Pinescript doesn't allow function arguments to be modified by the function itself this is why the output goes to ma_names_sorted and not ma_names !!!! Feel free to use this function in your scripts to get more contorl over your arrays. Gr, JD.
Indicador Pine Script®
por Duyck
Fev 15, 2021
77

Dados de mercado selecionados fornecidos pela ICE Data services. Dados de referência fornecidos pela FactSet. Copyright © 2025 FactSet Research Systems Inc.© 2025 TradingView, Inc.

Mais do que um produto
  • Supergráficos
Rastreadores
  • Ações
  • ETFs
  • Títulos
  • Criptomoedas
  • Pares de cripto
  • Pares CEX
  • Pares DEX
  • Pine
Mapas de Calor
  • Ações
  • ETFs
  • Cripto
Calendários
  • Economia
  • Resultados
  • Dividendos
Mais produtos
  • Curva de juros
  • Opções
  • News Flow
  • Pine Script®
Apps
  • Dispositivo Móvel
  • Desktop
Comunidade
  • Rede social
  • Mural do Amor
  • Indique um Amigo
  • Regras da Casa
  • Moderadores
Ideias
  • Trade
  • Educacional
  • Sugestão da Casa
Pine Script
  • Indicadores & estratégias
  • Wizards
  • Freelancers
Ferramentas & assinaturas
  • Recursos
  • Preços
  • Dados de mercado
Ofertas especiais
  • Futuros do CME Group
  • Futuros Eurex
  • Conjunto de ações EUA
Sobre a empresa
  • Quem somos
  • Manifesto
  • Atletas
  • Blog
  • Carreiras
  • Media kit
Merchan
  • Loja TradingView
  • Cartas de Tarô para traders
  • The C63 TradeTime
Políticas & segurança
  • Termos de Uso
  • Aviso legal
  • Política de Privacidade
  • Política de Cookies
  • Declaração de Acessibilidade
  • Vulnerabilidade de segurança
  • Página de Status
Soluções para negócios
  • Widgets
  • Bibliotecas de gráficos
  • Lightweight Charts™
  • Gráficos Avançados
  • Plataforma de Negociação
Oportunidades de crescimento
  • Anúncios
  • Integração de Corretoras
  • Programa de Parceria
  • Programa educacional
Comunidade
  • Rede social
  • Mural do Amor
  • Indique um Amigo
  • Regras da Casa
  • Moderadores
Ideias
  • Trade
  • Educacional
  • Sugestão da Casa
Pine Script
  • Indicadores & estratégias
  • Wizards
  • Freelancers
Soluções para negócios
  • Widgets
  • Bibliotecas de gráficos
  • Lightweight Charts™
  • Gráficos Avançados
  • Plataforma de Negociação
Oportunidades de crescimento
  • Anúncios
  • Integração de Corretoras
  • Programa de Parceria
  • Programa educacional
Look FirstLook First