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.