Liking cljdoc? Tell your friends :D

bortexz.tacos


accumulation-distribution-lineclj

(accumulation-distribution-line tl {:keys [close high low volume] :as sources})

Returns tuple of [adl money-flow-multiplier money-flow-volume] indicators.

Reference:

Sources:

  • close
  • high
  • low
  • volume
Returns tuple of [adl money-flow-multiplier money-flow-volume] indicators.

Reference:
- https://www.tradingview.com/support/solutions/43000501770-accumulation-distribution-adl/

Sources:
- `close`
- `high`
- `low`
- `volume`
sourceraw docstring

aroon-oscillatorclj

(aroon-oscillator tl {:keys [high low]} {:keys [period] :as opts})

Returns tuple of nodes [aroon-oscillator aroon-up aroon-down], vals between 0 and 1

Reference:

Sources:

  • high
  • low

Opts:

  • period
Returns tuple of nodes [aroon-oscillator aroon-up aroon-down], vals between 0 and 1

Reference:
- https://www.investopedia.com/terms/a/aroonoscillator.asp

Sources:
- `high`
- `low`

Opts:
- `period`
sourceraw docstring

average-base-rangeclj

(average-base-range tl
                    {:keys [high low] :as sources}
                    {:keys [avg-indicator period]
                     :or {avg-indicator relative-moving-average}})

moving average of base-range.

Sources:

  • high
  • low

Opts:

  • avg-indicator defaults to relative-moving-average, must accept source as :src
  • period passed to avg-indicator as :period
moving average of [[base-range]]. 

Sources:
- `high`
- `low`

Opts: 
- `avg-indicator` defaults to [[relative-moving-average]], must accept source as `:src`
- `period` passed to `avg-indicator` as :period
sourceraw docstring

average-directional-indexclj

(average-directional-index tl
                           {:keys [close high low] :as sources}
                           {:keys [adx-avg-indicator adx-avg-opts
                                   range-indicator range-opts line-avg-indicator
                                   line-avg-opts]
                            :or {adx-avg-indicator exponential-moving-average
                                 range-indicator average-true-range
                                 line-avg-indicator exponential-moving-average}
                            :as opts})

Returns tuple of [adx di+ di-] nodes, where adx is between 0 and 1.

Reference:

Sources:

  • close
  • high
  • low

Opts:

  • range-indicator range indicator to use, will be called with top level sources. Defaults to average-true-range
  • range-opts if specified, overrides top level opts passed to range indicator.
  • line-avg-indicator defaults to exponential-moving-average
  • line-avg-opts if specified, overrides top level opts passed to line-avg-indicator
  • adx-avg-indicator defaults to exponential-moving-average
  • adx-avg-opts if specified, overrides top level opts on adx-avg-indicator
Returns tuple of [adx di+ di-] nodes, where adx is between 0 and 1.

Reference:
- https://www.investopedia.com/ask/answers/112814/how-average-directional-index-adx-calculated-and-what-formula.asp

Sources:
- `close`
- `high`
- `low`

Opts:
- `range-indicator` range indicator to use, will be called with top level `sources`. Defaults to [[average-true-range]]
- `range-opts` if specified, overrides top level `opts` passed to range indicator.
- `line-avg-indicator` defaults to [[exponential-moving-average]]
- `line-avg-opts` if specified, overrides top level opts passed to `line-avg-indicator`
- `adx-avg-indicator` defaults to [[exponential-moving-average]]
- `adx-avg-opts` if specified, overrides top level `opts` on `adx-avg-indicator`
sourceraw docstring

average-true-rangeclj

(average-true-range tl
                    {:keys [close high low] :as sources}
                    {:keys [avg-indicator period]
                     :or {avg-indicator relative-moving-average}})

moving average of true-range.

Reference:

Sources:

  • close
  • high
  • low

Opts:

  • avg-indicator defaults to relative-moving-average, must accept source as :src
  • period passed to avg-indicator as :period
moving average of [[true-range]]. 

Reference:
- https://www.investopedia.com/terms/a/atr.asp (ATR)

Sources:
- `close`
- `high`
- `low`

Opts:
- `avg-indicator` defaults to [[relative-moving-average]], must accept source as `:src`
- `period` passed to `avg-indicator` as :period
sourceraw docstring

base-rangeclj

(base-range tl {:keys [high low]})

high - low

Sources:

  • high
  • low
high - low

Sources:
- `high`
- `low`
sourceraw docstring

bollinger-bandsclj

(bollinger-bands tl
                 {:keys [src] :as sources}
                 {:keys [avg-indicator period avg-opts stdev-opts multiplier]
                  :or {avg-indicator simple-moving-average}
                  :as opts})

Returns tuple of nodes [upper middle lower] for bollinger bands.

Reference:

Sources:

  • src

