SupersafeTrader

Library: Array

SupersafeTrader ที่อัปเดต:   
Library "xarray"
Additional functions for array.

remove_duplicates(array_in)
  Remove duplicates in array.
  Parameters:
    array_in: (int/float/string) Array contains duplicates.
  Returns: Array without duplicates.

// Example: int
import tuele99/xarray/1 as xarray
c = xarray.remove_duplicates(array.from(1, 4, 2, 1, 2))
plot(array.size(c))
plot(array.get(c, 0))
plot(array.get(c, 1))

// Example: float
import tuele99/xarray/1 as xarray
c = xarray.remove_duplicates(array.from(1.0, 4.0, 2.0, 1.0, 2.0))
plot(array.size(c))
plot(array.get(c, 0))
plot(array.get(c, 1))

// Example: string
import tuele99/xarray/1 as xarray
c = xarray.remove_duplicates(array.from("green", "red", "green", "red", "green"))
plot(array.size(c)) // value = 2
label0 = label.new(x=last_bar_index, y=0, yloc=yloc.belowbar, text=array.get(c, 0), style=label.style_label_left, color=color.new(color.black, 100), textcolor=color.green) // below text = "green"
label1 = label.new(x=last_bar_index, y=0, yloc=yloc.abovebar, text=array.get(c, 1), style=label.style_label_left, color=color.new(color.black, 100), textcolor=color.red) // above text = "red"
เอกสารเผยแพร่:
v2

Added:
remove_duplicates(array_in_1, array_in_2)
Remove duplicates in 2 arrays.
Parameters:
array_in_1: (int/float/string) Array contains duplicates.
array_in_2: (int/float/string) Array contains duplicates.
Returns: 2 arrays without duplicates.
เอกสารเผยแพร่:
v3
Fix bug.
// Example: lib(int, float)
import tuele99/xarray/3 as xarray
= xarray.remove_duplicates(array.from(1, 1, 2, 2, 3), array.from(4.0, 4.0, 5.0, 6.0, 7.0))
plot(array.size(c))
plot(array.get(c, 0))
plot(array.get(c, 1))
plot(array.size(d))
plot(array.get(d, 0))
plot(array.get(d, 1))

// Example: lib(int, string)
import tuele99/xarray/3 as xarray
= xarray.remove_duplicates(array.from(1, 2, 1, 2, 2), array.from("green", "red", "green", "red", "green"))
plot(array.size(d)) // value = 3
label0 = label.new(x=last_bar_index, y=0, yloc=yloc.belowbar, text=array.get(d, 2), style=label.style_label_left, color=color.new(color.black, 100), textcolor=color.green) // below text = "green"
label1 = label.new(x=last_bar_index, y=0, yloc=yloc.abovebar, text=array.get(d, 1), style=label.style_label_left, color=color.new(color.black, 100), textcolor=color.red) // above text = "red"
เอกสารเผยแพร่:
v4
Change syntax.
remove_duplicates(int array_in_out)
remove_duplicates(float array_in_out)
remove_duplicates(string array_in_out)
remove_duplicates(int array_in_out_1, float array_in_out_2)
remove_duplicates(float array_in_out_1, int array_in_out_2)
remove_duplicates(int array_in_out_1, string array_in_out_2)
remove_duplicates(string array_in_out_1, int array_in_out_2)
remove_duplicates(float array_in_out_1, string array_in_out_2)
remove_duplicates(string array_in_out_1, float array_in_out_2)
remove_duplicates(int array_in_out_1, int array_in_out_2)
remove_duplicates(float array_in_out_1, float array_in_out_2)
remove_duplicates(string array_in_out_1, string array_in_out_2)

// Example: lib(int, float)
import tuele99/xarray/4 as xarray
c = array.from(1, 1, 2, 2, 3)
d = array.from(4.0, 4.0, 5.0, 6.0, 7.0)
xarray.remove_duplicates(c, d)
plot(array.size(c)) // 4
plot(array.get(c, 0)) // 1
plot(array.get(c, 1)) // 2
plot(array.size(d)) // 4
plot(array.get(d, 0)) // 4.0
plot(array.get(d, 1)) // 5.0
เอกสารเผยแพร่:
v5
Updated: Remove 3D duplicates.
remove_duplicates(int array_in_out_1, float array_in_out_2, bool array_in_out_3)
เอกสารเผยแพร่:
v6
Added:
remove_duplicates(float array_in_out_1, int array_in_out_2, bool array_in_out_3)
remove_duplicates(int array_in_out_1, float array_in_out_2, string array_in_out_3)
remove_duplicates(float array_in_out_1, int array_in_out_2, string array_in_out_3)

Trade Plan Support: tinyurl.com/4bhe6wk3
Public Indicators: tinyurl.com/26emm5e2
License and Disclaimer: tinyurl.com/4rtrwhfd
ไลบรารีไพน์

จิตวิญญาณที่แท้จริงของ TradingView ผู้เขียนได้ตีพิมพ์รหัส Pine นี้เป็นไลบรารีโอเพนซอร์ซเพื่อให้โปรแกรมเมอร์คนอื่น ๆ จากชุมชนของเราสามารถนำไปใช้ซ้ำได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ไลบรารีนี้เป็นการส่วนตัวหรือในสิ่งพิมพ์โอเพนซอร์สอื่น ๆ แต่นำรหัสนี้มาใช้ซ้ำในสิ่งพิมพ์จะถูกควบคุมโดย กฎระเบียบการใช้งาน

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการใช้ไลบรารีนี้หรือไม่?

คัดลอกข้อความไปยังคลิปบอร์ดแล้ววางลงในสคริปต์ของคุณ