Changes

Jump to navigation Jump to search

Portfolio Trader Strategy Examples

72 bytes removed, 14:09, 9 September 2016
no edit summary
'''Portfolio Trader Strategy Examples''' Download [[Media:Portfolio_Trader_Strategy_Examples.pdf|Portfolio_Trader_Strategy_Examples.pdf]] for regular MultiCharts (PowerLanguage) in '''.PDF''' format can be downloaded '''[https://dl.dropboxusercontent.com/u/95112551/Portfolio%20RT%20Manual.%20Examples.pdf here].'''
== Rotation Strategy ==
==== Portfolio_Rotation_MM Signal ====
The signal is used as a '''Money management signalManagement Signal''' in portfolio. This study verifies the indicator values for all the portfolio instruments and manages positions opening.
The number of portfolio instruments for which positions will be opened is set by the user:
<syntaxhighlight>var: slave_idx(pmms_strategies_get_by_symbol_name(symbolname data2));
once if 0 > slave_idx then
raiseruntimeerror(text("specified slave trader on instrument ", doublequote, symbolname data2, doublequote, "not found"));</syntaxhighlight>
To synchronize the capital invested into positions for both instruments, we need to send the price of the current position of the main instrument to the pair strategy:
This signal '''Portfolio_SpreadTradingSystem.Slave Signal''' is calculated for the second instrument of the pair. It monitors all entries and exits generated by the previous signal '''Portfolio_SpreadTradingSystem.Master Signal''' for the main instrument of the pair and trades in the opposite direction. Firstly, all synchronization is done when '''MPMoney''' variable returned by master strategy changes.
<syntaxhighlight>value1 = pmms_from_portfolio_currency( pmm_get_my_named_num("MPMoney") );</syntaxhighlight>
We extract this variable and convert it from portfolio currency into instrument currency. Then, based on its value, we calculate the number of contracts for potential entry positions:
master_mp = IntPortion( value1 / ( value33 * bigpointvalue) );</syntaxhighlight>
The instrument’s current Current positionof the instrument:
<syntaxhighlight>my_mp = currentcontracts*marketposition;</syntaxhighlight>
end;</syntaxhighlight>
We’ll check if the main instrument’s position of the instrument has closed:
<syntaxhighlight>if 0 = value1 then begin // need to close position
If it has closed, we’ll close the position for the second instrument as well. If the main instrument has an open position, then we will determine the position’s direction for the second instrument:
<syntaxhighlight>if 0 < value1 then begin // we must buyif 0 < value1 then begin // we must buy</syntaxhighlight>
Value1 > 0 means that to synchronize the positions we should buy. There can be two cases:
<syntaxhighlight>// *** restrictions
once if barstatus(BasedOnData) < 0 then raiseruntimeerror("Portfolio Rank Signal Base needs datastream " + numtostr(BasedOnData, 0));
once if 1 <> getappinfo(aiisportfoliomode) then raiseruntimeerror("Portfolio Rank Signal Base can be applied to MCPortfolio application only.");
// ****************
Else If Rank>=490 then SellShort 200 contracts next bar at O; {Go Short the worse 10 stocks}</syntaxhighlight>
The above is a classic case of Stocks Relative Performance Trading.MyIndicator should be generic, meaning that the user should be able to change this Ranking Indicator as he wishes. Another Example of Ranking Indicator might be MyIndicator = ADX of data2; Then allow trading only in those stocks that have the highest ADX.:
<syntaxhighlight>MyIndicator = ADX of data2;</syntaxhighlight>
Then allow trading only in those stocks that have the highest ADX.

Navigation menu