Indicators

The basic Components like Open, Close, High, Low, Volume and their Difference or RelativeDifference components can be used to generate derived Components like:

These indicators can be requested by Strategy systems for example:

struct TestStrat <: System

Overseer.requested_components(::TestStrat) = (SMA{20, Close}, RSI{14, Open})

This leads that for any asset that TestStrat should be used on will automatically generate these derived Indicators as the data flows in. It is also used by new_entities to iterate over the new entities in a AssetLedger that hold the requested components for a given Strategy. reset! on the other hand clears all the data for the requested components of a strategy in a AssetLedger. This is useful for example to not use the data of the previous day when calculating moving averages etc.

function update(s::TestStrat, trader, asset_ledgers)
    curt = current_time(trader)
    if is_market_open(curt)
        for l in asset_ledgers
            # This clears the SMA{20, Close} and RSI{14, Open} Components from l
            reset!(l, s)
        end
    end
    for l in asset_ledgers
        for e in new_entities(l, s)
            # do something with e

            # e[SMA{20, Close}] accesses the SMA
            # e[RSI{14, Open}] accesses the RSI
        end
    end
end

Each e in the above example will be seen only once. See the Strategies tutorial for more info.

Reference

Trading.SMAType
SMA{horizon, T}

The simple moving average of a value over a sliding window of horizon.

source
Trading.MovingStdDevType
MovingStdDev{horizon, T}

The moving standard deviation of a value over a sliding window of horizon.

source
Trading.EMAType
EMA{horizon, T}

The exponential moving average of a value over a sliding window of horizon.

source
Trading.RSIType
RSI{horizon, T}

The relative strength index of a value over timeframe of horizon.

source
Trading.BollingerType
Bollinger{horizon, T}

The up and down Bollinger bands for a value, over a sliding window of horizon.

source
Trading.SharpeType
Sharpe{horizon, T}

The sharpe ratio of a value over a timeframe horizon.

source
Trading.new_entitiesFunction
new_entities(ledger, strategy)

Returns a NewEntitiesIterator which iterates through the entities that have components that are requested by strategy, and were not yet seen. I.e. each entity in those components will be looped over once and only once when iteratively calling new_entities.

source
Missing docstring.

Missing docstring for Trading.reset!(::Trading.AssetLedger, ::Any). Check Documenter's build log for details.

Systems