Executing a strategy using code
Author: electricessence
Creation Date: 3/9/2009 10:46 AM
profile picture

electricessence

#1
I've been trying to cause Wealth Lab to repeatedly run a script over and over. I'm feeding it different parameters every time and measuring the results.

Normally, I would just put a paper weight on my enter key, and that does the trick. But it would be great if I could just get it to run on it's own.

First steps: I have a windows form that I'm using to trigger running the script via TradingSystemExecutor in a separate thread. And it kinda seems to work. But the numbers are all wrong. It's using the wrong positions size (versus what is in the data pane) and there seems to be other weirdness that I'm not aware of.

Can anyone please tell me what the prescribed way of doing this is? Or am I just really close and missing a few things? I did notice that there are some settings / methods on TradingSystemExecutor that could be used before executing. I'm gonna try that next.
profile picture

electricessence

#2
The topic title was supposted to say "(instead of the 'go' button). (please help!)"
profile picture

Cone

#3
QUOTE:
I've been trying to cause Wealth Lab to repeatedly run a script over and over. I'm feeding it different parameters every time and measuring the results.
Wait for the 5.4 Optimizer.
profile picture

Eugene

#4
QUOTE:
Can anyone please tell me what the prescribed way of doing this is?

There is no prescribed way of doing this, because it is completely undocumented, so it's unsupported.

QUOTE:
It's using the wrong positions size

This is a slightly incorrect way of saying. It's using the right position size, but it's different from what's there in the data pane because you haven't properly initialized a TradingSystemExecutor instance. There's many dirty work to do before you can match the Position Sizing dialog. Luckily, it's been already done:

1. Download the Community.Components extension that contains all required helper functions to correctly initialize TradingSystemExecutor.

2. Explore its source code: WL5 Wiki.

a)What you're looking for is here -
public SystemPerformance runDonor(WealthScript obj, WealthScript yourStrategy)
b) Notice there's an overload method for executing a Strategy in Multi-Symbol Mode, and there's another one for Single-Symbol Backtest.

3. Read this KB article - WealthScript Techniques | Interacting Dynamically with Portfolio Level Equity - to know what sort of problem you will face next because of the internal tick adjustment Wealth-Lab applies to stop/limit orders.
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).