diff --git a/pkg/types/trade_stats.go b/pkg/types/trade_stats.go index 8c9f20e62..79c403b88 100644 --- a/pkg/types/trade_stats.go +++ b/pkg/types/trade_stats.go @@ -16,6 +16,8 @@ type TradeStats struct { Losses []fixedpoint.Value `json:"losses" yaml:"losses"` MostProfitableTrade fixedpoint.Value `json:"mostProfitableTrade" yaml:"mostProfitableTrade"` MostLossTrade fixedpoint.Value `json:"mostLossTrade" yaml:"mostLossTrade"` + ProfitFactor fixedpoint.Value `json:"profitFactor" yaml:"profitFactor"` + TotalNetProfit fixedpoint.Value `json:"totalNetProfit" yaml:"totalNetProfit"` } func (s *TradeStats) Add(pnl fixedpoint.Value) { @@ -30,6 +32,7 @@ func (s *TradeStats) Add(pnl fixedpoint.Value) { s.GrossLoss = s.GrossLoss.Add(pnl) s.MostLossTrade = fixedpoint.Min(s.MostLossTrade, pnl) } + s.TotalNetProfit = s.TotalNetProfit.Add(pnl) // The win/loss ratio is your wins divided by your losses. // In the example, suppose for the sake of simplicity that 60 trades were winners, and 40 were losers. @@ -39,6 +42,8 @@ func (s *TradeStats) Add(pnl fixedpoint.Value) { } else { s.WinningRatio = fixedpoint.NewFromFloat(float64(s.NumOfProfitTrade) / float64(s.NumOfLossTrade)) } + + s.ProfitFactor = s.GrossProfit.Div(s.GrossLoss) } func (s *TradeStats) String() string {