CustomSettings is empty in custom Optimizer
Author: Panache
Creation Date: 12/17/2016 6:47 PM
profile picture

Panache

#1
Something is wrong with the ICustom Settings in my custom Optimizer that I derived from the open source Average Volume Limitation PosSizer in the WIKI. The relevant code in my Optimizer is:

CODE:
Please log in to see this code.


When I click on Settings in my Optimizer, the Optimizer Settings dialog box is empty, instead of being populated with my Options User Control. Also, nothing is being written to WealthLabConfig.txt. Obviously, I'm doing something wrong, but I can't find the problem.
profile picture

LenMoz

#2
I don't think you're executing your initialization code because you've instantiated _settings at its declaration so it isn't null in GetSettingsUI. Declare it simply as "private Options _settings;", then add the indicated line in GetSettingsUI.


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

Panache

#3
Thanks, but that is now giving me an unhandled null reference exception at

CODE:
Please log in to see this code.

this.numberOfSteps is null.

I need to get away from this for awhile, but thank you for holding my hand for the last two days.
profile picture

Panache

#4
I decided to go back to basics and use a simple optimizer and add the ICustomSettings implementation from Community.Commissions to make sure I hadn't screwed something else up. That is now giving me a new error message 'Abacus_User_Interface.UserControls.numberOfSteps' is inaccessible due to its protection level.

Here's the full code:

Edited by Eugene: fixed overquoting of MS123 LLC intellectual property

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

LenMoz

#5
The line...
CODE:
Please log in to see this code.
seems to be trying to directly set a variable.

PSO is rather calling a Setter. So, an equivalent line from PSO
CODE:
Please log in to see this code.
is calling the following code...
CODE:
Please log in to see this code.
Look at me, teaching Windows Forms!
profile picture

Panache

#6
Thanks again. The problem was even more basic than that. In my Options form, the variables are private by default. Changing them to public eliminated the problem.
profile picture

abegy

#7
Hi Panache,

I have detected an unhandled exception.

To produce it, starts WLD and open a strategy and go to the optimizer. Select one optimizer and go to another one (without running it). Do it several time by selecting different optimizers. When you select ABACUS by this way, you have the unhandled exception :

System.ArgumentOutOfRangeException: InvalidArgument=Value '34' is not valid in 'SelectedIndex'.
Parameter name : SelectedIndex

This unhandled exception doesn't appear if you do the same action without selected ABACUS.
I hope you will be able to reproduce it.

I take this opportunity to tell you that I very like your optimizer ! It helps me a lot.
profile picture

abegy

#8
Panache,

For your information, I see that the value (34) for the unhandled exception is the same value in the WealthLabConfig.txt file (line Abacus.Optimizer.Metric=34). I think you don't take into account the line Optimization.Scorecard=Basic Scorecard in the WealthLabConfig.txt which gives you the scorecard selected.

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).