- ago
Issue: Upon tweaking parameters on Strategy Settings tab if one clicks on 'Save these Parameters as Strategy's Defaults' creates code error for any Parameter that has atleast one comma in its label.
Priority: High
---------------------------------------


Test code:
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript74 { public class Test : UserStrategyBase {       public Test()       {          one = AddParameter("1, double", ParameterType.Double, 0.6, 0, 5, 0.1);          two = AddParameter("2,, double %", ParameterType.Double, 20.0, 5, 30, 0.5);          three = AddParameter("3,, int, SMA Period", ParameterType.Int32, 30, 10, 50, 5);          four = AddParameter("4_ double %", ParameterType.Double, 20, 5, 50, 5);          five = AddParameter("5; double/ # of ATRs", ParameterType.Double, 2.0, 1, 6, 0.5);          six = AddParameter("6 int !@#$%^&*", ParameterType.Int32, 4, 2, 22, 1);          seven = AddParameter("7-- double", ParameterType.Double, 2.5, 1, 5, 0.5);          eight = AddParameter("8* double", ParameterType.Double, -15, -99, 0, 5);          nine = AddParameter("9+ int", ParameterType.Int32, 400, 100, 1500, 100);          ten = AddParameter("(10) double", ParameterType.Double, 0.05, 0, 2, 0.01);       }       public override void Initialize(BarHistory bars) { } public override void Execute(BarHistory bars, int idx) { }       private Parameter one, two, three, four, five, six, seven, eight, nine, ten;    } }



It took me a while, and not a little bit of angst, to figure this one out. It appears only the use of comma in the label causes this situation, not any other non-alphabetic character.

To test, either using the code above or any that you may have that has a comma in *any* parameter's label, just change the value of one or more parameters and then click on Save these Parameters button at the bottom. All parameters will disappear. On switching to Code Editor one'll see squishy red lines against all - and ONLY those - parameters that have a comma in their label.

What's happening: When called to save new default value(s) for parameter(s), all parameters get rewritten. AddParameter takes 6 arguments, each separated by a comma. Unfortunately, the commas inside the string label are also getting counted (they shouldn't be)... if there's 1 comma in the label the default value gets placed 1 place to the left of its correct place overwriting that item (ParameterType), if there are 2 commas the value gets written 2 places to the left (which will be the string label), etc.


Hope this gets fixed quickly.
0
223
Solved
3 Replies

Reply

Bookmark

Sort
Glitch8
 ( 14.34% )
- ago
#1
Look, just please don't use commas in your labels. Hopefully that's not too much to ask here. The code manipulation can get tricky.

Additionally, there's no need to place your own preconceived priority on an issue you report. This is not a HIGH priority issue. In fact it's such a low priority and it has such a simple workaround we're not going to work on it at all.
1
Best Answer
- ago
#2
I'm sorry I wasn't born knowing commas needed to be excluded from labels, hope I'm smarter in my next reincarnation.
0
Glitch8
 ( 14.34% )
- ago
#3
I’m not saying you should have known that. It was a surprise to me too. But does this really deserve such an alarming “Priority: High” report? Let’s keep things in some kind of perspective.
1

Reply

Bookmark

Sort