jason5480

math_utils

jason5480 업데이트됨   
Library "math_utils"
Collection of math functions that are not part of the standard math library

num_of_non_decimal_digits(number) num_of_non_decimal_digits - The number of the most significant digits on the left of the dot
  Parameters:
    number: - The floating point number
  Returns: number of non digits

num_of_decimal_digits(number) num_of_decimal_digits - The number of the most significant digits on the right of the dot
  Parameters:
    number: - The floating point number
  Returns: number of decimal digits

floor(number, precision) floor - floor with precision to the given most significant decimal point
  Parameters:
    number: - The floating point number
    precision: - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: number floored to the decimal digits defined by the precision

ceil(number, precision) floor - ceil with precision to the given most significant decimal point
  Parameters:
    number: - The floating point number
    precision: - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: number ceiled to the decimal digits defined by the precision

clamp(number, lower, higher, precision) clamp - clamp with precision to the given most significant decimal point
  Parameters:
    number: - The floating point number
    lower: - The lowerst number limit to return
    higher: - The highest number limit to return
    precision: - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: number clamped to the decimal digits defined by the precision
릴리즈 노트:
v2
Remove simple from time serries
릴리즈 노트:
v3

Added:
clamp_up(number, lower, higher, precision)
  clamp - clamp with precision to the given most significant decimal point. Ceil is favored for the precision rounding.
  Parameters:
    number: - The floating point number
    lower: - The lowerst number limit to return
    higher: - The highest number limit to return
    precision: - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: number clamped to the decimal digits defined by the precision

clamp_down(number, lower, higher, precision)
  clamp - clamp with precision to the given most significant decimal point. Floor is favored for the precision rounding.
  Parameters:
    number: - The floating point number
    lower: - The lowerst number limit to return
    higher: - The highest number limit to return
    precision: - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: number clamped to the decimal digits defined by the precision
릴리즈 노트:
v4
Add overloads that support series precision with none simple parameter
릴리즈 노트:
v5
Add example for quantity calculation
릴리즈 노트:
v6
Use Method syntax for a more intuitive interface!
릴리즈 노트:
v7
Add "simple" overloads for the number itself.
릴리즈 노트:
v8
(minor) use this as an indication for the "self type" instance
릴리즈 노트:
v9

Added:
method floor_to_mintick(this)
  floor_to_mintick - floor with precision to the mintick most significant decimal point
  Namespace types: series float, simple float, input float, const float
  Parameters:
    this (float): - The floating point number
  Returns: - number floored to the decimal digits defined by the mintick precision

method ceil_to_mintick(this)
  ceil_to_mintick - ceil with precision to the mintick most significant decimal point
  Namespace types: series float, simple float, input float, const float
  Parameters:
    this (float): - The floating point number
  Returns: - number ceiled to the decimal digits defined by the mintick precision

Updated:
method num_of_non_decimal_digits(this)
  num_of_non_decimal_digits - The number of the most significant digits on the left of the dot
  Namespace types: series float, simple float, input float, const float
  Parameters:
    this (float): - The floating point number
  Returns: - number of non digits

method num_of_decimal_digits(this)
  num_of_decimal_digits - The number of the most significant digits on the right of the dot
  Namespace types: series float, simple float, input float, const float
  Parameters:
    this (float): - The floating point number
  Returns: - number of decimal digits

method floor(this, precision)
  floor - floor with precision to the given most significant decimal point
  Namespace types: simple float, input float, const float
  Parameters:
    this (simple float): - The floating point number
    precision (int): - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: - number floored to the decimal digits defined by the precision

method ceil(this, precision)
  ceil - ceil with precision to the given most significant decimal point
  Namespace types: simple float, input float, const float
  Parameters:
    this (simple float): - The floating point number
    precision (int): - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: - number ceiled to the decimal digits defined by the precision

method clamp_up(this, lower, higher, precision)
  clamp - clamp with precision to the given most significant decimal point. Ceil is favored for the precision rounding.
  Namespace types: simple float, input float, const float
  Parameters:
    this (simple float): - The floating point number
    lower (float): - The lowerst number limit to return
    higher (float): - The highest number limit to return
    precision (int): - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: - number clamped to the decimal digits defined by the precision

method clamp_down(this, lower, higher, precision)
  clamp_down - clamp with precision to the given most significant decimal point. Floor is favored for the precision rounding.
  Namespace types: simple float, input float, const float
  Parameters:
    this (simple float): - The floating point number
    lower (float): - The lowerst number limit to return
    higher (float): - The highest number limit to return
    precision (int): - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: - number clamped to the decimal digits defined by the precision

method clamp(this, lower, higher, precision)
  clamp - clamp with precision to the given most significant decimal point. No specific direction is favored for the precision rounding.
  Namespace types: simple float, input float, const float
  Parameters:
    this (simple float): - The floating point number
    lower (float): - The lowerst number limit to return
    higher (float): - The highest number limit to return
    precision (int): - The number of decimal places a.k.a the most significant decimal digit - e.g precision 2 will produce 0.01 minimum change
  Returns: - number clamped to the decimal digits defined by the precision

If you're interested in exploring and discovering other high quality free strategies come join us in Discord: discord.gg/2wkm9QqSuY
파인 라이브러리

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

면책사항

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

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

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