liyugen

LYGLibrary

liyugen 업데이트됨   
Library "LYGLibrary"
A collection of custom tools & utility functions commonly used with my scripts

getDecimals()
  Calculates how many decimals are on the quote price of the current market
  Returns: The current decimal places on the market quote price

truncate(number, decimalPlaces)
  Truncates (cuts) excess decimal places
  Parameters:
    number (float)
    decimalPlaces (simple float)
  Returns: The given number truncated to the given decimalPlaces

toWhole(number)
  Converts pips into whole numbers
  Parameters:
    number (float)
  Returns: The converted number

toPips(number)
  Converts whole numbers back into pips
  Parameters:
    number (float)
  Returns: The converted number

getPctChange(value1, value2, lookback)
  Gets the percentage change between 2 float values over a given lookback period
  Parameters:
    value1 (float)
    value2 (float)
    lookback (int)

av_getPositionSize(balance, risk, stopPoints, conversionRate)
  Calculates OANDA forex position size for AutoView based on the given parameters
  Parameters:
    balance (float)
    risk (float)
    stopPoints (float)
    conversionRate (float)
  Returns: The calculated position size (in units - only compatible with OANDA)

bullFib(priceLow, priceHigh, fibRatio)
  Calculates a bullish fibonacci value
  Parameters:
    priceLow (float): The lowest price point
    priceHigh (float): The highest price point
    fibRatio (float): The fibonacci % ratio to calculate
  Returns: The fibonacci value of the given ratio between the two price points

bearFib(priceLow, priceHigh, fibRatio)
  Calculates a bearish fibonacci value
  Parameters:
    priceLow (float): The lowest price point
    priceHigh (float): The highest price point
    fibRatio (float): The fibonacci % ratio to calculate
  Returns: The fibonacci value of the given ratio between the two price points

getMA(length, maType)
  Gets a Moving Average based on type (MUST BE CALLED ON EVERY CALCULATION)
  Parameters:
    length (simple int)
    maType (string)
  Returns: A moving average with the given parameters

getEAP(atr)
  Performs EAP stop loss size calculation (eg. ATR >= 20.0 and ATR < 30, returns 20)
  Parameters:
    atr (float)
  Returns: The EAP SL converted ATR size

getEAP2(atr)
  Performs secondary EAP stop loss size calculation (eg. ATR < 40, add 5 pips, ATR between 40-50, add 10 pips etc)
  Parameters:
    atr (float)
  Returns: The EAP SL converted ATR size

barsAboveMA(lookback, ma)
  Counts how many candles are above the MA
  Parameters:
    lookback (int)
    ma (float)
  Returns: The bar count of how many recent bars are above the MA

barsBelowMA(lookback, ma)
  Counts how many candles are below the MA
  Parameters:
    lookback (int)
    ma (float)
  Returns: The bar count of how many recent bars are below the EMA

barsCrossedMA(lookback, ma)
  Counts how many times the EMA was crossed recently
  Parameters:
    lookback (int)
    ma (float)
  Returns: The bar count of how many times price recently crossed the EMA

getPullbackBarCount(lookback, direction)
  Counts how many green & red bars have printed recently (ie. pullback count)
  Parameters:
    lookback (int)
    direction (int)
  Returns: The bar count of how many candles have retraced over the given lookback & direction

getBodySize()
  Gets the current candle's body size (in POINTS, divide by 10 to get pips)
  Returns: The current candle's body size in POINTS

getTopWickSize()
  Gets the current candle's top wick size (in POINTS, divide by 10 to get pips)
  Returns: The current candle's top wick size in POINTS

getBottomWickSize()
  Gets the current candle's bottom wick size (in POINTS, divide by 10 to get pips)
  Returns: The current candle's bottom wick size in POINTS

getBodyPercent()
  Gets the current candle's body size as a percentage of its entire size including its wicks
  Returns: The current candle's body size percentage

isHammer(fib, colorMatch)
  Checks if the current bar is a hammer candle based on the given parameters
  Parameters:
    fib (float)
    colorMatch (bool)
  Returns: A boolean - true if the current bar matches the requirements of a hammer candle

isStar(fib, colorMatch)
  Checks if the current bar is a shooting star candle based on the given parameters
  Parameters:
    fib (float)
    colorMatch (bool)
  Returns: A boolean - true if the current bar matches the requirements of a shooting star candle

isDoji(wickSize, bodySize)
  Checks if the current bar is a doji candle based on the given parameters
  Parameters:
    wickSize (float)
    bodySize (float)
  Returns: A boolean - true if the current bar matches the requirements of a doji candle

isBullishEC(allowance, rejectionWickSize, engulfWick)
  Checks if the current bar is a bullish engulfing candle
  Parameters:
    allowance (float)
    rejectionWickSize (float)
    engulfWick (bool)
  Returns: A boolean - true if the current bar matches the requirements of a bullish engulfing candle

isBearishEC(allowance, rejectionWickSize, engulfWick)
  Checks if the current bar is a bearish engulfing candle
  Parameters:
    allowance (float)
    rejectionWickSize (float)
    engulfWick (bool)
  Returns: A boolean - true if the current bar matches the requirements of a bearish engulfing candle

isInsideBar()
  Detects inside bars
  Returns: Returns true if the current bar is an inside bar

isOutsideBar()
  Detects outside bars
  Returns: Returns true if the current bar is an outside bar

barInSession(sess, useFilter)
  Determines if the current price bar falls inside the specified session
  Parameters:
    sess (simple string)
    useFilter (bool)
  Returns: A boolean - true if the current bar falls within the given time session

barOutSession(sess, useFilter)
  Determines if the current price bar falls outside the specified session
  Parameters:
    sess (simple string)
    useFilter (bool)
  Returns: A boolean - true if the current bar falls outside the given time session

dateFilter(startTime, endTime)
  Determines if this bar's time falls within date filter range
  Parameters:
    startTime (int)
    endTime (int)
  Returns: A boolean - true if the current bar falls within the given dates

dayFilter(monday, tuesday, wednesday, thursday, friday, saturday, sunday)
  Checks if the current bar's day is in the list of given days to analyze
  Parameters:
    monday (bool)
    tuesday (bool)
    wednesday (bool)
    thursday (bool)
    friday (bool)
    saturday (bool)
    sunday (bool)
  Returns: A boolean - true if the current bar's day is one of the given days

atrFilter(atrValue, maxSize)
  Parameters:
    atrValue (float)
    maxSize (float)

fillCell(tableID, column, row, title, value, bgcolor, txtcolor)
  This updates the given table's cell with the given values
  Parameters:
    tableID (table)
    column (int)
    row (int)
    title (string)
    value (string)
    bgcolor (color)
    txtcolor (color)
  Returns: A boolean - true if the current bar falls within the given dates
릴리즈 노트:
v2

Added:
barInSession2(sess, useFilter)
  Determines if the current price bar falls inside the specified session
  Parameters:
    sess (simple string)
    useFilter (bool)
  Returns: A boolean - true if the current bar falls within the given time session

파인 라이브러리

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

면책사항

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

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

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