Opts:

  • avg-indicator for middle band. Defaults to simple-moving-average, must accept source as :src
  • avg-opts if specified, overrides top level opts for avg-indicator
  • stdev-opts if specified, overrides top level opts for standard-deviation
Returns tuple of nodes [upper middle lower] for bollinger bands.

Reference:
- https://www.investopedia.com/terms/b/bollingerbands.asp

Sources:
-  `src`

Opts:
- `avg-indicator` for middle band. Defaults to [[simple-moving-average]], must accept source as `:src`
- `avg-opts` if specified, overrides top level `opts` for `avg-indicator`
- `stdev-opts` if specified, overrides top level `opts` for [[standard-deviation]]
sourceraw docstring

chandelier-exitsclj

(chandelier-exits tl
                  {:keys [close high low] :as sources}
                  {:keys [range-indicator range-opts highest-opts lowest-opts
                          multiplier]
                   :or {range-indicator average-true-range}
                   :as opts})

Returns tuple of chandelier exits nodes [long short]

Reference:

Sources:

  • close
  • high
  • low

Opts:

  • range-indicator Defaults to average-true-range, will be passed top level sources.
  • range-opts if specified, overrides top level opts passed to range-indicator
  • highest-opts if specified, overrides top level opts passed to highest-val
  • lowest-opts if specified, overrides top level opts passed to lowest-val
  • multiplier
Returns tuple of chandelier exits nodes [long short]

Reference:
- https://school.stockcharts.com/doku.php?id=technical_indicators:chandelier_exit

Sources:
- `close`
- `high`
- `low`

Opts:
- `range-indicator` Defaults to [[average-true-range]], will be passed top level `sources`.
- `range-opts` if specified, overrides top level `opts` passed to `range-indicator`
- `highest-opts` if specified, overrides top level `opts` passed to [[highest-val]]
- `lowest-opts` if specified, overrides top level `opts` passed to [[lowest-val]]
- `multiplier`
sourceraw docstring

commodity-channel-indexclj

(commodity-channel-index
  tl
  {:keys [src] :as sources}
  {:keys [avg-indicator avg-opts mean-dev-opts period constant-factor]
   :or {avg-indicator simple-moving-average constant-factor 0.015}
   :as opts})

Reference:

Sources:

  • src can be any number series, although the original formula specifies typical price to be hlc3.

Opts:

  • avg-indicator defaults to simple-moving-average, must accept src as :src
  • avg-opts if specified, overrides top level opts on avg-indicator
  • mean-dev-opts if specified, overrides top level opts on internal mean-deviation
  • constant-factor double. defaults to 0.015
Reference:
- https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/commodity-channel-index-cci/

Sources:
- `src` can be any number series, although the original formula specifies typical price to be [[hlc3]].

Opts:
- `avg-indicator` defaults to [[simple-moving-average]], must accept src as `:src`
- `avg-opts` if specified, overrides top level `opts` on `avg-indicator`
- `mean-dev-opts` if specified, overrides top level `opts` on internal [[mean-deviation]]
- `constant-factor` double. defaults to 0.015
sourceraw docstring

delta-sourceclj

(delta-source {:keys [input] :as sources} {:keys [max-size] :as opts})

Sources:

  • input input node that contain partial timeseries of new items to introduce into the graph.

Opts:

Returns tuple of nodes [delta-tl src] that can be used to introduce new values into a graph of derived timeseries:

  • delta-tl is a node that emits tacos.timeseries/delta-timeline using max-size and the timestamps of timeseries in input.
  • src is a timeseries node that accumulates new values from input, up to a maximum of max-size, presumably to be used as the source for other derived timeseries.
Sources:
- `input` input node that contain partial timeseries of new items to introduce into the graph.

Opts:
- `max-size` the maximum size used for [[tacos.timeseries/delta-timeline]].

Returns tuple of nodes [delta-tl src] that can be used to introduce new values into a graph of derived timeseries:
- `delta-tl` is a node that emits [[tacos.timeseries/delta-timeline]] using `max-size` and the timestamps of timeseries 
   in `input`.
- `src` is a timeseries node that accumulates new values from `input`, up to a maximum of `max-size`, presumably to 
  be used as the source for other derived timeseries.
sourceraw docstring

derivedclj

(derived tl sources compute-ts)

Creates a new derived timeseries node (a.k.a indicator) given the following args:

  • tl A graphcom node whose emitted value implements [[tacos.timeseires/Timeline]].
  • sources Map of dependency nodes. Timeline node will be merged into sources under ::timeline keyword automatically.
  • compute-ts 3-arity fn that will be called with args [current-value sources-values timestamp], and must return the value of this timeseries at timestamp. Note that timestamp can be any type that can be compared with compare. You could use integers (e.g epoch milliseconds), java.time instants, ISO strings, etc

Returns node that will emit a derived timeseries as value.

