Library "utils"
Provides a set of utility functions for use in strategies or indicators.

colorGreen(opacity)
  Parameters:
    opacity (int)

colorRed(opacity)
  Parameters:
    opacity (int)

colorTeal(opacity)
  Parameters:
    opacity (int)

colorBlue(opacity)
  Parameters:
    opacity (int)

colorOrange(opacity)
  Parameters:
    opacity (int)

colorPurple(opacity)
  Parameters:
    opacity (int)

colorPink(opacity)
  Parameters:
    opacity (int)

colorYellow(opacity)
  Parameters:
    opacity (int)

colorWhite(opacity)
  Parameters:
    opacity (int)

colorBlack(opacity)
  Parameters:
    opacity (int)

trendChangingUp(emaShort, emaLong)
  Signals when the trend is starting to change in a positive direction.
  Parameters:
    emaShort (float)
    emaLong (float)
  Returns: bool

trendChangingDown(emaShort, emaLong)
  Signals when the trend is starting to change in a negative direction.
  Parameters:
    emaShort (float)
    emaLong (float)
  Returns: bool

percentChange(start, end)
  Returns the percent change between a start number and end number. A positive change returns a positive value and vice versa.
  Parameters:
    start (float)
    end (float)
  Returns: float

percentOf(percent, n)
  Returns the number that's the percentage of the provided value.
  Parameters:
    percent (float): Use 0.2 for 20 percent, 0.35 for 35 percent, etc.
    n (float): The number to calculate the percentage of.
  Returns: float

targetPriceByPercent(percent, n)
  Parameters:
    percent (float)
    n (float)

hasNegativeSlope(start, end)
  Parameters:
    start (float)
    end (float)

timeinrange(resolution, session, timezone)
  Returns true when the current time is within a given session window. Note, the time is calculated in the "America/New_York" timezone.
  Parameters:
    resolution (simple string): The time interval to use to start/end the background color. Use "1" for the coloring the background up to the minute.
    session (simple string): The session string to use to identify the time window. Example: "0930-1600:23456" means normal market hours on weekdays.
    timezone (simple string)
  Returns: series bool

barsSinceLastEntry()
  Returns the number of bars since the last entry order.
  Returns: series int

barsSinceLastExit()
  Returns the number of bars since the last exit order.
  Returns: series int

calcSlope(ln, lookback)
  Calculates the slope of the provided line based on its x,y coordinates in the previous bar to the current bar.
  Parameters:
    ln (float)
    lookback (int)
  Returns: series float

openPL()
  Returns slope of the line given the start and end x,y coordinates.
  Returns: series float

hasConsecutiveNegativeCandles(lookbackInput)
  Returns true if the number of consecutive red candles matches the provided count.
  Parameters:
    lookbackInput (int): The amount of bars to look back to check for consecutive negative bars. Default = 1.
  Returns: series bool

stdevPercent(stdev, price)
  Returns the standard deviation as a percentage of price.
  Parameters:
    stdev (float): The standard deviation value
    price (float): The current price of the target ticker.
  Returns: series float
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.