PosTradeCommission and PosTradeProfit vs. List Of Trades

Questions about MultiCharts and user contributed studies.
mjm
Posts: 28
Joined: 22 Aug 2012
Has thanked: 9 times
Been thanked: 4 times

PosTradeCommission and PosTradeProfit vs. List Of Trades

Postby mjm » 19 Sep 2012

I have a question about the way the PosTrade* functions take account of the Commission and Slippage settings in the Portfolio Backtester. As an experiment I ran the same backtest with four different settings in the Strategy / Show Properties / Properties dialog (all given as per share/contract):

Run 1: Commission=0.00 Slippage=0.00
Run 2: Commission=0.01 Slippage=0.00
Run 3: Commission=0.00 Slippage=0.01
Run 4: Commission=0.01 Slippage=0.01

I then compared a particular trade in the Trade Analysis / List of Trades window with the values returned by the PosTrade* functions. The trade was:

Entry: Buy 5097 shares @ $19.62
Exit: Sell 5097 shares @ $19.86

In the List of Trades window, the "Profit $" field is reported as:

Code: Select all

Run 1: $1223.28
Run 2: $1121.34
Run 3: $1121.34
Run 4: $1019.40
These are what you expect: $0.24 profit per share * 5097 shares = $1223.28 for the base case, and then adding a $50.97 cost in each direction ($101.94 round-trip) for Run 2 and Run 3, and then double that for Run 4, corresponding to the $0.01/share commission and/or slippage.

However, here is what gets reported by the PosTrade* functions:

Code: Select all

PosTradeCommission PosTradeProfit
Run 1 $0.00 $1223.28
Run 2 $50.97 $1172.31
Run 3 $50.97 $1172.31
Run 4 $101.94 $1121.34
It is as if only one half of the costs are being charged to the trade. Also, it seems like the slippage is embedded into the reported commission, as for example in Run 3 where the Commission strategy setting was zero but the PosTradeCommission value is nonzero.

Do I misunderstand what the PosTrade* functions are supposed to return?

Thanks,
Mike

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: PosTradeCommission and PosTradeProfit vs. List Of Trades

Postby Dave Masalov » 20 Sep 2012

Hello Mike,

This is normal behavior.

PosTradeCommission returns commission + slippage for stop and market orders and commission for limit orders.

mjm
Posts: 28
Joined: 22 Aug 2012
Has thanked: 9 times
Been thanked: 4 times

Re: PosTradeCommission and PosTradeProfit vs. List Of Trades

Postby mjm » 20 Sep 2012

PosTradeCommission returns commission + slippage for stop and market orders and commission for limit orders.
Okay, but it still seems like both PosTradeCommission and PosTradeProfit are including only one-half of the cost they should be. In my Run 2 example (commission=0.01, slippage=0), the total round-trip commission for the trade is: 2 transactions * 5097 shares * $0.01/share = $101.94. But PosTradeCommission returns $50.97.

Similarly the net profit after commissions for the round-trip trade is: 5097 shares * ($19.86 - $19.62) - $101.94 = $1121.34. That is the number reported in the List Of Trades window. But PosTradeProfit returns $1172.31, consistent with its idea of $50.97 commission.

-Mike

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: PosTradeCommission and PosTradeProfit vs. List Of Trades

Postby Dave Masalov » 21 Sep 2012

Hello Mike,

PosTradeCommission returns double commission value only for closed trades. It returns single commission value for open trades and closed trades which are reverse trades (since the other half goes to the new trade).


Return to “MultiCharts”