lazytrade (version 0.4.0)

profit_factor: Calculate Profit Factor

Description

Calculate profit factor using a data vector with the trading results

Usage

profit_factor(x)

Arguments

x

column vector with profit or loss of the orders for one system

Value

function should calculate profit factor for this vector and return one value also as vector

Examples

Run this code
# NOT RUN {
library(magrittr)
library(dplyr)
data(profit_factor_data)
profit_factor_data %>%
   group_by(X1) %>%
   summarise(PnL = sum(X5),
             NumTrades = n(),
             PrFact = profit_factor(X5)) %>%
   select(PrFact) %>% head(1) %>% as.vector() %>% round(3)


# }

Run the code above in your browser using DataLab