backtestStrategy: rebalance function keeps track of past & current open position
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi All,
backtestStrategy provides a great workflow for defining a strategy, which includes the rebalancing function.
As part of the EngineData object, WeightsHistory can be used to derive open positions, entry price and open pnl. Nonetheless ... the same computation takes place also within the backtestEngine's runBacktest function, which provides access to a Positions table for each strategy.
Hoping not having to re-invent the wheel, is there a way to pass the Positions table into the rebalancing function, for a given strategy? This would be a good fit for an additional field into the engineData structure. Thx
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Akshat Dalal
am 10 Apr. 2024
Hi Andy,
I believe you could use the 'UserData' field in the rebalance function to pass the Position's Table as an input argument. When you're dealing with portfolio objects or any custom backtesting framework in MATLAB that supports the 'UserData' field, you can leverage this property to include additional information that the standard properties do not cover, such as a Position's Table or any other strategy-specific data you wish to carry through the rebalancing process.
To learn more about 'backtestStrategy' and the 'rebalance' function, you can refer the following documentation: https://www.mathworks.com/help/finance/backtest-investment-strategies.html
For an example of using 'UserData', see: https://www.mathworks.com/help/finance/backteststrategy.html#backteststrategy_example2
Hope this helps!
1 Kommentar
Siehe auch
Kategorien
Mehr zu Portfolio Optimization and Asset Allocation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!