PINE LIBRARY

libKageMisc

已更新
Library "libKageMisc"
Kage's Miscelaneous library

print(_value)
  Print a numerical value in a label at last historical bar.
  Parameters:
    _value: (float) The value to be printed.
  Returns: Nothing.

barsBackToDate(_year, _month, _day)
  Get the number of bars we have to go back to get data from a specific date.
  Parameters:
    _year: (int) Year of the specific date.
    _month: (int) Month of the specific date. Optional. Default = 1.
    _day: (int) Day of the specific date. Optional. Default = 1.
  Returns: (int) Number of bars to go back until reach the specific date.

bodySize(_index)
  Calculates the size of the bar's body.
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.
  Returns: (float) The size of the bar's body in price units.

shadowSize(_direction)
  Size of the current bar shadow. Either "top" or "bottom".
  Parameters:
    _direction: (string) Direction of the desired shadow.
  Returns: (float) The size of the chosen bar's shadow in price units.

shadowBodyRatio(_direction)
  Proportion of current bar shadow to the bar size
  Parameters:
    _direction: (string) Direction of the desired shadow.
  Returns: (float) Ratio of the shadow size per body size.

bodyCloseRatio(_index)
  Proportion of chosen bar body size to the close price
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.()
  Returns: (float) Ratio of the body size per close price.

lastDayOfMonth(_month)
  Returns the last day of a month.
  Parameters:
    _month: (int) Month number.
  Returns: (int) The number (28, 30 or 31) of the last day of a given month.

nameOfMonth(_month)
  Return the short name of a month.
  Parameters:
    _month: (int) Month number.
  Returns: (string) The short name ("Jan", "Feb"...) of a given month.

pl(_initialValue, _finalValue)
  Calculate Profit/Loss between two values.
  Parameters:
    _initialValue: (float) Initial value.
    _finalValue: (float) Final value = Initial value + delta.
  Returns: (float) Profit/Loss as a percentual change.

gma(_Type, _Source, _Length)
  Generalist Moving Average (GMA).
  Parameters:
    _Type: (string) Type of average to be used. Either "EMA", "HMA", "RMA", "SMA", "SWMA", "WMA" or "VWMA".
    _Source: (series float) Series of values to process.
    _Length: (simple int) Number of bars (length).
  Returns: (float) The value of the chosen moving average.

xFormat(_percentValue, _minXFactor)
  Transform a percentual value in a X Factor value.
  Parameters:
    _percentValue: (float) Percentual value to be transformed.
    _minXFactor: (float) Minimum X Factor to that the conversion occurs. Optional. Default = 10.
  Returns: (string) A formated string.

isLong()
  Check if the open trade direction is long.
  Returns: (bool) True if the open position is long.

isShort()
  Check if the open trade direction is short.
  Returns: (bool) True if the open position is short.

lastPrice()
  Returns the entry price of the last openned trade.
  Returns: (float) The last entry price.

barsSinceLastEntry()
  Returns the number of bars since last trade was oppened.
  Returns: (series int)

getBotNameFrosty()
  Return the name of the FrostyBot Bot.
  Returns: (string) A string containing the name.

getBotNameZig()
  Return the name of the FrostyBot Bot.
  Returns: (string) A string containing the name.

getTicksValue(_currencyValue)
  Converts currency value to ticks
  Parameters:
    _currencyValue: (float) Value to be converted.
  Returns: (float) Value converted to minticks.

getSymbol(_botName, _botCustomSymbol)
  Formats the symbol string to be used with a bot
  Parameters:
    _botName: (string) Bot name constant. Either BOT_NAME_FROSTY or BOT_NAME_ZIG. Optional. Default is empty string.
    _botCustomSymbol: (string) Custom string. Optional. Default is empy string.
  Returns: (string) A string containing the symbol for the bot. If all arguments are empty, the current symbol is returned in Binance format.

showProfitLossBoard()
  Calculates and shows a board of Profit/Loss through the years.
  Returns: Nothing.
版本注释
v2

Wrong backtest removal. Sorry for any trouble.
版本注释
v3

Added:
barSize(_index)
  Calculates the size of the bar with both shadows.
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.
  Returns: (float) The size of the bar in price units.

barBodyRatio(_index)
  Proportion of chosen bar size to the body size
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.()
  Returns: (float) Percent ratio of the body size per close price.

Updated:
bodyCloseRatio(_index)
  Proportion of chosen bar body size to the close price
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.()
  Returns: (float) Percent ratio of the body size per close price.
版本注释
v4
版本注释
v5

Added:
bodyStoch(_index, _length)
  A stochastic meassure for the the body size
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.
    _length: (simple int) How many bars look back to stochastic calculus. Default = 0.
  Returns: (float) Percent ratio of the body stochastic measure.

Updated:
bodyBarRatio(_index)
  Proportion of chosen bar size to the body size
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.
  Returns: (float) Percent ratio of the body size per close price.

bodyCloseRatio(_index)
  Proportion of chosen bar body size to the close price
  Parameters:
    _index: (simple int) The historical index of the bar. Optional. Default = 0.
  Returns: (float) Percent ratio of the body size per close price.
版本注释
v6

Added:
barsSinceTradeEntry(_tradeIndex, _type)
  Returns the number of bars since the chosen trade's entry
  Parameters:
    _tradeIndex: (int) Trade index from wich the information is wanted
    _type: (string) Type of trade. "O" for open trade or "C" for closed trade. Optional. Default is "O"
  Returns: (series int) Number of bars
MATHstatisticsstrategies

Pine脚本库

本着真正的TradingView精神,作者将此Pine代码发布为开源脚本库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私下或在其它开源出版物中使用此脚本库,但在出版物中重复使用此代码受网站规则约束。

免责声明