• 產品
  • 社群
  • 市場
  • 經紀商
  • 更多
立即開始
  • 社群
  • /指標和策略
  • /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.
Pine Script®指標
由Duyck提供
77

選擇由ICE Data提供的市場數據。選擇由FactSet提供的參考數據。版權所有©2025FactSet Research Systems Inc.©2025TradingView, Inc.

不僅是產品
  • 超級圖表
篩選器
  • 股票
  • ETF
  • 債券
  • 加密貨幣
  • 加密貨幣對
  • CEX對
  • DEX對
  • Pine
熱圖
  • 股票
  • ETF
  • 加密貨幣
日曆
  • 經濟
  • 收益
  • 股息
更多產品
  • 殖利率曲線
  • 期權
  • 新聞流
  • Pine Script®
  • 精選股
App
  • 行動裝置
  • 電腦版
工具與訂閱
  • 功能特色
  • 價格
  • 市場數據
特別優惠
  • CME期貨
  • Eurex期貨
  • 美國股票包
關於公司
  • 我們是誰
  • 宣言
  • 運動員
  • 部落格
  • 職涯
  • 媒體工具包
商品
  • TradingView商店
  • 交易者塔羅牌
政策與安全
  • 使用條款
  • 免責聲明
  • 隱私政策
  • Cookies政策
  • 無障礙聲明
  • 安全漏洞
  • 狀態頁面
社群
  • 社交網路
  • 愛心牆
  • 推薦朋友
  • 網站規則
  • 版主
投資想法
  • 交易
  • 教育
  • 編輯精選
Pine腳本
  • 指標與策略
  • 大師
  • 自由開發人員
企業解決方案
  • 小工具
  • 圖表庫
  • Lightweight Charts™
  • 高級圖表
  • 交易平台
成長機會
  • 廣告
  • 經紀商整合
  • 夥伴計畫
  • 教育計劃
Look FirstLook First