Portfolio Money management - Equity curve trading inquiry

Questions about MultiCharts and user contributed studies.
kelvinhui9
Posts: 18
Joined: 02 Jan 2020
Has thanked: 3 times

Portfolio Money management - Equity curve trading inquiry

Postby kelvinhui9 » 13 Jan 2020

I have been searching for relevant code, resources on the below matter but still have no clue. it will be great if you can share any ideas, resources, or even sample code that you have seen before.

Basically, I would like to write a code so that the system will automatically pause/stop sending trading signals when the drawdown reaches let say 20% of the historical highest equity and then it will only resume sending out the signals when the portfolio equity rises again and cross above the "20%" line.

For example, my highest equity reaches to 1,000 and after it drops below 800, it will stop trading and then it will start again only when the equity reaches above 800 again.

May I know if there is any relevant resources or what direction should I go or it is impossible to achieve through multichart? Thank you so much!

Zheka
Posts: 223
Joined: 13 Jan 2016
Has thanked: 8 times
Been thanked: 53 times

Re: Portfolio Money management - Equity curve trading inquiry

Postby Zheka » 13 Jan 2020

There are no in-built tools for that, but you can use the min possible position size when the system is to be switched off. And you'll have to maintain your closed-trade equity yourself.

This will allow you to backtest your logic, but will unfortunately not work with MC/PT in live trading.

I once had a PM request on this (e.g. by using negative numbers for trade size to specify such trades that should not be sent to a broker), but it remained without a response.

kelvinhui9
Posts: 18
Joined: 02 Jan 2020
Has thanked: 3 times

Re: Portfolio Money management - Equity curve trading inquiry

Postby kelvinhui9 » 14 Jan 2020

Hello Zheka, Thanks for the reply! I see....just wondering if Multichart support team got some ideas on this matter ?
If multichart is not supporting this function, sounds like we need to keep an eye on the equity curve and pause the portfolio manually for those who are interested in this feature lol

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Portfolio Money management - Equity curve trading inquiry

Postby Svetlana MultiCharts » 24 Jan 2020

Hello, kelvinhui9,

You can use pre-built keywords for money management in Portfolio and code your own Portfolio Money Management signal.
Please refer to the following sources for more information:
1) https://www.multicharts.com/trading-sof ... nt_Signals

2) https://www.multicharts.com/trading-sof ... y_Examples

For example, you can monitor Portfolio_Equity and, if it falls below the critical level, then check NetProfit of each symbol in the portfolio, and deny orders generated by each individual strategy, or allow them when you get beyond the risk.

Below is the example of a script, you can test it as Portfolio Money Management signal.

Code: Select all

var: var_InitialPortfolioEquity(0); var: intrabarpersist var_PortfolioEquity_everyday(0); var: var_ii(0); array: a_Initial_symbols_netprofit[10000] (0); array: a_Everyday_symbols_netprofit[10000] (0); once begin cleardebug; var_InitialPortfolioEquity = Portfolio_Equity; Print(" InitialPortfolioEquity = ", var_InitialPortfolioEquity); end; var_PortfolioEquity_everyday = Portfolio_Equity; for var_ii = 0 to (pmms_strategies_count - 1) begin a_Everyday_symbols_netprofit[var_ii] = pmms_strategy_openprofit(var_ii) + pmms_strategy_netprofit(var_ii); Print(pmms_strategy_symbol(var_ii), " current netprofit_for_symbol = ", a_Everyday_symbols_netprofit[var_ii]); end; if (var_PortfolioEquity_everyday < 0.98 * var_InitialPortfolioEquity) then begin print( " Portfolio_Equity = ", var_PortfolioEquity_everyday , " Initial Portfolio_Equity = ", var_InitialPortfolioEquity, " Portfolio Equity < 98% Initial PE !!! Down " ); for var_ii = 0 to (pmms_strategies_count - 1) begin if (a_Everyday_symbols_netprofit[var_ii] < 0) then begin Print(pmms_strategy_symbol(var_ii), " netprofit_s = ", a_Everyday_symbols_netprofit[var_ii], " < ", 0, " ==> Deny"); pmms_strategy_deny_entries(var_ii); end else begin Print(pmms_strategy_symbol(var_ii), " netprofit_s = ", a_Everyday_symbols_netprofit[var_ii], " >= ", 0, " ==> Allow"); pmms_strategy_allow_entries(var_ii); end; end; end else begin pmms_strategies_allow_entries_all; print( " Portfolio_Equity = ", var_PortfolioEquity_everyday , " Initial Portfolio_Equity = ", var_InitialPortfolioEquity, " Portfolio Equity >= 98% Initial PE !!! UP ", " Allow All Strategies!!!"); end;


Return to “MultiCharts”