autostrat: Automated Ichimoku Strategies

View source: R/mltools.R

autostratR Documentation

Automated Ichimoku Strategies

Description

Generate a list of the top performing ichimoku cloud strategies based on simple indicator conditions of the form 'c1 > c2' (level 1), complex combined strategies of the form 'c1 > c2 & c3 > c4' (level 2), or complex asymmetric strategies of the form 'c1 > c2 x c3 > c4' (level 3).

Usage

autostrat(x, n = 8, dir = c("long", "short"), level = 1, quietly)

Arguments

x

an ichimoku object.

n

[default 8] select top 'n' number of strategies to return.

dir

[default 'long'] trade direction, either 'long' or 'short'.

level

[default 1] to return simple strategies. For complex strategies, set level to 2 to return combined strategies of the form 's1 & s2' or level to 3 to return asymmetric strategies of the form 's1 x s2'.

quietly

(optional) if set to TRUE, will suppress printing of additional output to the console and return quietly.

Details

Ichimoku objects for each strategy are returned as a list. The cumulative log returns for all strategies as well as the summaries for the top 'n' strategies are saved as attributes to the list. This information may be retrieved by using look on the returned list.

Each individual ichimoku object may be accessed via its position in the list, e.g. [[1]] for the 1st item.

Value

Returned invisibly, a list of 'n' ichimoku objects containing strategies, with attributes 'logret' (a vector of cumulative log returns for all strategies) and 'summary' (a matrix of summaries for the top 'n' strategies).

In addition, the strategy summaries are printed to the console.

Further Details

Please refer to the strategies vignette by calling: vignette("strategies", package = "ichimoku")

Examples

cloud <- ichimoku(sample_ohlc_data, ticker = "TKR")

stratlist <- autostrat(cloud, n = 3, quietly = TRUE)
look(stratlist)
strat <- stratlist[[2]]
summary(strat)

autostrat(cloud, n = 1, dir = "short", level = 2)
autostrat(cloud, n = 1, dir = "long", level = 3)


ichimoku documentation built on Nov. 2, 2023, 5:36 p.m.