check_if_optimize function

Function check_if_optimize.

Function check_if_optimize.

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

check_if_optimize( x, system_list, path_data, num_trades_to_consider = 3, profit_factor_limit = 0.7, write_mode = FALSE )

Arguments

  • x: * dataframe containing trading results
  • system_list: * dataframe containing a table with magic numbers used by robots. Stored in file Setup.csv
  • path_data: * string, path to the folder where optimization file should be written
  • num_trades_to_consider: * Number of trades to calculate profit factor
  • profit_factor_limit: * Limit below which trading robot is considered not working properly
  • write_mode: * When true function will write result to the file located in the temporary directory

Returns

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

library(lazytrade) library(magrittr) library(dplyr) library(readr) library(lubridate) path_data <- normalizePath(tempdir(),winslash = "/") file.copy(from = system.file("extdata", "Setup.csv", package = "lazytrade"), to = file.path(path_data, "Setup.csv"), overwrite = TRUE) system_list <- read_csv(file.path(path_data, "Setup.csv")) data(profit_factorDF) # without writing to the file check_if_optimize(x = profit_factorDF, system_list = system_list, path_data, num_trades_to_consider = 3, profit_factor_limit = 0.8, write_mode = TRUE)

Author(s)

(C) 2019,2021 Vladimir Zhbanko