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
파인 라이브러리

트레이딩뷰 정신에 따라 오써는 이 파인 코드를 오픈 소스 라이브러리로 퍼블리쉬하여 당사 커뮤니티의 다른 파인 프로그래머들이 쓸 수 있도록 하였습니다. 오써에게 찬사를! 여러분은 이 라이브러리를 프라이빗 또는 오픈 소스 퍼블리케이션에 쓸 수 있지만 퍼블리케이션에 재사용은 하우스룰을 따릅니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

이 라이브러리를 쓰시겠습니까?

텍스트를 클립보드에 카피한 뒤 님의 스크립트에 붙여 넣기.