Creates a new derived timeseries node (a.k.a indicator) given the following args:
- `tl` A graphcom node whose emitted value implements [[tacos.timeseires/Timeline]].
- `sources` Map of dependency nodes. Timeline node will be merged into sources under `::timeline` keyword automatically.
- `compute-ts` 3-arity fn that will be called with args [current-value sources-values timestamp], and must return the 
  value of this timeseries at `timestamp`. Note that timestamp can be any type that can be compared with `compare`. 
  You could use integers (e.g epoch milliseconds), java.time instants, ISO strings, etc

Returns node that will emit a derived timeseries as value.
sourceraw docstring

donchian-channelsclj

(donchian-channels tl
                   {:keys [high low]}
                   {:keys [highest-opts lowest-opts] :as opts})

Returns tuple of [mid high low] nodes

Sources:

  • high
  • low

Opts:

  • highest-opts if specified, overrides top level opts on highest-val
  • lowest-opts if specified, overrides top level opts on lowest-val

Reference:

Returns tuple of [mid high low] nodes

Sources:
- `high`
- `low`

Opts:
- `highest-opts` if specified, overrides top level `opts` on [[highest-val]] 
- `lowest-opts` if specified, overrides top level `opts` on [[lowest-val]]

Reference:
- https://www.investopedia.com/terms/d/donchianchannels.asp
sourceraw docstring

double-exponential-moving-averageclj

(double-exponential-moving-average tl
                                   {:keys [src] :as sources}
                                   {:keys [ema1-opts ema2-opts period]
                                    :as opts})

Reference:

Sources:

  • src

Opts:

  • period sent to internal exponential moving averages
  • multiplier sent to internal exponential moving averages
  • ema1-opts if specified, will be used instead of top level opts for ema1
  • ema2-opts if specified, will be used instead of top level opts for ema2
Reference:
- https://www.tradingview.com/support/solutions/43000589132-double-exponential-moving-average-ema/

Sources:
- `src`

Opts:
- `period` sent to internal exponential moving averages
- `multiplier` sent to internal exponential moving averages
- `ema1-opts` if specified, will be used instead of top level `opts` for ema1
- `ema2-opts` if specified, will be used instead of top level `opts` for ema2
sourceraw docstring

envelopeclj

(envelope tl {:keys [src]} {:keys [multiplier]})

Returns tuple of nodes [upper lower], where: pos = src + (src * multiplier) neg = src - (src * multiplier)

Sources:

  • `src

Opts:

  • multiplier percentage number. e.g. 0.01 will create a 1% envelope around src.
Returns tuple of nodes [upper lower], where:
pos = src + (src * multiplier)
neg = src - (src * multiplier)

Sources:
- `src

Opts:
- `multiplier` percentage number. e.g. 0.01 will create a 1% envelope around `src`.
sourceraw docstring

exponential-moving-averageclj

(exponential-moving-average tl
                            {:keys [src] :as sources}
                            {:keys [multiplier period]})

Reference:

Sources:

  • src

Opts:

  • period
  • multiplier defaults to (/ 2 (inc period)).
Reference:
- https://www.tradingview.com/support/solutions/43000592270-exponential-moving-average/

Sources:
- `src`

Opts:
- `period`
- `multiplier` defaults to (/ 2 (inc period)).
sourceraw docstring

heikin-ashiclj

(heikin-ashi tl {:keys [open close high low] :as sources})

Returns node that calculates Heikin ashi candles whose values are maps of keys #{:open :close :high :low}

Sources:

  • open
  • close
  • high
  • low

Reference:

Returns node that calculates Heikin ashi candles whose values are maps of keys #{:open :close :high :low}

Sources:
- `open`
- `close`
- `high`
- `low`

Reference: 
- https://www.investopedia.com/trading/heikin-ashi-better-candlestick/
sourceraw docstring

highest-valclj

(highest-val tl {:keys [src] :as sources} {:keys [period] :as opts})

Returns highest value of latest period items

Sources:

  • src

Opts:

  • period
Returns highest value of latest period items

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

hl2clj

(hl2 tl {:keys [high low]})

(high + low)/2

Sources:

  • high
  • low
(high + low)/2

Sources:
- `high`
- `low`
sourceraw docstring

hlc3clj

(hlc3 tl {:keys [high low close]})

(high+low+close)/3

Sources:

  • high
  • low
  • close
(high+low+close)/3

Sources:
- `high`
- `low`
- `close`
sourceraw docstring

hull-moving-averageclj

(hull-moving-average tl {:keys [src] :as sources} {:keys [period] :as opts})
Reference:
- https://www.tradingview.com/support/solutions/43000589149-hull-moving-average/

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

kaufman-adaptive-moving-averageclj

(kaufman-adaptive-moving-average tl
                                 {:keys [src] :as sources}
                                 {:keys [er-period slow-period fast-period]})

