lazytrade (version 0.4.0)

check_if_optimize: Function check_if_optimize.

Description

Purpose of this function is to verify trading system functionality by analysing profit factor on the last trades. Whenever trading robot has profit factor value below certain limit function will write a file log indicating which trading systems need to be maintained.

Learn by example how to manipulate data

Usage

check_if_optimize(
  x,
  path_trading_robot = "",
  num_trades_to_consider = 3,
  profit_factor_limit = 0.7,
  demo_mode = FALSE,
  write_mode = FALSE
)

Arguments

x

- dataframe containing trading results

path_trading_robot

- path of trading robot repository. must contain folder TEST with file Setup.csv. File Setup.csv contains a table with magic numbers under test

num_trades_to_consider

- Number of trades to calculate profit factor

profit_factor_limit

- Limit below which trading robot considered not working properly

demo_mode

- When true function uses package test dataset

write_mode

- When true function will write result to the file located in the temporary directory

Value

function returns a dataframe with systems that should be optimized

Details

Whenever there will be not enough trades then empty file will be written to the destination

Examples

Run this code
# NOT RUN {
library(lazytrade)
library(dplyr)
library(readr)
library(lubridate)
DFT1 <- import_data(trade_log_file = system.file("extdata",
                                                 "OrdersResultsT1.csv",
                                                 package = "lazytrade"),
                    demo_mode = TRUE)


# without writing to the file
DFT1 %>% check_if_optimize(num_trades_to_consider = 3,
                           profit_factor_limit = 1.2,
                           demo_mode = TRUE,
                           write_mode = FALSE)

# function will write to the temporary file
DFT1 %>% check_if_optimize(num_trades_to_consider = 3,
                           profit_factor_limit = 1.2,
                           demo_mode = TRUE,
                           write_mode = TRUE)


# }

Run the code above in your browser using DataLab