LucF

ta

LucF Aktualisiert   
Library "ta"
This library is a Pine Script™ programmer’s tool containing calcs for my oscillators and some helper functions.

buoyancy(src, targetPeriod, maxLookback)
  Calculates buoyancy using a target of `src` summed over `targetPeriod` bars, not searching back farther than `maxLookback` bars. See:   Parameters:
    src: (series float) The source value that is summed to constitute the target.
    targetPeriod: (series int) The qty of bars to sum `src` for in order to calculate the target.
    maxLookback: (simple int) The maximum number of bars back the function will search.
  Returns: (series float) Buoyancy: the gap between the avg distance of past up and dn bars added to reach the target, divided by the max distance reached. Returns zero when an error condition occurs.

efficientWork(length)
  Calculates Efficient Work on `length` bars. See:   Parameters:
    length: (simple int) The length of the ALMA used to calculate the result.
  Returns: (series float) A -1 to +1 value representing the efficiency of price travel, bar to bar.

ma(type, src, length)
  Returns the `type` MA of the `src` over the `length`.
  Parameters:
    type: (simple string) The type of MA required (uses constants that must be defined earlier in the script).
    src: (series float) The source value used to calculate the MA.
    length: (simple int) The length value used to calculate the MA.
  Returns: (series float) The MA value.

divergenceChannel(divergence, hiSrc, loSrc, breachHiSrc, breachLoSrc)
  Calculates the levels and states of divergence channels, which are created when divergences occur.
  Parameters:
    divergence: (series bool) `true` on divergences, which can be defined any way. On breached channels it creates a new channel, otherwise, channel levels are expanded.
    hiSrc: (series float) The price source used to set the channel's hi level when a divergence occurs.
    loSrc: (series float) The price source used to set the channel's lo level when a divergence occurs.
    breachHiSrc: (series float) The price source that must breach over the channel's `channelHi` level for a breach to occur.
    breachLoSrc: (series float) The price source that must breach under the channel's `channelLo` level for a breach to occur.
  Returns: A tuple containing the following values:


sourceStrToFloat(srcString)
  Converts the name of a source in the `srcString` to its numerical equivalent.
  Parameters:
    srcString: (series string) The string representing the name of the source value to be returned.
  Returns: (series float) The source's value.
Versionshinweise:
v2

Added:
sott()
  Calculates an instant value for Signs of the Times, a directional measure of bar strength.
  Returns: (series float) SOTT: a value between -1 and +1.
Versionshinweise:
v3

Added:
zeroOne(cond)
  Converts a "bool" cond to 1 when it is `true`, 0 when it's false.
  Parameters:
    cond (bool): (bool) The "bool" value to be converted.
  Returns: (int) 1 when `cond` is `true`, `false` otherwise.

addTextIf(cond, msg, txt, sep)
  Appends `sep` and `txt` to `msg` when `cond` is true.
  Parameters:
    cond (bool): (bool) The condition determining if text will be added.
    msg (string): (string) The string to which we add text.
    txt (string): (string) The text to be added.
    sep (string): (string) A separator string to be added before `txt` when `msg` already contains text.
  Returns: (int) The modified `msg` string if `cond` is `true`. Returns `msg` unchanged if `cond` is `false`.

gradientAdvDecPro(source, center, steps, bearWeakColor, bearStrongColor, bullWeakColor, bullStrongColor)
  Calculates a gradient between two bull or two bear colors, depending on whether the source signal is above/below the centerline.
The gradient is proportional to the current qty of advances/declines of the `source`.
The count of advances/declines resets to one when the `source` crosses the `center` and is limited by `steps`.
  Parameters:
    source (float): (float) input signal.
    center (float): (float) (- ∞ to ∞) centerline used to determine if signal is bullish/bearish.
    steps (float): (float) Maximum number of steps in the gradient from the weak color to the strong color.
    bearWeakColor (color): (color) bear color at adv/dec qty of 1.
    bearStrongColor (color): (color) bear color at adv/dec qty of `steps`.
    bullWeakColor (color): (color) bull color at adv/dec qty of 1.
    bullStrongColor (color): (color) bull color at adv/dec qty of `steps`.
  Returns: (color) The calculated color.

upDnIntrabarVolumesByPolarity()
  Determines if the volume for an intrabar is up or down.
  Returns: () A tuple of two values, one of which contains the bar's volume. `upVol` is the positive volume of up bars. `dnVol` is the negative volume of down bars.
Note that when this function is designed to be called with `request.security_lower_tf()`,
which will return a tuple of "array" arrays containing up and dn volume for all the intrabars in a chart bar.

"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

www.tradingview.com/u/PineCoders/
www.tradingview.com/u/TradingView/
Pine Bibliothek

In echter TradingView-Manier hat der Autor diesen Pine-Code als Open-Source-Bibliothek veröffentlicht, so dass andere Pine-Programmierer aus unserer Community ihn weiterverwenden können. Ein Hoch auf den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Publikationen verwenden, aber die Wiederverwendung dieses Codes in einer Publikation unterliegt den Hausregeln.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie diese Bibliothek nutzen?

Kopieren Sie die folgende Zeile und fügen Sie sie in Ihr Skript ein.