I have a question/concern about the Portfolio Backtester
Despite the signal stating "if marketposition=0 then…." , the Backtester allows multiple open positions to occur. The marketposition statement seems to only hold true for the same stock, but if backtesting on a basket of stocks it allows a number to be open at the same time should conditions be met.
To me this does not help with portfolio management at all.
It simply saves time testing the signal against many stocks or commodities, doing them at the sime time, rather than one after the other.
It does not help answer the question,....... If I had 100k to invest, what would the outcome be after x no. of trades or y amount of time , knowing that the maximum I could trade was starting with a total of 100k spread across all open positions, not just each different one.
Ideally the Portfolio Backtester would then use the new account size (Total Acct = Acct + netprofit) represented by the sum of the profits and losses to-date, but sadly it only seems to do this in respect of each individual stock.
Hence, in my opinion the portfolio backtester should be renamed more simply as Backtester.
I would love to see true portfolio testing available in the next enhancement.
BTW, I have looked up a number of threads about changing Max Potential Loss to 100% and a few other tweaks in Portfolio Settings, but the basic outcome is the same ……..it does not appear to limit trades to a COMBINED value as set in the signal or portfolio settings.
Please tell me if I have overlooked something (Backtester documentation currently = 0)
else
MC Please provide the enhancement.
In my opinion, and I have met some truly awesome traders, money management and portfolio management is where the real dollars are made. If Multicharts can do something spectacular with that I believe many more traders/investors would be interested (appealing to MC's commercial interests here).
Portfolio Backtester does not manage a Portfolio
- JoshM
- Posts: 2196
- Joined: May 20 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Have you tried the Portfolio_CurrentEntries keyword? (If that keyword would equal zero, there is no MarketPosition in the portfolio)Despite the signal stating "if marketposition=0 then…." , the Backtester allows multiple open positions to occur. The marketposition statement seems to only hold true for the same stock, but if backtesting on a basket of stocks it allows a number to be open at the same time should conditions be met.
Portfolio_CurrentEntries
Returns a numerical value, indicating the combined number of entries currently open within a portfolio.
Do you mean the Portfolio Backtester itself or your signal backtested by the Portfolio Backtester? In the signal, you can use one of the Portfolio reserved words for getting this data:It does not help answer the question,....... If I had 100k to invest, what would the outcome be after x no. of trades or y amount of time , knowing that the maximum I could trade was starting with a total of 100k spread across all open positions, not just each different one.
Ideally the Portfolio Backtester would then use the new account size (Total Acct = Acct + netprofit) represented by the sum of the profits and losses to-date, but sadly it only seems to do this in respect of each individual stock.
Found in the PowerLanguage Editor -> Dictionary Field. (If you can't see that, check the View -> Navigator Bar setting)
Regards,
Josh
- Attachments
-
- portfolioReservedWords.PNG
- (25.25 KiB) Downloaded 608 times
Thanks JoshM,
I was hopeful that Portfolio_CurrentEntries =0 would do the trick, but it didn't
As chance would have it, there were a few occasions where there were no open positions at a all but the signal entry conditions were met at exactly the same time in 2 or 3 different stocks.
So Backtester accepted the orders with the result that in the real world I would have been trading a total of 300k open orders, instead of 100k.
I looked at the possibility of using PortfolioEntriesPriority and this was promising when combined with a Max Potential Loss setting of 100% in portfolio settings…..
but
one of the priory settings I tried still allowed total entry in excess of 100k because order 1 totalled 34k in size while order 2 totalled 100k. Order 2 needs to be limited down to 66k, but I see no way of doing this when the orders are generated at exactly the same time.
Portfolio_SetMaxPotentialLossPerContract didn't help either.
BTW In case you are wondering why the different order size............
the signal determines the stop size in points (variable but say 10c), contract numbers are determined by the predetermined potential loss (say $250, so contracts=250/stop size, in this case 2500), order size = close x contract size (so in a $13.50 stock, order size = $34,000 while the same stop size in a $40 stock would generate order size of 100k).
Anyway, lets say that potential order size for 3 stocks with a valid entry signal are $34k, 50k and 40k, when all current positions=0, I don't see how Backtester can limit the orders to the real world total of 100k
Any further ideas would be appreciated.
I was hopeful that Portfolio_CurrentEntries =0 would do the trick, but it didn't
As chance would have it, there were a few occasions where there were no open positions at a all but the signal entry conditions were met at exactly the same time in 2 or 3 different stocks.
So Backtester accepted the orders with the result that in the real world I would have been trading a total of 300k open orders, instead of 100k.
I looked at the possibility of using PortfolioEntriesPriority and this was promising when combined with a Max Potential Loss setting of 100% in portfolio settings…..
but
one of the priory settings I tried still allowed total entry in excess of 100k because order 1 totalled 34k in size while order 2 totalled 100k. Order 2 needs to be limited down to 66k, but I see no way of doing this when the orders are generated at exactly the same time.
Portfolio_SetMaxPotentialLossPerContract didn't help either.
BTW In case you are wondering why the different order size............
the signal determines the stop size in points (variable but say 10c), contract numbers are determined by the predetermined potential loss (say $250, so contracts=250/stop size, in this case 2500), order size = close x contract size (so in a $13.50 stock, order size = $34,000 while the same stop size in a $40 stock would generate order size of 100k).
Anyway, lets say that potential order size for 3 stocks with a valid entry signal are $34k, 50k and 40k, when all current positions=0, I don't see how Backtester can limit the orders to the real world total of 100k
Any further ideas would be appreciated.
- JoshM
- Posts: 2196
- Joined: May 20 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
According to the manual, that should not happen:(..)
As chance would have it, there were a few occasions where there were no open positions at a all but the signal entry conditions were met at exactly the same time in 2 or 3 different stocks.
So Backtester accepted the orders with the result that in the real world I would have been trading a total of 300k open orders, instead of 100k.
See page 235 of the MultiCharts manual (found here).During backtesting, a single bar of each symbol’s data series is evaluated by the strategy’s signal scripts, starting with the first (oldest) bar. The series’ bars are evaluated in the order that the symbols appear in the symbols table of the Portfolio Backtester. Based on evaluation of each series’ bar, a set of one or more orders may be generated by the scripts for each of the symbols. Order sets are generated in the same sequence as the series’ bars are evaluated.
(...)
At the risk control stage, the sequence of order sets is treated as one long sequence of orders. The orders are executed one-by-one from the beginning of the sequence, until all orders are executed, or until the risk control limits defined in Portfolio Settings of the Portfolio Backtester prevent the execution of remaining orders. Any remaining orders that could not be executed are discarded.
Can you provide a code example of your strategy and an overview of the Portfolio Backtester settings?
Regards,
Josh
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Initial Portfolio Capital and Max Potential loss should have limited the orders.
Please provide an example of your script, screenshots of all Portfolio Backtester settings and the Bactesting report for futher analysis.
Please provide an example of your script, screenshots of all Portfolio Backtester settings and the Bactesting report for futher analysis.