- ago
The sample code for UpDown indicator causes the following compile error:

QUOTE:
Compiled at 5/16/2022 05:17:44
6: The using directive for 'WealthLab.Indicators' appeared previously in this namespace
25: 'UpDown' is an ambiguous reference between 'WealthLab.Core.UpDown' and 'WealthLab.Indicators.UpDown'
15: 'UpDown' is an ambiguous reference between 'WealthLab.Core.UpDown' and 'WealthLab.Indicators.UpDown'
0
529
Solved
6 Replies

Reply

Bookmark

Sort
- ago
#1
This is due to conflicting UpDown classes in WealthLab.Core and WealthLab.Indicators namespaces. To resolve the ambiguity, a fix to the C# strategy code is pretty simple:

CODE:
//PlotIndicator(new UpDown(bars.Close,1,0.00), WLColor.FromArgb(255,106,90,205), PlotStyle.ThickHistogram); PlotIndicator(new WealthLab.Indicators.UpDown(bars.Close,1,0.00), WLColor.FromArgb(255,106,90,205), PlotStyle.ThickHistogram);
0
- ago
#2
Okay. I'll do that in my code. Thanks.

Is the code sample going to be fixed in a future release?
0
- ago
#3
The sample code generator isn't broken (its behavior is unified and correct) but conversely, renaming either of the UpDown classes may create breaking changes in users' code and/or extensions. IMHO leaving it as is would be the lesser evil.
0
- ago
#4
Right, renaming 'WealthLab.Core.UpDown' to 'WealthLab.Core.UpDownInternal' might fix it but you don't know what it could break.

WL8 hasn't been out that long. The longer you leave it that way the more likely you'll break some other code if you have to fix it in the future. Now's a good time. It's always nice to avoid these conflicts to prevent confusion especially when it breaks the sample code.

***

If you drop this indicator on a chart and then use the pop-up menu option 'Push Dropped Indicators to New C# Coded Strategy Window' the generated code also has a compile error. I think if you leave it as is it's bound to create confusion down the road.
0
Glitch8
 ( 9.00% )
- ago
#5
I think we can safely rename the UpDown enumerated type. I’m pretty sure it’s only used internally so far.
0
Best Answer
- ago
#6
Thanks.
0

Reply

Bookmark

Sort