LonesomeTheBlue

LibraryPrivateUsage001

This is a public library that include the functions explained below. The libraries are considered public domain code and permission is not required from the author if you reuse these functions in your open-source scripts
Release Notes: updated
Release Notes: updated.
Release Notes: .
Release Notes: updated
Release Notes: updated
Release Notes: Library "LibraryPrivateUsage001"
This is a public library (used for math operations) that includes the functions explained below. The libraries are considered public domain code and permission is not required from the author if you reuse these functions in your open-source scripts. Before using this library you better check the House Rules.

isFine(l1, l2, index, v1) checks if l1/l2 is between v1 and v2
  Parameters:
    l1: float
    l2: float
    index: then number of elements in the array to compare
    v1: and v2 the values to compare with l1/l2
  Returns: true if l1/l2is between v1 and v2

getRMinmax1(mima, arr, const) assigns maximum and minimum values to the array mima
  Parameters:
    mima: is the array to set max/min
    arr: is the array to get values to compare
    const: is the array to get constant values that used while calculating max/min
  Returns: changes the mima array and set the elements to get max/min that is calculated using values and contants

getRMinmax3(mima, arr, const, loc) assigns maximum and minimum values to the array mima
  Parameters:
    mima: is the array to set max/min
    arr: is the array to get values to compare
    const: is the array to get constant values that used while calculating max/min
    loc: the index of the element in the const array
  Returns: changes the mima array and set the elements to get max/min that is calculated using values and contants

getRMinmax2(mima, arr, const, loc) assigns maximum and minimum values to the array mima
  Parameters:
    mima: is the array to set max/min
    arr: is the array to get values to compare
    const: is the array to get constant values that used while calculating max/min
    loc: the index of the element in the const array
  Returns: changes the mima array and set the elements to get max/min that is calculated using values and contants

