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

Pineライブラリ

TradingViewの精神に則り、作者はPineコードをオープンソースライブラリとして公開し、コミュニティの他のPineプログラマーが再利用できるようにしました。作者に敬意を表します!このライブラリを個人的に、または他のオープンソースの投稿で使用することができますが、、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

このライブラリを使用したいですか?

以下の行をコピーして、スクリプト内に貼り付けてください。