# Portfolio priority, best stock of week

Questions about MultiCharts and user contributed studies.
rgranero
Posts: 51
Joined: 26 Jul 2010
Has thanked: 3 times
Been thanked: 1 time

### Portfolio priority, best stock of week

Hi,

with this code I would take in portfolio only the first stock with higher momentum and rebalancing each week:

value1=(c-c[10])/c;

PortfolioEntriesPriority=value1;

if c>.001 then buy next bar at open;

if dayofweek(date)=5 then sell this bar at close;

In portfolio backtester, portfolio tree I insert 5 instrument and in strategy, property, trade size put 100000. In portfolio setting, initial portfolio capital put 100000.

In the report each start of week I have all the stock in portfolio with 100000 invested in each stock...

Could anyone help me? Thanks!

Riccardo

rgranero
Posts: 51
Joined: 26 Jul 2010
Has thanked: 3 times
Been thanked: 1 time

### To better explain: Portfolio priority, best stock of week

To better explain:

In this manner I would build and backtest a rotation strategy.

{calclulate momentum of each stock}
value1=(c-c[10])/c;

{calculate the priority of each stock with highest momentum}
PortfolioEntriesPriority=value1;

{buy each monday. With setting (initial capital = trade size) in portfolio backtester and
PortfolioEntriespriority on momentum I have only 1 stock with high momentum}
if c>.001 then buy next bar at open;

{in friday I sell, in monday buy the new stock with high momentum}
if dayofweek(date)=5 then sell this bar at close;

Then I set portfolio initial capital = trade size to have only one instrument in portfolio because I
having reached the maximum capital.

Where is my mistake?

Anyone use MC backtester to backtest rotation strategy or market neutral strategy (buy the best five and sell the bed five of the list...)?

Riccardo

Thanks
Riccardo

rgranero
Posts: 51
Joined: 26 Jul 2010
Has thanked: 3 times
Been thanked: 1 time

### Re: Portfolio priority, best stock of week

Continue...

Where is the mistake?

I have all the stock in portfolio and the capital invested is 5*100.000,00=500.000,00 while there should be only 1 stock and 100.000,00.
My setting:
in portfolio backtester, portfolio tree I insert 5 instrument and in strategy, property, trade size put 100000. In portfolio setting, initial portfolio capital put 100000.

Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 486 times

### Re: Portfolio priority, best stock of week

Dear Riccardo,

Please send us your workspace as well as the Strategy perfomance Report in Excel file.

rgranero
Posts: 51
Joined: 26 Jul 2010
Has thanked: 3 times
Been thanked: 1 time

### Re: Portfolio priority, best stock of week

Thanks Dave the problem has been solved from MC staff!

Have a happy new year!
Riccardo

Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 486 times

### Re: Portfolio priority, best stock of week

Hello Riccardo,

No problem. Glad to hear that everything is ok now.

Happy New Year too!