PINE LIBRARY

utils

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
colorsMATHtimesessions

Perpustakaan pine

Dengan semangat TradingView yang sesungguhnya, penulis telah menerbitkan Kode Pine ini sebagai pustaka sumber terbuka sehingga programmer Pine lain dari komunitas kami dapat menggunakannya kembali. Hormat untuk penulis! Anda dapat menggunakan pustaka ini secara pribadi atau dalam publikasi sumber terbuka lainnya, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib.

Pernyataan Penyangkalan