marcelokg

libKageMisc

marcelokg Atualizado   
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.
Notas de Lançamento:
v2

Wrong backtest removal. Sorry for any trouble.
Notas de Lançamento:
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.
Notas de Lançamento:
v4
Notas de Lançamento:
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.
Notas de Lançamento:
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
Biblioteca do Pine

No verdadeiro espírito TradingView, o autor publicou este código de Pine como uma biblioteca de código aberto para que outros programadores de Pine de nossa comunidade possam reutilizá-lo. Um brinde ao autor! Você pode usar esta biblioteca em particular ou em outras publicações de código aberto, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Gostaria de usar essa biblioteca?

Copie a seguinte linha e cole-a em seu script.