Portfolio Trader: Difference between revisions
From MultiCharts
→Symbol Prioritization
No edit summary |
|||
(27 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
In MultiCharts 9.0 '''Portfolio Backtester''' has been improved and became '''Portfolio Trader''' adding [[#Automated Trading|Portfolio Automation]] and [[#Forward Testing|Forward Testing]] to the list of features. | |||
In MultiCharts 9.0 '''Portfolio Backtester''' has been improved and became '''Portfolio Trader''' | |||
Download [[Media:Portfolio_Trader_Manual.pdf]] in '''.PDF''' format. | |||
== Opening Portfolio Trader == | |||
To open '''Portfolio Trader''': | |||
* click '''Portfolio Trader''' [[File:Port Trdr icon.png]] icon on the '''Main''' toolbar; or: | |||
* in the '''Main''' menu select '''File''', then point to '''New''' and click '''Portfolio Trader'''. | |||
<br> | |||
== Understanding Portfolio Trader == | == Understanding Portfolio Trader == | ||
Line 10: | Line 16: | ||
=== Portfolio Trading Benefits === | === Portfolio Trading Benefits === | ||
Applying a trade strategy to a number of financial instruments simultaneously offers the following advantages: | |||
* A diverse portfolio will produce more consistent results | * A diverse portfolio will produce more consistent results. | ||
* Infrequent trading opportunities will be more common across a number of symbols | * Infrequent trading opportunities will be more common across a number of symbols. | ||
* Portfolio strategies can maximize profit and minimize risks by dynamically allocating a portfolio’s capital based on each instrument’s performance | * Portfolio strategies can maximize profit and minimize risks by dynamically allocating a portfolio’s capital based on each instrument’s performance. | ||
* Portfolio strategies can enter, scale-in, scale-out, or exit positions based on the portfolio’s overall performance | * Portfolio strategies can enter, scale-in, scale-out, or exit positions based on the portfolio’s overall performance. | ||
* Portfolio strategies are generally more robust and less susceptible to over-optimization | * Portfolio strategies are generally more robust and less susceptible to over-optimization. | ||
* By backtesting on a diverse portfolio, instruments best suitable for that particular trading strategy can be selected. | * By backtesting on a diverse portfolio, instruments best suitable for that particular trading strategy can be selected. | ||
Line 45: | Line 51: | ||
'''Performance Graph''' gives a visual representation of portfolio performance. The following values are shown: | '''Performance Graph''' gives a visual representation of portfolio performance. The following values are shown: | ||
* Initial Capital | * Initial Capital. | ||
* Net Profit | * Net Profit. | ||
* Equity | * Equity. | ||
* Buying Power | * Buying Power. | ||
[[File:Perf Graph.png]] | [[File:Perf Graph.png]] | ||
Line 72: | Line 78: | ||
'''Portfolio Performance Report''' is available in '''Auto Trading Mode'''. A Portfolio Performance Report shows results generated from the moment it opens. | '''Portfolio Performance Report''' is available in '''Auto Trading Mode'''. A Portfolio Performance Report shows results generated from the moment it opens. | ||
<br><div style="background-color: #E3FBE5;">'''NOTE:''' The report is recalculated automatically in the '''Forward Testing''' and '''Auto Trading''' modes, but not in the '''Backtesting''' mode. | |||
Please, also note that there are 2 cases when the Report is not recalculated: | |||
* when it is opened on Trade Analysis -> List of Trades page | |||
* when it is opened on Breakdown by Symbols -> Overview -> detailed report for the symbol page. </div> | |||
== Understanding Dynamic Portfolio == | == Understanding Dynamic Portfolio == | ||
Line 93: | Line 105: | ||
== Portfolio Script Calculation Diagram == | == Portfolio Script Calculation Diagram == | ||
To see '''Portfolio Script Calculation Diagram''' please click '''[[Portfolio Script Calculation Diagram|here]]''' | To see '''Portfolio Script Calculation Diagram''' please click '''[[Portfolio Script Calculation Diagram|here]]'''. | ||
== Script Calculation and Raw Order Generation == | |||
'''Portfolio Trader | Here is a sequence of actions that will be performed during calculation: | ||
# Before a portfolio is calculated, data from all instruments contained in the Instrument List are either gathered from MultiCharts database or downloaded from a data provider's server. The strategy is then applied to every instrument in the Portfolio Tree. | |||
# 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 Portfolio Trader. 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. | |||
# This process is illustrated in the Raw Order Generation section of the [[Portfolio Script Calculation Diagram|diagram]]: the first bar for symbol 1 is evaluated first, and a set of orders is generated based on that bar. Then the first bar for symbol 2 is evaluated, and a set of orders is generated based on that bar. The process is repeated until the first bar for the last symbol (Symbol N) is evaluated. | |||
# After all of the strategies have been calculated, the PMM (Portfolio Money Management) signal is initiated (if any has been applied under Portfolio Properties). The PMM signal is used to apply money management settings to the entire portfolio. It can access all of the portfolio's strategies via pmms_keywords. (Calculation-wise, the PMM signal is not copied to every signal and is always calculated on the first instrument on the same bar on which all other signals are calculated). | |||
# The PMM signal evaluates all of the portfolio’s strategies and affects generated orders (e.g., places orders which force positions to close, prevents opening positions or modifies the number of contracts). Raw orders that pass the PMM signal evaluation are then evaluated by the MONEY & RISK management system, with priority determined by MONEY & RISK's settings (priority is set by the PortfolioEntriesPriority keyword). If priority is set the same for all strategies, higher priority is given to the strategy located on top of the Portfolio Tree. <br><div style="background-color: #E3FBE5;"> '''Note''' that the PMM signal and the '''PortfolioEntriesPriority''' keyword are both applied to the portfolio. '''PortfolioEntriesPriority''' keyword is a legacy and it can interfere with the PMM signal. We do not recommend you use it.</div> | |||
# The number of contracts is corrected in accordance with Money Management and margin (in '''Portfolio Settings'''). | |||
# The order is sent either to a broker simulator (in Backtesting), a demo broker account or a live broker account (in Automated trading). | |||
== Understanding Portfolio Money Management Signals == | == Understanding Portfolio Money Management Signals == | ||
Line 117: | Line 138: | ||
Each strategy is designed to open and close positions of a specific instrument, i.e. the strategy calculates the moment WHEN the position should be opened/closed. | Each strategy is designed to open and close positions of a specific instrument, i.e. the strategy calculates the moment WHEN the position should be opened/closed. | ||
After all strategies have been calculated, the PMM (Portfolio Money Management) signal (if any | After all strategies have been calculated, the PMM (Portfolio Money Management) signal (if any PMM signal has been applied) is initiated. | ||
The '''PMM signal''' can access all the strategies within a portfolio PMMS functionality helps to manage: | The '''PMM signal''' can access all the strategies within a portfolio. PMMS functionality helps to manage: | ||
* Rotation strategy (when N “Best” instruments are traded simultaneously). | * Rotation strategy (when N “Best” instruments are traded simultaneously). | ||
Line 127: | Line 148: | ||
[[File:PMMS Signal window.png]] | [[File:PMMS Signal window.png]] | ||
Since '''MultiCharts 11''' Portfolio Money Management signals can generate '''alerts'''. To enable alerts for the PMM signals it is required to use [[Alert]] keyword in the code of the signal and enable alerts in the '''Alerts''' tab in '''Strategy properties'''. | |||
<div style="background-color: #E3FBE5;">'''Note:''' It is important to understand that Money Management signals have a base resolution – this is the first symbol in your Portfolio table (the upper left cell of the table, as shown on the picture above). The data and statuses are taken from it during the PMM signal’s calculations. Even if the first strategy is disabled in Portfolio Tree, the PMM signal will refer to this symbol.</div> | |||
<div style="background-color: #E3FBE5;">If a PMM signal references additional data series (Data2, Data3, etc) the values are also taken from the first row of the Portfolio instruments table.</div> | |||
== Symbol Prioritization == | == Symbol Prioritization == | ||
If the '''PortfolioEntriesPriority''' function is specified within a strategy, the sequence of the sets of orders is rearranged based on the criteria specified. | If the '''PortfolioEntriesPriority''' function is specified within a strategy, the sequence of the sets of orders is rearranged based on the criteria specified. | ||
This process is illustrated in the Symbol Prioritization section of the diagram: the resulting sequence of sets of orders begins with the set of orders for the symbol 1, followed by the set of orders for symbol N, and ends with the set of orders for symbol 2. | This process is illustrated in the Symbol Prioritization section of the [[Portfolio Script Calculation Diagram|diagram]]: the resulting sequence of sets of orders begins with the set of orders for the symbol 1, followed by the set of orders for symbol N, and ends with the set of orders for symbol 2. | ||
The position of a set of orders in the sequence determines its relative priority: the set of orders for symbol 1 has the highest priority ( | The position of a set of orders in the sequence determines its relative priority: the set of orders for symbol 1 has the highest priority (1), set of orders for symbol N has the second highest priority (2), and the set of orders for symbol 2 has the least priority (3). | ||
== Risk Control == | == Risk Control == | ||
At the risk control stage, the sequence of sets of orders is treated as one long sequence of orders. 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 prevent the execution of remaining orders. Any remaining orders that could not be executed are discarded. | At the risk control stage, the sequence of sets of orders is treated as one long sequence of orders. 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 prevent the execution of remaining orders. Any remaining orders that could not be executed are discarded. | ||
This process is illustrated in the Risk Control section of the diagram: all of the orders for symbol 1 and symbol N are executed, while only some of the orders for symbol 2, 100 shares Long @ 55, are executed, due to risk control limits; this prevents the execution of the rest of the orders for symbol 2. | This process is illustrated in the Risk Control section of the [[Portfolio Script Calculation Diagram|diagram]]: all of the orders for symbol 1 and symbol N are executed, while only some of the orders for symbol 2, 100 shares Long @ 55, are executed, due to risk control limits; this prevents the execution of the rest of the orders for symbol 2. | ||
The entire process is repeated for the next bar of each of the portfolio symbol's data series. | The entire process is repeated for the next bar of each of the portfolio symbol's data series. | ||
Line 151: | Line 177: | ||
All major strategy calculation indicators, such as Portfolio Net Profit, Gross Profit, Gross Loss, Trades Profits and Losses, etc. are calculated in the account currency, including EXISTING MaxIDDrawDown, NetProfit, MaxPositionProfit; PosTrade***;_OpenEntry***. <br> | All major strategy calculation indicators, such as Portfolio Net Profit, Gross Profit, Gross Loss, Trades Profits and Losses, etc. are calculated in the account currency, including EXISTING MaxIDDrawDown, NetProfit, MaxPositionProfit; PosTrade***;_OpenEntry***. <br> | ||
Strategy values (during backtesting, optimization, forward testing, realtime trading) are converted using historical data. The corresponding exchange rates at the close of the previous FOREX trading session will be used, intra-day exchange rate fluctuations are not taken into account: e.g. if the trade occurs on April 30th, the close price of the April 29th FOREX trading session will be used. | |||
Currency conversion patterns:<br> | Currency conversion patterns:<br> | ||
Line 185: | Line 210: | ||
Thus, if the rate had changed significantly after buying, for example up to 1.4, the executed trade would have been losing money: | Thus, if the rate had changed significantly after buying, for example up to 1.4, the executed trade would have been losing money: | ||
The buy would have been for ($100/1.25 =) 80 EUR and the following amount would have been made after selling ($110/1.4 =) 78.57 EUR. | The buy would have been for ($100/1.25 =) 80 EUR and the following amount would have been made after selling ($110/1.4 =) 78.57 EUR. | ||
== Portfolio Trader Strategy Examples == | |||
'''Portfolio Trader Strategy Examples''' for regular MultiCharts (PowerLanguage) can be found '''[[Portfolio Trader Strategy Examples|here]]'''. | |||
== Portfolio Money Management Keywords == | |||
'''PMM Keywords''' and understanding of '''“pmm_set” and “pmm_get”''' for regular version of MultiCharts (PowerLanguage) can be seen '''[[PMM Keywords|here]]'''. | |||
Line 190: | Line 224: | ||
[[Category:Portfolio | [[Category:Portfolio Trading]] |