TechnicalIndicatorCharts
Documentation for TechnicalIndicatorCharts.
TechnicalIndicatorCharts.Chart
TechnicalIndicatorCharts.abbrev
TechnicalIndicatorCharts.extract_value
TechnicalIndicatorCharts.indicator_fields
TechnicalIndicatorCharts.indicator_fields_values
TechnicalIndicatorCharts.ismultiinput
TechnicalIndicatorCharts.ismultioutput
TechnicalIndicatorCharts.make_panel
TechnicalIndicatorCharts.make_panel
TechnicalIndicatorCharts.merge_candle!
TechnicalIndicatorCharts.push_new_candle!
TechnicalIndicatorCharts.update!
TechnicalIndicatorCharts.update_last_candle!
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.visualize
TechnicalIndicatorCharts.Chart
— TypeSummary
A Chart is a mutable struct that has:
- a name (typically of the asset like "BTCUSD" or "AAPL")
- a timeframe (which controls how much time each candle on the chart represents)
- a DataFrame to hold OHLCV values and indicator values
- a Vector of
OnlineTechnicalIndicator
s to display on the chart. - another Vector of display configuration for each indicator.
If you were to go to TradingView and look at a chart, imagine what kind of data structure would be required to represent it in memory. That's what the Chart
struct aims to be.
Fields
name::AbstractString
tf::Dates.Period
indicators::AbstractVector{OnlineTechnicalIndicators.TechnicalIndicator}
visuals::AbstractVector
df::DataFrames.DataFrame
ts::Union{Missing, Dates.DateTime}
candle::Union{Missing, Candle}
Constructors
Chart(name, tf; indicators=[], visuals=[])
Examples
julia> just_candles = Chart("ETHUSD", Minute(1))
julia> golden_cross = Chart(
"BTCUSD", Hour(4);
indicators = [
SMA{Float64}(;period=50),
SMA{Float64}(;period=200)
],
visuals = [
Dict(
:label_name => "SMA 50",
:line_color => "#E072A4",
:line_width => 2
),
Dict(
:label_name => "SMA 200",
:line_color => "#3D3B8E",
:line_width => 5
)
]
)
julia> default_visuals = Chart(
"BNBUSDT", Hour(4);
indicators = [BB{Float64}(), StochRSI{Float64}()],
visuals = [nothing, nothing] # To use defaults, pass in `nothing`.
)
TechnicalIndicatorCharts.abbrev
— Methodabbrev(p::Period)
Return an abbreviated string representation of the given period.
Example
abbrev(Hour(4)) # "4h"
abbrev(Day(1)) # "1d"
TechnicalIndicatorCharts.extract_value
— Methodextract_value(value) -> Vector{Any}
Extract values out of an indicators value struct. This is only intended to be used for indicators that emit multiple values per tick.
TechnicalIndicatorCharts.indicator_fields
— MethodReturn a tuple of symbol names to be used for the output of ind
.
TechnicalIndicatorCharts.indicator_fields_values
— Methodindicator_fields_values(
ind::OnlineTechnicalIndicators.TechnicalIndicatorMultiOutput
) -> Any
Extract values from an indicator instance.
TechnicalIndicatorCharts.ismultiinput
— MethodThis is a wrapper around OnlineTechnicalIndicators.ismultiinput
that takes any instance of a TechnicalIndicator and digs out its unparametrized type before running the original ismultiinput method.
TechnicalIndicatorCharts.ismultioutput
— MethodThis is a wrapper around OnlineTechnicalIndicators.ismultioutput
that takes any instance of a TechnicalIndicator and digs out its unparametrized type before running the original ismultioutput method.
TechnicalIndicatorCharts.make_panel
— Methodmake_panel(
plots::AbstractVector
) -> LightweightCharts.LWCPanel
Wrap a Vector of LWCCharts in a panel.
TechnicalIndicatorCharts.make_panel
— Methodmake_panel(
chart::LightweightCharts.LWCChart
) -> LightweightCharts.LWCPanel
Wrap a single LWCChart in a panel.
TechnicalIndicatorCharts.merge_candle!
— Methodmerge_candle!(
last_candle::Union{Missing, Candle},
c::Union{Candle, DataFrames.DataFrameRow}
) -> Candle
If last candle is not provided, construct a new candle with the given OHLCV data. If last candle is provided, mutate last_candle such that it's HLCV are updated. When tw candles are passed in, it's assumed they have the same timestamp.
TechnicalIndicatorCharts.push_new_candle!
— Methodpush_new_candle!(
chart::Chart,
c::Candle
) -> DataFrames.DataFrame
This is meant to be called on timeframe boundaries to onto the chart's dataframe. It also does indicator calculation at this time.
TechnicalIndicatorCharts.update!
— Methodupdate!(chart::Chart, c::Candle) -> Union{Nothing, Candle}
Update a chart with a candle. When a candle is completed, return it. Otherwise, return nothing on update.
TechnicalIndicatorCharts.update_last_candle!
— Methodupdate_last_candle!(chart::Chart, c::Candle) -> Float64
This updates the HLCV values of the last row of the chart's DataFrame when we're not at a chart.tf boundary.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
unimplemented,
opts,
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
This is a visualize method that's a catch-all for indicators that haven't had a visualize method made for them yet. For now, it returns missing
.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
chart::Chart;
min_height,
mode,
up_color,
down_color,
copyright
) -> LightweightCharts.LWCLayout
Return an LWCLayout that visualizes all the components in chart appropriately.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
df::DataFrames.DataFrame,
opts
) -> LightweightCharts.LWCChart
Visualize a DataFrame using lwc_candlestick.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
alma::OnlineTechnicalIndicators.ALMA,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize ALMA using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
atr::OnlineTechnicalIndicators.ATR,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize ATR using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
bb::OnlineTechnicalIndicators.BB,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> Vector{LightweightCharts.LWCChart}
Visualize Bollinger Bands using 3 lwc_lines.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
dema::OnlineTechnicalIndicators.DEMA,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize DEMA using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
ema::OnlineTechnicalIndicators.EMA,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize EMA using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
hma::OnlineTechnicalIndicators.HMA,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize HMA using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
keltnerchannels::OnlineTechnicalIndicators.KeltnerChannels,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> Vector{LightweightCharts.LWCChart}
Visualize Keltner Channels (KC) using 3 lwc_lines.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
mcginleydynamic::OnlineTechnicalIndicators.McGinleyDynamic,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize McGinleyDynamic using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
obv::OnlineTechnicalIndicators.OBV,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize On Balance Volume (OBV) using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
rsi::OnlineTechnicalIndicators.RSI,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize RSI using 1 lwc_line.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
sma::OnlineTechnicalIndicators.SMA,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Return an lwc_line for visualizing an SMA indicator.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
SMMA::OnlineTechnicalIndicators.SMMA,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Return an lwc_line for visualizing an SMMA indicator.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
srsi::OnlineTechnicalIndicators.StochRSI,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> Vector{LightweightCharts.LWCChart}
Visualize StochRSI using 2 lwc_lines.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
tsi::OnlineTechnicalIndicators.TSI,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize True Strength Index (TSI) using 1 lwc_line. Note that on TradingView, TSI includes a second signal line that is not included here.
TechnicalIndicatorCharts.visualize
— Methodvisualize(
wma::OnlineTechnicalIndicators.WMA,
opts::Union{Nothing, AbstractDict},
df::DataFrames.DataFrame
) -> LightweightCharts.LWCChart
Visualize WMA using 1 lwc_line.