checkType1(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType2(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType3(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType4(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType5(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType10(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType11(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType12(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType13(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

CheckRtype1(vals, consts) checks conditions and if the conditions met then get max/min values and assign them to elements mima array
  Parameters:
    vals: array to to get values
    consts: array of constant values
  Returns: mima array if all conditions met

CheckRtype2(vals, consts) checks conditions and if the conditions met then get max/min values and assign them to elements mima array
  Parameters:
    vals: array to to get values
    consts: array of constant values
  Returns: mima array if all conditions met

setPPLocs(pre_loc, arr, index) checks mima array and if conditions met assigns the elements of pre_loc array
  Parameters:
    pre_loc: keeps the elements that is set when conditions met
    arr: is an array which keeps the values to compare
    index: is an integer value that is used as index while assigning values to pre_loc array
  Returns: mima is the array that keeps max/min values
Release Notes: v8

Added:
checkType14(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

checkType15(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
  Parameters:
    thiscond: to check if it's true
    rates_array: to get values to compare
    arr: keeps the values to compare them with the elements of rates_array
  Returns: true if all conditions met

findmaxup(ylev, arr, mindis, index) checks arr array and if distance is greater than mindis
  Parameters:
    ylev: is used to check level
    arr: is an array which keeps the values to compare
    mindis: is the distance
    index: is start value for the loop
  Returns: the location in arr

findmaxdown(ylev, arr, mindis, index) checks arr array and if distance is greater than mindis
  Parameters:
    ylev: is used to check level
    arr: is an array which keeps the values to compare
    mindis: is the distance
    index: is start value for the loop
  Returns: the location in arr

find_x_loc(x, a) used find right level
  Parameters:
    x: and xl is used for x
    a: and al is used for a
  Returns: xl for x

get_minmax(mvar) used find minmax value from the array
  Parameters:
    mvar: is used to search which part
  Returns: levels and ind
Release Notes: v9

Added:
checksmType(mc_arr, allvalues, const_array, mh_arr, mk_arr) checks checksmType using all values and the const arrays
  Parameters:
    mc_arr: keeps c values
    allvalues: keeps all values variables
    const_array: keeps constant values
    mh_arr: keeps h values
    mk_arr: keeps l values
  Returns: dloc variable if all conditions met
Release Notes: v10

Added:
getPredictedPatterns(thiscond, pprates, xtod, pp, pp_loc, D, side) search all types according to thiscond array
  Parameters:
    thiscond: is the array that keeps if element is enabled
    pprates: keeps the contstant values for related element
    xtod: keeps all values
    pp: keep the valus if there is any suitable
    pp_loc: keep the locs if there is any suitable
    D: is the last point
    side: keeps the side
  Returns: pp and pp_loc arrays
Release Notes: v11

Added:
fxl(x, a) used find right level
  Parameters:
    x: and xl is used for x
    a: and al is used for a
  Returns: xl for x

gmm(mvar) used find minmax value from the array
  Parameters:
    mvar: is used to search which part
  Returns: levels and ind

getpps(thiscond, ppr, xtod, pp, ppl, D, sd) search all types according to thiscond array
  Parameters:
    thiscond: is the array that keeps if element is enabled
    ppr: keeps the contstant values for related element
    xtod: keeps all values
    pp: keep the valus if there is any suitable
    ppl: keep the locs if there is any suitable
    D: is the last point
    sd: keeps the sd
  Returns: pp and ppl arrays

Updated:
findmaxup(ylv, arr, mindis, index) checks arr array and if distance is greater than mindis
  Parameters:
    ylv: is used to check level
    arr: is an array which keeps the values to compare
    mindis: is the distance
    index: is start value for the loop
  Returns: the location in arr

findmaxdown(ylv, arr, mindis, index) checks arr array and if distance is greater than mindis
  Parameters:
    ylv: is used to check level
    arr: is an array which keeps the values to compare
    mindis: is the distance
    index: is start value for the loop
  Returns: the location in arr

Removed:
isFine(l1, l2, index, v1) checks if l1/l2 is between v1 and v2

setPPLocs(pre_loc, arr, index) checks mima array and if conditions met assigns the elements of pre_loc array

find_x_loc(x, a) used find right level

get_minmax(mvar) used find minmax value from the array

getPredictedPatterns(thiscond, pprates, xtod, pp, pp_loc, D, side) search all types according to thiscond array
Release Notes: v12

Added:
checkcondtype1(cond, allina, allinp, add) checks conditions and remove the element if condition is not met
  Parameters:
    cond: condition to compare
    allina: keeps all conditions
    allinp: if condition is not met remove the element from this array
    add: used to calculate index
  Returns: none

checkcondtype2(cond, allina, allinp, add) checks conditions and remove the element if condition is not met
  Parameters:
    cond: condition to compare
    allina: keeps all conditions
    allinp: if condition is not met remove the element from this array
    add: used to calculate index
  Returns: none

Updated:
getRMinmax1(mima, c1, c2, a1, a2) assigns maximum and minimum values to the array mima
  Parameters:
    mima: is the array to get max/min
    c1: first c value
    c2: second c value
    a1: first a value
    a2: second a value
  Returns: changes the mima array and set the elements to get max/min that is calculated using values and contants

getRMinmax2(mima, c1, c2) assigns maximum and minimum values to the array mima
  Parameters:
    mima: is the array to set max/min
    c1: first c value
    c2: second c value
  Returns: changes the mima array and set the elements to get max/min that is calculated using values and contants

CheckRtype1()

CheckRtype2()

getpps()

Removed:
getRMinmax3(mima, arr, const, loc) assigns maximum and minimum values to the array mima

checkType1(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array

checkType2(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array

checkType3(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array

checkType4(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array

checkType5(thiscond, rates_array, arr) checks if thiscond is true and elements of rates array is between the elements of rates_array
Release Notes: v13

Updated:
CheckRtype1(vals, consts) checks conditions and if the conditions met then get max/min values and assign them to elements mima array
  Parameters:
    vals: array to to get values
    consts: array of constant values
  Returns: mima array if all conditions met

CheckRtype2(vals, consts) checks conditions and if the conditions met then get max/min values and assign them to elements mima array
  Parameters:
    vals: array to to get values
    consts: array of constant values
  Returns: mima array if all conditions met

getpps(thiscond, ppr, xtod, pp, ppl, D, sd) search all types according to thiscond array
  Parameters:
    thiscond: is the array that keeps if element is enabled
    ppr: keeps the contstant values for related element
    xtod: keeps all values
    pp: keep the valus if there is any suitable
    ppl: keep the locs if there is any suitable
    D: is the last point
    sd: keeps the sd
  Returns: pp and ppl arrays
Release Notes: v14

Removed:
getRMinmax1(c1, c2, a1, a2) finds minimum of the maximums and set the array

getRMinmax2(c1, c2, a1, a2) finds minimum of the maximums and set the array

checkcondtype1(cond, allina, allinp, add) checks the condition and if condition is not met then removes the element

checkcondtype2(cond, allina, allinp, add) checks the condition and if condition is not met then removes the element
Release Notes: v15

Added:
getRMinmax1(mima, c1, c2, a1, a2) assigns maximum and minimum values to the array mima
  Parameters:
    mima: is the array to keep max/min
    c1: first var of part1
    c2: second var of part1
    a1: first var of part2
    a2: second var of part2
  Returns: none

getRMinmax2(mima, c1, c2) assigns maximum and minimum values to the array mima
  Parameters:
    mima: is the array to keep max/min
    c1: first var
    c2: second var
  Returns: none

checkcondtype1(cond, allina, allinp, add) removes the element if the condition is not met
  Parameters:
    cond: the condition to check
    allina: keeps constant values
    allinp: the array which the function removes the element
    add: is the index for the arrays
  Returns: null

checkcondtype2(cond, allina, allinp, add) removes the element if the condition is not met
  Parameters:
    cond: the condition to check
    allina: keeps constant values
    allinp: the array which the function removes the element
    add: is the index for the arrays
  Returns: null

Updated:
getpps(thiscond, allina, xtod, D, sd, drw) search all types according to thiscond array
  Parameters:
    thiscond: is the array that keeps if element is enabled
    allina: keeps constant values
    xtod: keeps all values
    D: is the last point
    sd: keeps the sd
    drw: keeps if it's enabled or not
  Returns: pp and ppl arrays

Removed:
CheckRtype1(vals, consts) checks conditions and if the conditions met then get max/min values and assign them to elements mima array

CheckRtype2(vals, consts) checks conditions and if the conditions met then get max/min values and assign them to elements mima array
Release Notes: v16

Added:
getthepoints(allpoints, side, mplen, mploc) finds all possible points by using allpoints array
  Parameters:
    allpoints: contains all points in it
    side: keeps the current side
    mplen: keeps the length of mp
    mploc: keeps the location of mp
  Returns: apat array that contains possible points

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.