PINE LIBRARY

ottlib

124
Library "ottlib"
This library contains functions for the calculation of the OTT (Optimized Trend Tracker)
and its variants, originally created by Anıl Özekşi (Anil_Ozeksi). Special thanks to him for
the concept and to Kıvanç Özbilgiç (KivancOzbilgic) and dg_factor (dg_factor) for
adapting them to Pine Script.

f_vidya(source, length, cmoLength)
  Chande's Variable Index Dynamic Average.
___
**Example**
```
vidyaValue = ottlib.f_vidya(source = close, length = 20)

plot(vidyaValue, color = color.blue)
```
___
  Parameters:
    source (float): (series float) Series of values to process.
    length (simple int): (simple int) Number of bars to lookback.
    cmoLength (simple int): (simple int) Number of bars to lookback for calculating CMO. Default value is `9`.
  Returns: (float) Calculated average of `source` for `length` bars back.

f_mostTrail(source, multiplier)
  Calculates trailing stop value.
___
**Example**
```
mostValue = ottlib.f_mostTrail(source = close, multiplier = 2.0)

plot(mostValue, color = color.orange)
```
___
  Parameters:
    source (float): (series int/float) Series of values to process.
    multiplier (simple float): (simple float) Percent of trailing stop.
  Returns: (float) Calculated value of trailing stop.

f_ottTrail(source, multiplier)
  Calculates OTT-specific trailing stop value.
___
**Example**
```
vidyaValue = ottlib.f_vidya(source = close, length = 20)
ottValue = ottlib.f_ottTrail(source = vidyaValue, multiplier = 1.5)

plot(ottValue, color = vidyaValue >= ottValue ? color.green : color.red)
```
___
  Parameters:
    source (float): (series int/float) Series of values to process.
    multiplier (simple float): (simple float) Percent of trailing stop.
  Returns: (float) Calculated value of OTT-specific trailing stop.

ott(source, length, multiplier)
  Calculates OTT (Optimized Trend Tracker).
___
**Example**
```
[supportLine, ottLine] = ottlib.ott(source = close, length = 2, multiplier = 1.4)

longCondition = ta.crossover(supportLine, ottLine)
shortCondition = ta.crossunder(supportLine, ottLine)
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`.
    length (simple int): (simple int) Number of bars to lookback. Default value is `2`.
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `1.4`.
  Returns: [(float), (float)] Tuple of `supportLine` and `ottLine`.

tott(source, length, multiplier, bandsMultiplier)
  Calculates TOTT (Twin OTT).
___
**Example**
```
[supportLine, upperLine, lowerLine] = ottlib.tott(source = close, length = 40, multiplier = 0.6, bandsMultiplier = 0.0006)

longCondition = ta.crossover(supportLine, upperLine)
shortCondition = ta.crossunder(supportLine, lowerLine)
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`.
    length (simple int): (simple int) Number of bars to lookback. Default value is `40`.
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `0.6`.
    bandsMultiplier (simple float): (simple float) Multiplier for bands. Default value is `0.0006`.
  Returns: [(float), (float), (float)] Tuple of `supportLine`, `upperLine` and `lowerLine`.

totto(source, length, multiplier, bandsMultiplier)
  Calculates TOTTO (Another version of Twin OTT).
___
**Example**
```
[supportLine, upperLine, lowerLine] = ottlib.totto(source = close, length = 35, multiplier = 0.5, bandsMultiplier = 0.0006)

longCondition = ta.crossover(supportLine, upperLine)
shortCondition = ta.crossunder(supportLine, lowerLine)
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`.
    length (simple int): (simple int) Number of bars to lookback. Default value is `35`.
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `0.5`.
    bandsMultiplier (simple float): (simple float) Multiplier for bands. Default value is `0.0006`.
  Returns: [(float), (float), (float)] Tuple of `supportLine`, `upperLine` and `lowerLine`.

ott_channel(source, length, multiplier, ulMultiplier, llMultiplier)
  Calculates OTT Channels.
