Developing an Indicator Library: plotting, glyph
Author: DrKoch
Creation Date: 1/16/2018 8:04 PM
profile picture

DrKoch

#1
I am working on a library of indicators and stumbled about some questions:

1. Is there a concept of "missing values" in a DataSeries (or the Bars Array)? May I use double.Nan to "express" a missing value: Should I expect and handle NaNs in a DataSeries?

2. When I change the color of an indicator in the source code after it was loaded in WL, WL seems to remember the color it saw the first time. Is there a way to makeW L forget this wrong color?

3. I added a glyph.bmp (16x16, Background Fuchsia == 0xFF0080) to my VS project as an embedded resource, but it does not show up in the Indicator-List. What may I try to make this work?
profile picture

Eugene

#2
QUOTE:
1. Is there a concept of "missing values" in a DataSeries (or the Bars Array)?

No, DataSeries contain the same number of values as plotted Bars (unless sync is turned off when you're accessing an external symbol's data).

QUOTE:
May I use double.Nan to "express" a missing value

No, unless you plan to have display issues like this: Mysterious invisible plots ;)

QUOTE:
Should I expect and handle NaNs in a DataSeries?

It's a good practice. You might also be interested in this: Plot DataSeries with gaps (Double.NaN)

QUOTE:
2. When I change the color of an indicator in the source code after it was loaded in WL, WL seems to remember the color it saw the first time. Is there a way to makeW L forget this wrong color?

Yes, by resetting the respective line in the WealthLabConfig.txt file. There's no user-friendly way.

QUOTE:
3. I added a glyph.bmp (16x16, Background Fuchsia == 0xFF0080) to my VS project as an embedded resource, but it does not show up in the Indicator-List. What may I try to make this work?

Try our open source code like TASCIndicators as an example, it works there: Download Project Source Code
profile picture

DrKoch

#3
QUOTE:
Try our open source code like TASCIndicators as an example, it works there

After some research I can say the following:

1. It is important to have a file glyph.bmp besides the regular source files with Build-Action "Embedded Resource". This must be present but the file is not used (!)

2. There must be a Bitmap Resource (inside Resource.resx) with an arbitrary name. This file is used.

If one of these two things is missing, no bitmap is shown in WL's Indicator tree.

I consider this behaviour a bug...
profile picture

Eugene

#4
I agree regarding the bug with one minor exception - it's most likely in your solution. ;)

I've removed the embedded resource 'TASC' from the TASCIndicators solution, rebuilt it and the familiar bitmap still embellishes the Indicators tree. So for me it's enough to have glyph.bmp which follows the API specs > "Providing a Custom Image for the Indicator Library":

CODE:
Please log in to see this code.