AlphaViz

JavaScript-style Debug Console

AlphaViz Zaktualizowano   
This library provides a JavaScript-style debug console to Pine Coders. It supports the most commonly used utilities from the WHATWG Console Standard including the following:

 • console.log
 • console.debug
 • console.info
 • console.warn
 • console.error
 • console.assert
 • console.count
 • console.countReset
 • console.group
 • console.groupEnd
 • console.clear

In addition to the WHATWG standard, this library also supports the following methods:

 • console.show
 • console.hide

FEATURES

 • Follows the WHATWG Console Standard, which is widely adopted by all major JavaScript runtimes including browsers and Node.js.
 • Provides an out-of-box UI with pre-configured theming, ensuring a clean and professional-looking console.
 • Allows for easy UI customizations to fit your personal preferences.
 • Has extremely simple import and initialization, making it easy to integrate with your existing codebase.

USAGE

1. Import this library:

import algotraderdev/Console/1

2. Initialize the console object:

var console = Console.new()

// You can also specify optional params to customize the look & feel.
var console = Console.new(
  position = position.bottom_right,
  max_rows = 50,
  width = 0,
  text_size = size.normal,
  background_color = #000000CC,
  timestamp_color = #AAAAAA,
  info_message_color = #DDDDDD,
  debug_message_color = #AAAAAA,
  warn_message_color = #FFEB3B,
  error_message_color = #ff3c00)

3. Use the console object to debug your code. Here are some examples:

// Basic logging
console.log('hello world!') // prints 'hello world'
console.warn('warn') // prints 'warn' in yellow
console.error('error') // prints 'error' in red
console.clear() // clears the console

// Assertion
console.assert(a.isEmpty(), 'array should be empty') // prints 'assertion failed: array should be empty' if the array is not empty

// Counter
console.count('fooFunction') // prints 'fooFunction: 1'
console.count('fooFunction') // prints 'fooFunction: 2'
console.countReset('fooFunction') // resets the counter
console.count('fooFunction') // prints 'fooFunction: 1'

// Group
console.log('A')
console.group()
console.log('B')
console.group()
console.log('C')
console.log('D')
console.groupEnd()
console.log('E')
console.groupEnd()
console.log('F')
// prints
// A
//   B
//     C
//     D
//   E
// F

// Hide and show
console.hide()
console.show()
Informacje o Wersji:
Improve performance by not using `var` for constants.
Informacje o Wersji:
It seems that PineScript has released a new version that's not backward compatible and led to the following error in the script: "Invalid object name: log. Namespaces of built-ins cannot be used."
As a result, I had to modify the variable names in the script to bypass the issue.
Informacje o Wersji:
Always set the timezone as `syminfo.timezone` when calling `str.format_time`. It seems that in a new version of PineScript compiler the timezone parameter is no longer optional.

专业缠论指标: alphaviz.pro/chanlun
Email: contact@alphaviz.pro
Discord: discord.gg/w2fFtNega4
Biblioteka Pine

Działając zgodnie z prawdziwym duchem TradingView, autor opublikował ten kod Pine jako bibliotekę o otwartym kodzie źródłowym, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Brawa dla niego! Możesz korzystać z tej biblioteki prywatnie lub w innych publikacjach typu open source, ale ponowne wykorzystanie tego kodu w publikacji podlega Regulaminowi.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz skorzystać z tej biblioteki?

Skopiuj poniższy wiersz i wklej go w swoim skrypcie.