Portfolio Trader Keywords to Prevent Trading on Margin

Questions about MultiCharts and user contributed studies.
Posts: 50
Joined: 28 Sep 2014
Has thanked: 7 times

Portfolio Trader Keywords to Prevent Trading on Margin

Postby trader0311 » 13 Oct 2017


As I have noted here in the forum, when you are trading a portfolio of strategies in portfolio trader, and you specify the number of shares that are to be traded as a variable within the actual code/script, the Portfolio Trader Money Management Setting do not work. When this happens, you can trade more than your account is worth.

Until this is fixed, is there a workaround I can use to cap the value of securities traded within my portfolio. I was thinking that there might be a PMM reserved word or a line of code that I would include in the "Money Management Signal" code section that would cap the value of securities that I can trade at any time. For example, I would like to tell portfolio trader to not buy more that $200,000 of securities at any time. Then Portfolio Trader would cycle through the strategies in the order I have them listed in the strategy tree and will not allow any further trading once my portfolio is fully invested at the threshold I specify. For backtesting purposes, I would rather not use portfolio equity which grows over time, but a fix constant threshold.

Any help on this line of code that could accomplish this, and where I put that line of code (ie in the Money Management Signal r embedded within my code) would be greatly appreciated.

Thank you!

User avatar
Anna MultiCharts
Posts: 194
Joined: 14 Jul 2017
Has thanked: 9 times
Been thanked: 49 times

Re: Portfolio Trader Keywords to Prevent Trading on Margin

Postby Anna MultiCharts » 19 Oct 2017

Hello, trader0311!

Please, try specifying 100% for the Margin value of contract cost as was suggested by our engineer in the workspace example attached in this post: viewtopic.php?f=1&t=51019&p=127421#p127357

Return to “MultiCharts”