Execute once per Backtest
Author: QuinnHarris
Creation Date: 3/15/2010 6:27 PM
profile picture

QuinnHarris

#1
I am working on a strategy that scores a set of issues for every bar (or couple bars) then buys or sells accordingly to hold the top ranked issues. I need a way to execute some code once per Backtest run, then use the results each time Execute is called in the WealthScript. I can't use a static class variable as this will persist until the code is recompiled and an instance variable will cause the code to needlessly execute for each symbol.

The following is the code I have so far (it currently unnecessarily executes the common code in IndicesSet every time Execute is called). Is there a better way to do this?

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Hope this helps:

Wealth-Lab Wiki > Knowledge Base > WealthScript Techniques | Executing some code only once
profile picture

Eugene

#3
QUOTE:
(it currently unnecessarily executes the common code in IndicesSet every time Execute is called)

Note: Clicking "Go" or hitting F5 runs a Strategy without recompiling. "Execute" recompiles before running.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).