Reference:

Sources:

  • src

Opts:

Reference:
- https://school.stockcharts.com/doku.php?id=technical_indicators:kaufman_s_adaptive_moving_average (KAMA)

Sources:
- `src`

Opts:
- `er-period` period to use on [[kaufman-efficiency-ratio]]
- `slow-period`
- `fast-period`
sourceraw docstring

kaufman-efficiency-ratioclj

(kaufman-efficiency-ratio tl
                          {:keys [src] :as sources}
                          {:keys [period] :as opts})
Reference:
- https://school.stockcharts.com/doku.php?id=technical_indicators:kaufman_s_adaptive_moving_average (ER)

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

keltner-channelsclj

(keltner-channels tl
                  {:keys [close high low src] :as sources}
                  {:keys [avg-indicator avg-opts range-indicator range-opts
                          multiplier]
                   :or {avg-indicator exponential-moving-average
                        range-indicator average-true-range}
                   :as opts})

Returns tuple of nodes [upper middle lower]

Reference:

Sources:

  • close (atr)
  • high (atr)
  • low (atr)
  • src (middle band)

Opts:

  • avg-indicator for middle band. Defaults to exponential-moving-average, will be passed top level sources.
  • avg-opts if specified, overrides top level opts for avg-indicator
  • range-indicator for use as range indicator. Defaults to average-true-range. Will be passed top level sources unchanged.
  • range-opts if specified, overrides top level opts for range indicator.
  • multiplier
Returns tuple of nodes [upper middle lower]

Reference:
- https://www.tradingview.com/support/solutions/43000502266-keltner-channels-kc/

Sources:
- `close` (atr)
- `high` (atr)
- `low` (atr)
- `src` (middle band)

Opts:
- `avg-indicator` for middle band. Defaults to [[exponential-moving-average]], will be passed top level sources.
- `avg-opts` if specified, overrides top level `opts` for `avg-indicator`
- `range-indicator` for use as range indicator. Defaults to [[average-true-range]]. Will be passed top level 
  `sources` unchanged.
- `range-opts` if specified, overrides top level `opts` for range indicator.
- `multiplier`
sourceraw docstring

lowest-valclj

(lowest-val tl {:keys [src] :as sources} {:keys [period] :as opts})

Returns lowest value of latest period items

Sources:

  • src

Opts:

  • period
Returns lowest value of latest period items

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

map-someclj

(map-some tl f n1)
(map-some tl f n1 n2)
(map-some tl f n1 n2 n3)
(map-some tl f n1 n2 n3 n4)
(map-some tl f n1 n2 n3 n4 & nodes)

Returns node that applies f to each timestamp value of each node, when current timestamp values for all nodes are non-nil.

e.g:

  • sum each timestamp's val of different timeseries (map-some tl + x y z)
  • mean of x,y,z nodes (map-some tl (fn [& xs] (/ (reduce + 0 xs) (count xs))) x y z)
Returns node that applies f to each timestamp value of each node, when current timestamp values for all nodes
are non-nil.

e.g: 
- sum each timestamp's val of different timeseries `(map-some tl + x y z)`
- mean of x,y,z nodes `(map-some tl (fn [& xs] (/ (reduce + 0 xs) (count xs))) x y z)`
sourceraw docstring

meanclj

(mean tl & srcv)

Returns node that computes the mean of all nodes specified.

e.g ohlc4 = (mean tl open close high low) where open,close,high,low are indicators of each candle value.

Returns node that computes the mean of all nodes specified.

e.g ohlc4 = (mean tl open close high low) where open,close,high,low are indicators of each candle value.
sourceraw docstring

mean-deviationclj

(mean-deviation tl
                {:keys [src] :as sources}
                {:keys [period avg-indicator avg-opts]
                 :or {avg-indicator simple-moving-average}
                 :as opts})

deviation of prices from a moving average.

Sources:

  • src

Opts:

  • avg-indicator defaults to simple-moving-average, must accept a source under :src key
  • period
  • avg-opts overrides top level opts for avg-indicator if specified
deviation of prices from a moving average.

Sources: 
- `src`

Opts:
- `avg-indicator` defaults to [[simple-moving-average]], must accept a source under `:src` key
- `period`
- `avg-opts` overrides top level `opts` for `avg-indicator` if specified
sourceraw docstring

momentumclj

(momentum tl sources)
(momentum tl {:keys [src] :as sources} {:keys [period] :or {period 1}})

src(i) - src(i-period)

Sources:

  • src

Opts:

  • period Defaults to 1.
src(i) - src(i-period)

Sources:
- `src`

Opts:
- `period` Defaults to 1.
sourceraw docstring

moving-average-convergence-divergenceclj

