How to include parameters for optimization?
Author: TedWoods
Creation Date: 11/3/2015 6:00 AM
profile picture

TedWoods

#1
Could you please give example on how to edit body of code to include parameters for optimization.

EDITED by Eugene: included example code from ticket 26776:

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

Eugene

#2
In the WealthScript Programming Guide (Help menu), there is a tutorial on making a strategy optimizable:

Programming Trading Strategies > Strategy Parameters

Please follow it and you'll quickly learn. We refer to it frequently on the forum (#1, #2, #3, #4 ...)

As to your sample code that I derived from a ticket, it's not clear what the strategyParameter1 should refer to i.e. what part of the system do you intend to optimize using it: StochK, SMA, anything else?
profile picture

TedWoods

#3
For Example - Optimize SMA - Please show code
profile picture

Eugene

#4
Please consider reading the tutorial to the end and you will find it out. It's very simple. Our support aims to teach you how to fish. See below how you can generate this code on your own:

Also as we recommend to do in the FAQ, using the Rule Wizard (Strategy from Rules) is the easiest way to get a basic trading system working w/o any programming. Learn how to expose parameters in rule-based strategies by creating an SMA system (see Wealth-Lab User Guide > Strategy Window > Strategy Builder > Parameter Sliders for the Strategy Builder) and then simply convert it into code-based Strategy (or "Open code in new "Strategy window") to see how things fit together.
profile picture

TedWoods

#5
OK - I looked at the docs you suggested. I am not a programmer so still have questions. Please see attached pdf file. I think my question is what should code line 23 look like ??

profile picture

Eugene

#6
Could you please post the code normally (ideally using the CODE but I can fix it) without resorting to attachments? Use Ctrl-Ins or Ctrl-C to copy, Shift-Ins or Ctrl-V to paste. Thanks.
profile picture

TedWoods

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

Eugene

#8
"mapram" is just a string; strategyParameter1 is the variable:

CODE:
Please log in to see this code.


Let me stress that converting a system to code is the easiest way to understand how strategy parameters work under the hood.
profile picture

TedWoods

#9
Thank you very much for your help as I am very new at this. - All OK now !!
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).