Skip to content

blotter tradeStats Profit.factor is Infinite ?

5 messages · ce, Joshua Ulrich, Daniel Cegiełka +1 more

ce
#
yes but in the output I pasted Gross Profit is 270.96774 , so  I have some profit, no loss meaning ????


-----Original Message-----
From: "Ilya Kipnis" [ilya.kipnis at gmail.com]
Date: 10/06/2014 09:48 PM
To: "ce" <zadig_1 at excite.com>
CC: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
Subject: Re: [R-SIG-Finance] blotter tradeStats Profit.factor is Infinite ?

So theres your answer.
On Mon, Oct 6, 2014 at 9:35 PM, ce <zadig_1 at excite.com> wrote:
Which ever way it calculates abs(0) is still 0 . Gross Profit / 0 is Inf .


-----Original Message-----
From: "Ilya Kipnis" [ilya.kipnis at gmail.com]
Date: 10/06/2014 09:26 PM
To: "ce" <zadig_1 at excite.com>
CC: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
Subject: Re: [R-SIG-Finance] blotter tradeStats Profit.factor is Infinite ?

That depends if gross loss is computed as positive or negative. Tradestats computes it as a negative quantity.
On Mon, Oct 6, 2014 at 8:54 PM, ce <zadig_1 at excite.com> wrote:
most resources says? profit factor = gross profit / gross loss

one example is http://www.tradingmarkets.com/recent/whats_your_profit_factor_heres_an_assignment_for_you-657965.html


-----Original Message-----
From: "Ilya Kipnis" [ilya.kipnis at gmail.com]
Date: 10/06/2014 08:45 PM
To: "ce" <zadig_1 at excite.com>
CC: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
Subject: Re: [R-SIG-Finance] blotter tradeStats Profit.factor is Infinite ?

Profit factor is defined as the absolute value of gross profits over gross losses. What is anything divided by zero?
On Mon, Oct 6, 2014 at 8:40 PM, ce <zadig_1 at excite.com> wrote:
My test program gives in tradeStats output some Profit factors as? Inf? .? I guess because Gross.Losses are zero .
Is it normal or am I doing something wrong ?

? ? ?Med.Trade.PL Largest.Winner Largest.Loser Gross.Profits Gross.Losses
ABTL? ?270.967742? ? ? 270.96774? ? ? ?0.00000? ? ?270.96774? ? ? 0.00000

? ? ?Std.Dev.Trade.PL Percent.Positive Percent.Negative Profit.Factor
ABTL? ? ? ? ? ? ? ?NA? ? ? ? 100.00000? ? ? ? ? 0.00000? ? ? ? ? ?Inf

_______________________________________________
R-SIG-Finance at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
#
The source code is available to you.  Please look at it.  You have no
losing trades.  What do you expect your gross losses to be?
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
On Mon, Oct 6, 2014 at 9:00 PM, ce <zadig_1 at excite.com> wrote:
#
2014-10-07 7:38 GMT+02:00 Daniel Cegie?ka <daniel.cegielka at gmail.com>:
more compact:

GrossProfits <- sum(PL.gt0)
GrossLosses <- sum(PL.lt0)
ProfitFactor <- ifelse(GrossLosses == 0, NA, abs(GrossProfits/GrossLosses))

Maybe we should add more such checks to the code (for div ops)? eg:

AnnSharpe  <- ifelse(StdDailyPL == 0, NA, AvgDailyPL/StdDailyPL * sqrt(252))
AvgWinLoss <- ifelse(AvgLossTrade == 0, NA, AvgWinTrade/-AvgLossTrade)
MedWinLoss <- ifelse(MedLossTrade == 0, NA, MedWinTrade/-MedLossTrade)
ProfitToMaxDraw  <- ifelse(MaxDrawdown == 0, NA, -TotalNetProfit / MaxDrawdown)

btw. NA looks better than Inf.

Daniel
#
On 10/07/2014 01:22 AM, Daniel Cegie?ka wrote:
Thanks, patches applied in svn r1637.

Of course, a backtest with zero losing trades is implausibly perfect...

Regards,

Brian