Different backtesting results
Author: bishop
Creation Date: 5/21/2012 9:37 AM
profile picture

bishop

#1
Hello,

When I click Compile and Run the Strategy for the first time (using 1 contract on ES, RP mode, Futures mode enabled) WL shows me a Net Profit of $16174. But when I press F5 again on the chart (nothing has been changed), the Net Profit is now $20844.
Why is it so? On what number should I look. What am i missing?

Thanks in advance.

CODE:
Please log in to see this code.



profile picture

Eugene

#2
Hi,

What you're missing is this FAQ item:

FAQ | Strategies and WealthScript > "Every time I run a Strategy I get a different result. What am I missing?"
profile picture

bishop

#3
Eugene, thanks.

But I run a strategy in Raw Profit mode on a single symbol, not in MSB mode. Do i still need to assign position priority?
profile picture

Eugene

#4
No, in this particular case the error is caused by defining variables as class-level:
CODE:
Please log in to see this code.

Move the variable declarations (except the StrategyParameters which are at the right place) inside the Execute() method body and the Strategy should start working as expected.

Consider not using class-level variables unless they are really required by your Strategy's logic. Usually it's not the case with 95% Strategies.
profile picture

bishop

#5
Eugene, thank you. Now all works as expected.
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).