(moving-average-convergence-divergence tl
                                       {:keys [src] :as sources}
                                       {:keys [signal-avg-indicator signal-opts]
                                        :or {signal-avg-indicator
                                               exponential-moving-average}
                                        :as opts})

Returns tuple of indicators [macd-line signal histogram]. macd-line = macd-line(src, opts) See [[macd-line]] signal = signal-avg-indicator(macd, signal-opts) hist = macd - signal

Reference:

Sources will be passed to moving-average-convergence-divergence-line, if using defaults:

  • src

Opts are those accepted by moving-average-convergence-divergence-line, plus:

Returns tuple of indicators [macd-line signal histogram].
macd-line = macd-line(src, opts) See [[macd-line]]
signal = signal-avg-indicator(macd, signal-opts)
hist = macd - signal

Reference:
- https://www.tradingview.com/support/solutions/43000502344-macd-moving-average-convergence-divergence/

Sources will be passed to [[moving-average-convergence-divergence-line]], if using defaults:
- `src`

Opts are those accepted by [[moving-average-convergence-divergence-line]], plus:
- `signal-avg-indicator` defaults to [[exponential-moving-average]], must accept source as `:src` key
- `signal-opts`
sourceraw docstring

moving-average-convergence-divergence-lineclj

(moving-average-convergence-divergence-line
  tl
  {:keys [src] :as sources}
  {:keys [fast-avg-indicator fast-sources fast-opts slow-avg-indicator
          slow-sources slow-opts]
   :or {fast-avg-indicator simple-moving-average
        slow-avg-indicator simple-moving-average}})

MACD base line. ma(src, fast-opts) - ma(src, slow-opts).

Sources:

  • src

Opts:

  • fast-avg-indicator defaults to exponential-moving-average
  • fast-sources if specified, overrides top level sources passed to fast-avg-indicator
  • fast-opts passed to fast-avg-indicator
  • slow-avg-indicator defaults to exponential-moving-average
  • slow-sources if specified, overrides top level sources passed to slow-avg-indicator
  • slow-opts passed to slow-avg-indicator
MACD base line. ma(src, fast-opts) - ma(src, slow-opts).

Sources:
- `src`

Opts:
- `fast-avg-indicator` defaults to [[exponential-moving-average]]
- `fast-sources` if specified, overrides top level `sources` passed to `fast-avg-indicator`
- `fast-opts` passed to `fast-avg-indicator`
- `slow-avg-indicator` defaults to [[exponential-moving-average]]
- `slow-sources` if specified, overrides top level `sources` passed to `slow-avg-indicator`
- `slow-opts` passed to `slow-avg-indicator`
sourceraw docstring

ohlc4clj

(ohlc4 tl {:keys [open high low close]})

(open+high+low+close)/4

Sources:

  • open
  • high
  • low
  • close
(open+high+low+close)/4

Sources:
- `open`
- `high`
- `low`
- `close`
sourceraw docstring

on-balance-volumeclj

(on-balance-volume tl {:keys [src volume] :as sources})
Reference:
- https://www.investopedia.com/terms/o/onbalancevolume.asp

Sources:
- `src`
- `volume`
sourceraw docstring

parabolic-stop-and-reverseclj

(parabolic-stop-and-reverse tl
                            {:keys [close high low] :as sources}
                            {:keys [start increment max-value]})

Reference:

Reference impl:

Sources:

  • close
  • high
  • low

Opts:

  • start
  • increment
  • max-value

Values are maps of:

  • ct current-trend (true if uptrend, false if downtrend)
  • sar sar val
  • af acceleration factor
  • ep extreme point
Reference:
- https://www.investopedia.com/trading/introduction-to-parabolic-sar/

Reference impl:
- https://github.com/ta4j/ta4j/blob/master/ta4j-core/src/main/java/org/ta4j/core/indicators/ParabolicSarIndicator.java

Sources:
- `close`
- `high`
- `low`

Opts:
- `start`
- `increment`
- `max-value`

Values are maps of:
- `ct` current-trend (true if uptrend, false if downtrend)
- `sar` sar val
- `af` acceleration factor
- `ep` extreme point
sourceraw docstring

percentage-price-oscillatorclj

(percentage-price-oscillator tl
                             {:keys [src] :as sources}
                             {:keys [signal-avg-indicator signal-opts]
                              :or {signal-avg-indicator
                                     exponential-moving-average}
                              :as opts})

returns tuple of indicators [ppo-line signal histogram], ppo-line vals between -100 and 100. Similar to moving-average-convergence-divergence, but returns percentage instead of absolute price changes.

Reference:

Sources:

  • src

Opts are those accepted by [[ppo-line]], plus:

  • signal-avg-indicator defaults to exponential-moving-average, must accept a source on :src key
  • signal-opts passed to signal-avg-indicator
returns tuple of indicators [ppo-line signal histogram], ppo-line vals between -100 and 100.
Similar to [[moving-average-convergence-divergence]], but returns percentage instead of absolute price changes.

