I tried to implement a position sizing based on the actual drawdown of the entire dataset and the drawdown of the dataset of the previous days to calculate the SMA of the drawdown.
Is there any possibility to get access to these data in order to modify the percentage of equity of an individual buy at market order as LastPosition.tag in the strategy code?
Or is the only way to handle that to build an individual PosSizer?
Size:
Color:
QUOTE:
Or is the only way to handle that to build an individual PosSizer?
The way WL6 is programmed, scripts don't have access to the portfolio equity and other metrics. First the Strategy is executed on each symbol bar by bar, then the results are compiled into a Portfolio backtest. So the proper way to handle it is to build a PosSizer.
An alternative solution might be to obtain the portfolio equity via "shadow trading" and calculate the drawdown:
Interacting Dynamically with Portfolio Level Equity
Size:
Color: