bunulu

Helpers library

bunulu Pro+ Updated   
Library "Helpers"

ma(source, length, type)
  Generates moving average based on the given parameters
  Parameters:
    source: - series
    length: - length of the moving average
    type: - type of moving average ( SMA , WMA , VWMA , RMA, HMA , LSMA , MAEMA, TMA) default: EMA
@ returns - moving average series

nearby(a, b, atr_period, atr_deviation)
  Finds the 2 points are nearby
  Parameters:
    a: - first source
    b: - second source
    atr_period: - period of ATR
    atr_deviation: - deviation of ATR
@ returns true if MA was crossed, false otherwise

has(source, n, length, from)
  Checks if for given period of time there was minimum 'n' bars with source condition
  Parameters:
    source: - condition to check
    n: - minimum number of bars with condition
    length: - bars back to check
    from: - bars back to check from
@ returns boolean
Release Notes: v2

Added:
hugeBar(atr_length, percent)
  Finds huge bars
  Parameters:
    atr_length: - average true range length
    percent: - percentage to be considered huge
@ returns boolean

Updated:
has(condition, n, length, from)
  Checks if for given period of time there was minimum 'n' bars with source condition
  Parameters:
    condition: - condition to check
    n: - minimum number of bars with condition
    length: - bars back to check
    from: - bars back to check from
@ returns boolean
Release Notes: v3

Updated:
has(condition, n, length, from)
  Checks if for given period of time there was minimum 'n' bars with source condition
  Parameters:
    condition: - condition to check
    n: - minimum number of bars with condition
    length: - bars back to check
    from: - bars back to check from
@ returns boolean series
Release Notes: v4

Added:
hasConditionInBetween(leftCondition, rightCondition, condition, n)
  Checks if the given source condition is true between the left and right conditions
  Parameters:
    leftCondition: - first condition to check
    rightCondition: - second condition to check
    condition: - condition to check in between leftCondition and rightCondition
    n: - occurences of condition has to be between leftCondition and rightCondition
@ returns boolean series
Release Notes: v5

Updated:
has(condition, n, length, from)
  Checks if for given period of time there was minimum 'n' bars with source condition
  Parameters:
    condition: - condition to check
    n: - minimum number of bars with condition
    length: - bars back to check
    from: - bars back to check from
@ returns boolean series
Release Notes: v6

Added:
volumeSpike(length, ma_type)
  Checks if for given bar there was a volume spike
  Parameters:
    length: - bars back to check, default is 20
    ma_type: - type of moving average (SMA, WMA, VWMA, RMA, HMA, LSMA, TMA, MAEMA) default: SMA
@ returns huge volume bar series

Updated:
hugeBar(atr_length, percent, ma_type)
  Finds huge bars
  Parameters:
    atr_length: - average true range length, 14 is default
    percent: - percentage to be considered huge, 190 is default
    ma_type: - type of moving average (SMA, WMA, VWMA, RMA, HMA, LSMA, TMA, MAEMA) default: SMA
@ returns boolean
Release Notes: v7

Added:
barMsg(condition, msg, step, from, until, color, size)
  Shows message on bars when the given source condition is true
Was inspired by giving credits to the author
  Parameters:
    condition: - If na, then shows message on a last bar
    msg: - message to show
    step: - Step determines the separation between bars identified in the chart.
For example, step=10 will show every 1 in every 10 bars indexes.
    from: Show bars from this index
    until: Show bars until this index.
The default until=0 will show all bars
    color: The color of the bar index text on the chart
    size: The size of the text
Release Notes: v8

Updated:
has(condition, min, max, left_index, right_index)
  Checks if for given period of time there was minimum 'n' bars with source condition
  Parameters:
    condition: - condition to check
    min: - minimum number of bars with condition
    max: - maximum number of bars with condition
    left_index: - index of the left bar, default is 20
    right_index: - index of the right bar, default is 0
@ returns boolean series

barMsg(condition, msg, step, from, until, color, size)
  Shows message on bars when the given source condition is true
Was inspired by giving credits to the author
  Parameters:
    condition: - If na, then shows message on a last bar
    msg: - message to show
    step: - Step determines the separation between bars identified in the chart.
For example, step=10 will show every 1 in every 10 bars indexes.
    from: Show bars from this index
    until: Show bars until this index.
The default until=0 will show all bars
    color: The color of the bar index text on the chart
    size: The size of the text
Release Notes: v9

Updated:
hasConditionInBetween(leftCondition, rightCondition, condition, min, max)
  Checks if the given source condition is true between the left and right conditions
  Parameters:
    leftCondition: - first condition to check
    rightCondition: - second condition to check
    condition: - condition to check in between leftCondition and rightCondition
    min: - minimum number of bars with condition
    max: - maximum number of bars with condition
@ returns boolean series
Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House Rules.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this library?

Copy the following line and paste it in your script.