Accessing strategy returns

Posted By: VizTra

Accessing strategy returns - 12/22/21 11:04

Hello,

I'd like to know how to access strategy returns. I'm interested in using the volatility of the past strategy returns to scale positions accordingly, but am currently at a loss of how to get these returns as a series. I would think doing that via diff(Equity,1) might work but although the documentation says diff() is expecting 2 parameters I get an error telling me only to give one.

Kind regards
Posted By: AndrewAMD

Re: Accessing strategy returns - 12/22/21 12:20

Post your script.
Posted By: VizTra

Re: Accessing strategy returns - 12/22/21 13:21

Hey,

I realized that I misunderstood how the variable Equity and series() interact, now I know how to access past strategy return values:

Quote

vars eq = series(Equity, 30);
vars ret = series(ROC(eq,1), 30);


Using this code snippet one can access the past 30 days of equity values (eq[0], eq[1]...) and via that the past 30 days of returns (ret[0]..) for the whole strategy.
© 2024 lite-C Forums