Changes

Jump to navigation Jump to search

Portfolio Trader Strategy Examples

49 bytes removed, 14:53, 29 September 2014
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:
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:

Navigation menu