Reference:
- https://www.investopedia.com/terms/p/ppo.asp

Sources:
- `src`

Opts are those accepted by [[ppo-line]], plus:
- `signal-avg-indicator` defaults to [[exponential-moving-average]], must accept a source on `:src` key
- `signal-opts` passed to `signal-avg-indicator`
sourceraw docstring

percentage-price-oscillator-lineclj

(percentage-price-oscillator-line
  tl
  {:keys [src] :as sources}
  {:keys [fast-avg-indicator fast-sources fast-opts slow-avg-indicator
          slow-sources slow-opts]
   :or {fast-avg-indicator exponential-moving-average
        slow-avg-indicator exponential-moving-average}})

percentage-price-oscillator base line, values between -1 and 1.

Sources:

  • src

Opts:

  • fast-avg-indicator defaults to exponential-moving-average
  • fast-sources if specified, overrides top level sources passed to fast-avg-indicatorº
  • fast-opts passed to fast-avg-indicator
  • slow-avg-indicator defaults to exponential-moving-average
  • slow-opts passed to slow-avg-indicator
percentage-price-oscillator base line, values between -1 and 1.

Sources: 
- `src`

Opts:
- `fast-avg-indicator` defaults to [[exponential-moving-average]]
- `fast-sources` if specified, overrides top level `sources` passed to `fast-avg-indicatorº`
- `fast-opts` passed to `fast-avg-indicator`
- `slow-avg-indicator` defaults to [[exponential-moving-average]]
- `slow-opts` passed to `slow-avg-indicator`
sourceraw docstring

rate-of-changeclj

(rate-of-change tl sources)
(rate-of-change tl
                {:keys [src] :as sources}
                {:keys [period nan-val] :or {period 1 nan-val Double/NaN}})

(src - src(i-period)) / src(i-period), vals between -1 and 1, except the case when src(i-period) is zero, then returns opt nan-val

Sources:

  • src

Opts:

  • period Defaults to 1.
  • nan-val defaults to Double/NaN
(src - src(i-period)) / src(i-period), vals between -1 and 1, except the case when src(i-period) is zero,
then returns opt `nan-val`

Sources:
- `src`

Opts:
- `period` Defaults to 1.
- `nan-val` defaults to Double/NaN
sourceraw docstring

refined-relative-volatility-indexclj

(refined-relative-volatility-index
  tl
  {:keys [high low] :as sources}
  {:keys [avg-indicator avg-opts stdev-opts period] :as opts})

(rvi(high) + rvi(low) / 2), with values between 0 and 1.

Reference:

Sources:

  • high
  • low

Opts are those accepted by relative-volatility-index

(rvi(high) + rvi(low) / 2), with values between 0 and 1.

Reference:
- https://www.fmlabs.com/reference/default.htm?url=RVI.htm (RVI)

Sources:
- `high`
- `low`

Opts are those accepted by [[relative-volatility-index]]
sourceraw docstring

relative-moving-averageclj

(relative-moving-average tl {:keys [src] :as sources} {:keys [period]})

