Learn R Programming

ichimoku

Visualization and Tools for Ichimoku Kinko Hyo Strategies

An implementation of ‘Ichimoku Kinko Hyo’, also commonly known as ‘cloud charts’. Static and interactive visualizations with tools for creating, backtesting and development of quantitative ‘ichimoku’ strategies. As described in Sasaki (1996, ISBN:4925152009), the technique is a refinement on candlestick charting, originating from Japan and now in widespread use in technical analysis worldwide. Translating as ‘one-glance equilibrium chart’, it allows the price action and market structure of financial securities to be determined ‘at-a-glance’. Incorporates an interface with the OANDA fxTrade API https://developer.oanda.com/ for retrieving historical and live streaming price data for major currencies, metals, commodities, government bonds and stock indices.

Quick Start

library(ichimoku)

Simply ichimoku() and plot():

cloud <- ichimoku(sample_ohlc_data, ticker = "TKR")
plot(cloud, window = "2020-05/")

autostrat() to automatically evaluate and rank top-performing strategies:

autostrat(cloud, n = 3)
#>                        [,1]               [,2]              [,3]             
#> Strategy               "senkouB > tenkan" "cloudB > tenkan" "senkouB > kijun"
#> ---------------------  "----------"       "----------"      "----------"     
#> Strategy cuml return % 17.49              16.08             14.1             
#> Per period mean ret %  0.0906             0.0838            0.0741           
#> Periods in market      63                 51                64               
#> Total trades           3                  3                 3                
#> Average trade length   21                 17                21.33            
#> Trade success %        100                100               100              
#> Worst trade ret %      3.64               3.16              3.49             
#> ---------------------  "----------"       "----------"      "----------"     
#> Benchmark cuml ret %   5.53               5.53              5.53             
#> Per period mean ret %  0.0302             0.0302            0.0302           
#> Periods in market      178                178               178              
#> ---------------------  "----------"       "----------"      "----------"     
#> Direction              "long"             "long"            "long"           
#> Start                  2020-04-20         2020-04-20        2020-04-20       
#> End                    2020-12-23         2020-12-23        2020-12-23       
#> Ticker                 "TKR"              "TKR"             "TKR"

Principal ichimoku functions

Data & Visualization

  • ichimoku() - to create an ichimoku object from price data.

  • plot() / iplot() - to plot (interactive) cloud charts from ichimoku objects.

  • archive() - for reading/writing objects to/from archive files with data verification.

  • oanda() - to retrieve price data from the OANDA fxTrade API.

Strategies & ML

  • strat() - to augment an ichimoku object with a strategy, including combined and asymmetric strategies.

  • autostrat() - to automatically evaluate and rank top-performing strategies.

  • mlgrid() - to generate a numeric representation of the ichimoku cloud chart.

  • relative() - to produce a statistical summary of the latest ichimoku numeric representation relative to historical values.

Real-time

Vignettes

Long-form documentation links:

{ 1 } Cloud Charts - The Reference Manual

{ 2 } Beyond Visualization - Quantitative Strategies

{ 3 } Auxiliary Functions

{ 4 } The OANDA fxTrade API

Installation

Install the latest release from CRAN or R-multiverse:

install.packages("ichimoku")

The current development version is available from R-universe:

install.packages("ichimoku", repos = "https://shikokuchuo.r-universe.dev")

References

Sasaki, H. 佐々木 英信 (1996), 一目均衡表の研究 [ichimoku kinkouhyou no kenkyuu]. Tokyo, Japan: Toushi Radar.

‘OANDA’ and ‘fxTrade’ are trademarks owned by OANDA Corporation, an entity unaffiliated with the ichimoku package.

◈ ichimoku R package: https://shikokuchuo.net/ichimoku/.

Listed CRAN Finance Task View: https://cran.r-project.org/view=Finance.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Copy Link

Version

Install

install.packages('ichimoku')

Monthly Downloads

842

Version

1.5.5

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Charlie Gao

Last Published

September 12th, 2024

Functions in ichimoku (1.5.5)

matrix_df

Convert matrix to data.frame
ichimoku-package

ichimoku: Visualization and Tools for Ichimoku Kinko Hyo Strategies
oanda_stream

OANDA Streaming Data
oanda_view

OANDA View Market Performance
oanda_switch

Switch Default OANDA Server
mlgrid

mlgrid Numeric Representation
ichimoku

ichimoku
oanda_studio

OANDA Studio Interactive Live Analysis
index

Extract the Index of Ichimoku Objects
tradingDays

Select Trading Days
xts_df

Convert xts to data.frame
look

Look at Informational Attributes
relative

Relative Numeric Representation
oanda

OANDA Price Data
oanda_positions

OANDA Position Book
oanda_orders

OANDA Order Book
oanda_quote

OANDA Quote Latest Price
iplot

Interactive Ichimoku Cloud Plot
oanda_set_key

Set OANDA fxTrade API Key
sample_ohlc_data

Sample OHLC Price Data
oanda_chart

OANDA Real-time Cloud Charts
oanda_instruments

Available OANDA Instruments
summary.ichimoku

Summary of Ichimoku Objects and Strategies
stratcombine

Combine Ichimoku Strategies
str.ichimoku

Display the Structure of Ichimoku Objects
strat

Create Ichimoku Strategies
plot.ichimoku

Plot Ichimoku Cloud Chart
print.ichimoku

Print Ichimoku Objects
grid_dup

Duplicates of expand.grid for 2 Variables
coredata

Extract the Core Data of Ichimoku Objects
df_merge

Merge Dataframes
autostrat

Automated Ichimoku Strategies
archive

Read/write Objects <> Archive Files with Data Verification
as.data.frame.ichimoku

Convert ichimoku to data.frame
hasStrat

hasStrat
df_append

Append New Data to Dataframe
more

Print More Rows of Ichimoku Objects
is.ichimoku

is.ichimoku
autoplot

Plot Ichimoku Objects with ggplot2
.ichimoku

ichimoku Technical Utility Version