Hello,
I am making a portfolio strategy. What I want is to buy some sares and then, I want to make partial closes and partial opens, without closing all the position.
For example:
First Trade: buy 100 Apple Shares buy 200 Google Shares
Second Trade: buy 10 Apple Shares sell 15 Google Shares (sell, no shortsell)
Third Trade: buy 20 Apple Shares buy 20 Google Shares
Fourth Trade: sell 5 Apple Shares buy 30 Google Shares
Final Portfolio: 125 Apple Shares 235 Google Shares
I'm implementing this strategy with a Portfolio Trader Signal and a Portfolio Trader MM Signal
I have read the documentation but I need some help.
Thank you very much
Portfolio Trader Rebalanced
Re: Portfolio Trader Rebalanced
Each row of PT is an independent strategy. So each row of PT behaves just like a chart. The PMM signal is an extra feature of PT and you do not need to use it. So for your purpose insert two symbols (GOOG and AAPL), insert your signals against them, and hit backtest.
Re: Portfolio Trader Rebalanced
I do need it. Because I looking for rebalance the portfolio. I want to have the same dollar amount in each symbol. It isn't just buy or sell...
Re: Portfolio Trader Rebalanced
From my understanding of what you are looking to do, you don't need the PMM signal for doing equal position sizing or portfolio rebalancing. You can simply have each individual strategy look at the total portfolio account value and take action. In addition, if you want strategies to cooperate for maintaining a market-neutral position, you can still achieve it via built in global variables in PT. See pmm_set_global_named_num and friends.I do need it. Because I looking for rebalance the portfolio. I want to have the same dollar amount in each symbol. It isn't just buy or sell...
Re: Portfolio Trader Rebalanced
I have tried what you said.
This is my code:
I have tested this code with three symbols: SPY, CAT and AAPL.
The output created by the print for the first four days is the following:
1130503.00 AAPL 0.00 518.00 518.00
1130503.00 CAT 0.00 383.00 383.00
1130503.00 SPY 0.00 206.00 206.00
1130506.00 AAPL 518.00 509.00 9.00
1130506.00 CAT 383.00 383.00 0.00
1130506.00 SPY 206.00 207.00 1.00
1130507.00 AAPL 509.00 516.00 7.00
1130507.00 CAT 383.00 376.00 7.00
1130507.00 SPY 206.00 208.00 2.00
1130508.00 AAPL 509.00 514.00 5.00
1130508.00 CAT 376.00 377.00 1.00
1130508.00 SPY 206.00 208.00 2.00
My conclusions are, the entry is ok, the first rebalanced is ok, but then it isn't right.
What could be the problem??
Thank you very much
This is my code:
Code: Select all
vars:
numberofstrat(0),
numsend(0),
numcontr(0);
numberofstrat = pmms_strategies_count;
numcontr = Floor((Portfolio_Equity / numberofstrat) / Close);
numsend = absvalue (currentcontracts - numcontr);
if (currentcontracts < numcontr) then begin
buy numsend shares next bar at market;
end
else if (currentcontracts > numcontr) then begin
sell numsend shares next bar at market;
end;
print(Date, " ",symbol, " ", currentcontracts, " ", numcontr, " ", numsend);
The output created by the print for the first four days is the following:
1130503.00 AAPL 0.00 518.00 518.00
1130503.00 CAT 0.00 383.00 383.00
1130503.00 SPY 0.00 206.00 206.00
1130506.00 AAPL 518.00 509.00 9.00
1130506.00 CAT 383.00 383.00 0.00
1130506.00 SPY 206.00 207.00 1.00
1130507.00 AAPL 509.00 516.00 7.00
1130507.00 CAT 383.00 376.00 7.00
1130507.00 SPY 206.00 208.00 2.00
1130508.00 AAPL 509.00 514.00 5.00
1130508.00 CAT 376.00 377.00 1.00
1130508.00 SPY 206.00 208.00 2.00
My conclusions are, the entry is ok, the first rebalanced is ok, but then it isn't right.
What could be the problem??
Thank you very much