RozaniGhani-RG

WelcomeUDT

█  OVERVIEW
This is a simplest example of user-defined types (UDT) or objects, which simplify as alternative to hello world.

█  CREDITS
Tradingview

█  USAGE
These are the types used during initializations, commonly variables.
export type Settings
	int     bar
	float   price
	string  phrase
	...

Example of library function to print out label.
export printLabel(Settings setup) =>
	if setup.variable
		var label lab = na
		label.delete(lab)
		lab := label.new(setup.bar, setup.price, setup.phrase, color = setup.bg)
	else
		label.new(setup.bar, setup.price, setup.phrase, color = setup.bg)

Usage of types
Settings setup = Settings.new(bar_index[0], priceInput, phraseInput, colorInput, variableInput)

Alternative way to write types
Settings setup = Settings.new(
   bar      = bar_index[0],
   price    = priceInput,
   phrase   = phraseInput,
   variable = variableInput)

Usage of types into custom function / library function.
printLabel(setup)

printLabel(Settings)
  Print out label
  Parameters:
    Settings: types
  Returns: Label object

Settings
  Initialize type values
  Fields:
    bar: X position for label
    price: Y position for label
    phrase: Text for label
    bg: Color for label
    variable: Boolean for enable new line and delete line

Thư viện Pine

Với tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác từ cộng đồng của chúng tôi có thể sử dụng lại nó. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này một cách riêng tư hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy chung.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng thư viện này?

Sao chép văn bản vào khay nhớ tạm và dán nó vào tập lệnh của bạn.