lazytrade (version 0.4.0)

generate_RL_policy: Function performs RL and generates model policy

Description

This function will perform Reinforcement Learning using Trading Data. It will suggest whether or not it is better to keep using trading systems or not. Function is just using results of the past performance to generate the recommendation (not a holy grail).

Usage

generate_RL_policy(x, states, actions, control)

Arguments

x

- Dataframe containing trading data

states

- Selected states of the System

actions

- Selected actions executed under environment

control

- control parameters as defined in the Reinforcement Learning Package

Value

Function returns data frame with reinforcement learning model policy

Details

Initial policy is generated using a dummy zero values. This way function starts working directly from the first observation. However policy 'ON' value will only be generated once the Q value is greater than zero

Examples

Run this code
# NOT RUN {
  library(dplyr)
  library(ReinforcementLearning)
  library(magrittr)

  data(data_trades)
  states <- c("tradewin", "tradeloss")
  actions <- c("ON", "OFF")
  control <- list(alpha = 0.7, gamma = 0.3, epsilon = 0.1)
  generate_RL_policy(data_trades, states, actions, control)


# }

Run the code above in your browser using DataCamp Workspace