___
**Example**
```
[ul4, ul3, ul2, ul1, midLine, ll1, ll2, ll3, ll4] = ottlib.ott_channel(source = close, length = 2, multiplier = 1.4, ulMultiplier = 0.01, llMultiplier = 0.01)
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`
    length (simple int): (simple int) Number of bars to lookback. Default value is `2`
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `1.4`
    ulMultiplier (simple float): (simple float) Multiplier for upper line. Default value is `0.01`
    llMultiplier (simple float): (simple float) Multiplier for lower line. Default value is `0.01`
  Returns: [(float), (float), (float), (float), (float), (float), (float), (float), (float)] Tuple of `ul4`, `ul3`, `ul2`, `ul1`, `midLine`, `ll1`, `ll2`, `ll3`, `ll4`.

risotto(source, length, rsiLength, multiplier)
  Calculates RISOTTO (RSI OTT).
___
**Example**
```
[supportLine, risottoLine] = ottlib.risotto(source = close, length = 50, rsiLength = 100, multiplier = 0.2)

longCondition = ta.crossover(supportLine, risottoLine)
shortCondition = ta.crossunder(supportLine, risottoLine)
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`.
    length (simple int): (simple int) Number of bars to lookback. Default value is `50`.
    rsiLength (simple int): (simple int) Number of bars used for RSI calculation. Default value is `100`.
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `0.2`.
  Returns: [(float), (float)] Tuple of `supportLine` and `risottoLine`.

sott(source, kLength, dLength, multiplier)
  Calculates SOTT (Stochastic OTT).
___
**Example**
```
[supportLine, sottLine] = ottlib.sott(source = close, kLength = 500, dLength = 200, multiplier = 0.5)

longCondition = ta.crossover(supportLine, sottLine)
shortCondition = ta.crossunder(supportLine, sottLine)
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`.
    kLength (simple int): (simple int) Stochastic %K length. Default value is `500`.
    dLength (simple int): (simple int) Stochastic %D length. Default value is `200`.
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `0.5`.
  Returns: [(float), (float)] Tuple of `supportLine` and `sottLine`.

hottlott(length, multiplier)
  Calculates HOTT & LOTT (Highest & Lowest OTT).
___
**Example**
```
[hottLine, lottLine] = ottlib.hottlott(length = 20, multiplier = 0.6)

longCondition = ta.crossover(high, hottLine)
shortCondition = ta.crossunder(low, lottLine)
```
___
  Parameters:
    length (simple int): (simple int) Number of bars to lookback. Default value is `20`.
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `0.6`.
  Returns: [(float), (float)] Tuple of `hottLine` and `lottLine`.

rott(source, length, multiplier)
  Calculates ROTT (Relative OTT).
___
**Example**
```
[supportLine, rottLine] = ottlib.rott(source = close, length = 1000, multiplier = 1.0)

isUpTrend = supportLine > rottLine
isDownTrend = supportLine < rottLine
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`.
    length (simple int): (simple int) Number of bars to lookback. Default value is `1000`.
    multiplier (simple float): (simple float) Percent of trailing stop. Default value is `1.0`.
  Returns: [(float), (float)] Tuple of `supportLine` and `rottLine`.

ft(source, length, majorMultiplier, minorMultiplier)
  Calculates Fırsatçı Trend (Opportunist Trend).
___
**Example**
```
[supportLine, ftLine] = ottlib.ft(source = close, length = 30, majorMultiplier = 3.6, minorMultiplier = 1.8)

longCondition = ta.crossover(supportLine, ftLine)
shortCondition = ta.crossunder(supportLine, ftLine)
```
___
  Parameters:
    source (float): (series float) Series of values to process. Default value is `close`.
    length (simple int): (simple int) Number of bars to lookback. Default value is `30`.
    majorMultiplier (simple float): (simple float) Percent of major trend. Default value is `3.6`.
    minorMultiplier (simple float): (simple float) Percent of minor trend. Default value is `1.8`.
  Returns: [(float), (float)] Tuple of `supportLine` and `ftLine`.

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.