Need setting commission and slippage for individual futures in Portfolio Trader

Questions about MultiCharts and user contributed studies.
regtracer
Posts: 24
Joined: 28 Dec 2016
Been thanked: 2 times

Need setting commission and slippage for individual futures in Portfolio Trader

Postby regtracer » 13 May 2019

Hello,

I'm testing a portfolio of futures in Portfolio Trader but found that the current commission and slippage settings are not sufficient to produce correct backtest results. For example, a future contract IF traded on CFFEX has a commission of CNY 30 per contract, and an assumed slippage of 2 ticks=120 CNY, while another future contract RB also traded on SHFE has a commission of CNY 5 per contract and a slippage of 1 tick=5 CNY. I can't set them as single values in the current simplified commission and slippage GUI settings.

I hope there would be an API such as set_commission(...) and set_slippage(...) so that we can set these values in code. In this way we don't need to mess up with the GUI but get the greatest flexibility.

regtracer
Posts: 24
Joined: 28 Dec 2016
Been thanked: 2 times

Re: Need setting commission and slippage for individual futures in Portfolio Trader

Postby regtracer » 13 May 2019

By the way, this functionality is also needed for testing a mixed portfolio of futures, stocks, and/or forex.

wilkinsw
Posts: 537
Joined: 21 Apr 2013
Has thanked: 136 times
Been thanked: 87 times

Re: Need setting commission and slippage for individual futures in Portfolio Trader

Postby wilkinsw » 13 May 2019

Hi Regtracer,

What you're requesting is one of the most popular feature requests. I think it's essential too.

MC say it's too big a task to implement. Maybe they should launch a crowd funding solution to the raise the funds to make these vital improvements!

Also note that there is no Bar Magnifier in PT too; so make sure you don't use stop losses that are too close to a stop entry (as an example) as PT will overestimate the frequency with which you don't get stopped out. Always cross validate PT performance reports in MC with BM on for individual symbols.

viewtopic.php?t=41963

https://www.multicharts.com/pm/public/m ... es/MC-1708

regtracer
Posts: 24
Joined: 28 Dec 2016
Been thanked: 2 times

Re: Need setting commission and slippage for individual futures in Portfolio Trader

Postby regtracer » 13 May 2019

Yeah, it's essential for accurate portfolio backtesting. The commission rates of China's future markets also vary. Some are defined as fixed amount per contract, while others are defined as a percentage of traded value.

Quantopian allows setting slippage and commission per bar to even account for the impact of volatility.

Please provide two API in the code:

set_commission(...)
set_slippage(...)

wilkinsw
Posts: 537
Joined: 21 Apr 2013
Has thanked: 136 times
Been thanked: 87 times

Re: Need setting commission and slippage for individual futures in Portfolio Trader

Postby wilkinsw » 18 May 2019


Quantopian allows setting slippage and commission per bar to even account for the impact of volatility.
How? Would you mind detailing it please?

I think one should set commission and then set slippage costs based on fill type at the top of a signal's code. Multicharts, in turn should recognise the respective fill types:

Code: Select all

set_commission=2

e.g. if assuming resting limit filled on touch:

Code: Select all

set_passive_slippage=15


e.g. if assuming resting limit filled if next price is touched and trading a thick depth instrument:

Code: Select all

set_passive_slippage=-5
e.g. if sending a market order next bar increased probability of crossing the spread vs filled at last traded:

Code: Select all

set_nextbar_aggressor_slippage=15
e.g. if a resting stop is triggered and executed; in many products this will result in a fill at last traded price most of the time.

Code: Select all

set_resting_aggressor_slippage=5

The values shown are for illustrative purposes only. You could then build a function which outputs what these values should be depending on the instrument being tested on. Insert that function in the signal's code and the place the outputted variables in place of the values shown above and you're good to go!

Will put an end to gaming a PT optimisation based on overly optimistic/pessimistic trading costs! (Well..... we would need Bar Magnifier too for that ; ) )


Return to “MultiCharts”