- ago
I have the following code in a strategy to buy SPY and UPRO with given percentages:

CODE:
t = PlaceTrade(SPY, TransactionType.Buy, OrderType.Market, 0, 1, "BUY SPY"); t1 = PlaceTrade(UPRO, TransactionType.Buy, OrderType.Market, 0, 1, "BUY UPRO"); var equity = Backtester.CurrentEquity; t.Quantity = (int)((equity * xPercentage) / SPY.Close[idx]); t1.Quantity = (int)((equity * (1 - xPercentage) / UPRO.Close[idx]));


This works fine when I run this as a standalone strategy. But when I run it in a MetaStrategy it uses all equity, instead of the portion that is allocated to the substrategy. This is expected since the code does not respect position sizer that's set. But how can I change the code so that it does what I want to do both in standalone run and in a MS?Thanks.
0
61
0 Replies

Reply

Bookmark

Sort
Currently there are no replies yet. Please check back later.