Calculate Profit Factor
Calculate profit factor using a data vector with the trading results
util_profit_factor(x)
x
: column vector with profit or loss of the orders for one systemfunction should calculate profit factor for this vector and return one value also as vector
library(magrittr) library(dplyr) library(lazytrade) data(profit_factor_data) profit_factor_data %>% group_by(X1) %>% summarise(PnL = sum(X5), NumTrades = n(), PrFact = util_profit_factor(X5)) %>% select(PrFact) %>% head(1) %>% round(3)
(C) 2019 Vladimir Zhbanko
Useful links