Relative (WildeR's) moving average, is an Exponential moving average using 1/period as multiplier.

Sources:

  • src

Opts:

  • period
Relative (WildeR's) moving average, is an Exponential moving average using 1/period as multiplier.

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

relative-strength-g-lclj

(relative-strength-g-l tl {:keys [src] :as sources})

returns tuple of nodes [gains losses], part of relative-strength-index. gains: if (pos? x - (x-1)) then x else 0 losses: if (neg? x - (x-1)) then -x else 0

Sources:

  • src
returns tuple of nodes [gains losses], part of [[relative-strength-index]].
gains: if (pos? x - (x-1)) then x else 0
losses: if (neg? x - (x-1)) then -x else 0

Sources:
- `src`
sourceraw docstring

relative-strength-indexclj

(relative-strength-index tl
                         {:keys [src] :as sources}
                         {:keys [avg-indicator avg-opts]
                          :or {avg-indicator relative-moving-average}
                          :as opts})

Values between 0 and 1.

Reference:

Sources

  • src

Opts:

Values between 0 and 1.

Reference:
- https://www.tradingview.com/support/solutions/43000502338-relative-strength-index-rsi/

Sources 
- `src`

Opts:
- `avg-indicator` used to average both [[relative-strength-g-l]]. Defaults to [[relative-moving-average]], 
  must accept source as `:src`
- `avg-opts` if specified, overrides top level opts passed to `avg-indicator`
sourceraw docstring

relative-volatility-indexclj

(relative-volatility-index tl
                           {:keys [src] :as sources}
                           {:keys [avg-indicator avg-opts stdev-opts period]
                            :or {avg-indicator exponential-moving-average}
                            :as opts})

Values from 0 to 1.

Reference:

Sources:

  • src

Opts:

Values from 0 to 1.

Reference:
- https://www.fmlabs.com/reference/default.htm?url=RVI.htm (RVIOrig)

Sources:
- `src`

Opts:
- `avg-indicator` defaults to [[exponential-moving-average]], must accept source as `:src`
- `stdev-opts` if specified, overrides top level `opts` passed to [[relative-volatility-u-s]]
- `avg-opts` if specified, overrides top level `opts` passed to `avg-indicator`
sourceraw docstring

relative-volatility-u-sclj

(relative-volatility-u-s tl {:keys [src] :as sources} {:keys [period] :as opts})

Returns nodes tuple [u s] of relative-volatility-index u and s components. Similar to relative-strength-g-l, but use standard-deviation of price-change instead of absolute price change.

Sources:

  • src

Opts are those of standard-deviation

Reference:

Returns nodes tuple [u s] of [[relative-volatility-index]] u and s components. Similar to [[relative-strength-g-l]],
but use standard-deviation of price-change instead of absolute price change.

Sources:
- `src`

Opts are those of [[standard-deviation]]

Reference:
- https://www.fmlabs.com/reference/default.htm?url=RVI.htm (RVIOrig)
sourceraw docstring

simple-moving-averageclj

(simple-moving-average tl {:keys [src] :as sources} {:keys [period]})

Reference:

Sources:

  • src

Opts:

  • period

Notes:

  • Assumes that only latest time points are added (either new later timestamp, or replacement of current latest). This should be the case most of the time. For earlier than latest arriving time points, you need to recompute all from earlier time point to latest for correct results, by specifying them on the timeline.

  • Keeps an internal summatory to work on log-n (n=size of timeseries) instead of reducing tail all the time.

Reference:
- https://www.tradingview.com/support/solutions/43000502589-moving-average/

Sources:
- `src`

Opts:
- `period`
  
Notes:
- Assumes that only latest time points are added (either new later timestamp, or replacement of current latest).
  This should be the case most of the time. For earlier than latest arriving time points, you need to recompute all 
  from earlier time point to latest for correct results, by specifying them on the timeline.

- Keeps an internal summatory to work on log-n (n=size of timeseries) instead of reducing tail all the time.
sourceraw docstring

since-highest-valclj

(since-highest-val tl {:keys [src] :as sources} {:keys [period] :as opts})

Returns number of items since highest value on latest period items

Sources:

  • src

Opts:

  • period
Returns number of items since highest value on latest `period` items

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

since-lowest-valclj

(since-lowest-val tl {:keys [src] :as sources} {:keys [period] :as opts})

Returns number of items since lowest value on latest period items

Sources:

  • src

Opts:

  • period
Returns number of items since lowest value on latest `period` items

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

smoothed-moving-averageclj

(smoothed-moving-average tl {:keys [src] :as sources} {:keys [period]})
Reference:
- https://download.esignal.com/products/workstation/help/charts/studies/rmi.htm

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

sources-mapclj

(sources-map tl sources)

Returns timeseries node whose values combine current timestamp for all sources in a hash map, under same keyword as specified in sources, when all have a value.

E.g candles (sources-map tl {:high high :low low :close close :open open}) will have values as map of {:open ,,, :close ,,, :high ,,, :low ,,,}.

Useful to combine multiple indicators that share the same timeline into one to use it as a single timeseries.

Returns timeseries node whose values combine current timestamp for all sources in a hash map, under same keyword as
specified in `sources`, when all have a value.

E.g candles (sources-map tl {:high high :low low :close close :open open}) will have values as map of 
`{:open ,,, :close ,,, :high ,,, :low ,,,}`.

Useful to combine multiple indicators that share the same timeline into one to use it as a single timeseries.
sourceraw docstring

spread-mapclj

(spread-map tl map-source {:keys [ks transform] :or {transform identity}})

Given a timeseries node map-source that has maps as values and map of opts, returns a map of new nodes with keys ks where values are new nodes that each one contains the values of key in map-src, possibly transformed.

Sources:

  • map-source

Opts:

  • ks set of keys to extract as indicators
  • transform function to transform each of the values, if needed. Defaults to identity.

E.g (spread-map tl candles-node [:open :close :high :low]) returns a map of nodes #{:open :close :high :low} each one with the corresponding candle value.

Given a timeseries node `map-source` that has maps as values and map of opts, returns a map of new nodes with 
keys `ks` where values are new nodes that each one contains the values of key in map-src, possibly transformed.

Sources:
- `map-source`

Opts:
- `ks` set of keys to extract as indicators
- `transform` function to transform each of the values, if needed. Defaults to identity.

E.g (spread-map tl candles-node [:open :close :high :low]) returns a map of nodes #{:open :close :high :low}
each one with the corresponding candle value.
sourceraw docstring

standard-deviationclj

(standard-deviation tl {:keys [src] :as sources} {:keys [period]})

standard deviation of prices during period

Sources:

  • src

Opts:

  • period
standard deviation of prices during period

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

stochastic-klineclj

(stochastic-kline tl {:keys [close high low] :as sources} {:keys [period]})

non-smoothed k-line component of stochastic-oscillator, between 0 and 1.

Sources:

  • close
  • high
  • low

Opts:

  • period
non-smoothed k-line component of [[stochastic-oscillator]], between 0 and 1.

Sources:
- `close`
- `high`
- `low`

Opts:
- `period`
sourceraw docstring

stochastic-oscillatorclj

(stochastic-oscillator tl
                       {:keys [close high low] :as sources}
                       {:keys [k-line-opts avg-k-indicator avg-k-opts
                               avg-d-indicator avg-d-opts]
                        :or {avg-k-indicator simple-moving-average
                             avg-d-indicator simple-moving-average}})

returns tuple of nodes [k-line d-line] of stochastic oscillator, with vals between 0 and 1.

Reference:

Sources:

  • close
  • high
  • low

Opts:

returns tuple of nodes [k-line d-line] of stochastic oscillator, with vals between 0 and 1.

Reference: 
- https://www.tradingview.com/support/solutions/43000502332-stochastic-stoch/

Sources:
- `close`
- `high`
- `low`

Opts:
- `k-line-opts` opts passed to [[stochastic-kline]]
- `avg-k-indicator` defaults to [[simple-moving-average]], must accept source as `:src`
- `avg-k-opts` passed to `avg-k-indicator`
- `avg-d-indicator` defaults to [[simple-moving-average]], must accept source as `:src`
- `avg-d-opts` passed to `avg-d-indicator`
sourceraw docstring

supertrendclj

(supertrend tl
            {:keys [close high low] :as sources}
            {:keys [multiplier range-indicator range-opts]
             :or {range-indicator average-true-range}
             :as opts})

Reference impl:

Sources:

  • close
  • high
  • low

Opts:

  • range-indicator defaults to average-true-range, will be passed top level sources
  • range-opts if specified, overrides top level opts for range-indicator
  • multiplier

Values are map of:

  • trend e/o #{:long :short}
  • value number
  • _upper
  • _lower
Reference impl: 
- https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/overlap/supertrend.py

Sources:
- `close`
- `high`
- `low`

Opts:
- `range-indicator` defaults to [[average-true-range]], will be passed top level `sources`
- `range-opts` if specified, overrides top level `opts` for `range-indicator`
- `multiplier`

Values are map of:
- `trend` e/o #{:long :short}
- `value` number
- `_upper`
- `_lower`
sourceraw docstring

triple-exponential-moving-averageclj

(triple-exponential-moving-average tl
                                   {:keys [src] :as sources}
                                   {:keys [period ema1-opts ema2-opts ema3-opts]
                                    :as opts})

Reference:

Sources:

  • src

Opts:

  • period sent to internal exponential moving averages
  • multiplier sent to internal exponential moving averages
  • ema1-opts if specified, will be used instead of top level opts for ema1
  • ema2-opts if specified, will be used instead of top level opts for ema2
  • ema3-opts if specified, will be used instead of top level opts for ema3
Reference:
- https://www.tradingview.com/support/solutions/43000591346-triple-ema/

Sources:
- `src`

Opts:
- `period` sent to internal exponential moving averages
- `multiplier` sent to internal exponential moving averages
- `ema1-opts` if specified, will be used instead of top level `opts` for ema1
- `ema2-opts` if specified, will be used instead of top level `opts` for ema2
- `ema3-opts` if specified, will be used instead of top level `opts` for ema3
sourceraw docstring

true-rangeclj

(true-range tl {:keys [close high low] :as sources})

Reference:

Sources:

  • close
  • high
  • low
Reference:
- https://www.investopedia.com/terms/a/atr.asp (TR)

Sources:
- `close`
- `high`
- `low`
sourceraw docstring

volume-weighted-moving-averageclj

(volume-weighted-moving-average tl
                                {:keys [src volume] :as sources}
                                {:keys [period]})

Calculates volume-weighted-moving-average where given price and volume are timeseries nodes.

Reference:

Sources:

  • price
  • volume

Opts:

  • period
Calculates volume-weighted-moving-average where given price and volume are timeseries nodes.

Reference:
- https://www.tradingsetupsreview.com/volume-weighted-moving-average-vwma/

Sources: 
- `price`
- `volume`

Opts:
- `period`
sourceraw docstring

weighted-moving-averageclj

(weighted-moving-average tl {:keys [src] :as sources} {:keys [period]})
Reference:
- https://www.tradingview.com/support/solutions/43000594680-weighted-moving-average/

Sources:
- `src`

Opts:
- `period`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close