- ago
Hi,

I am aware that WL7 has most of the indicators a user would need and that the software is intended as using those indicators as opposed to building another custom one.

I looked through a lot of the indicators for what I would like to do and didn't find anything I liked or suited my need. So then I decided to build a custom indicator and progress has been very slow. Essentially because I cannot find indicator script examples.

I saw that in earlier WL versions developers were able to download the community source code which included a lot of the examples for indicators.

Having the examples accessible would really be helpful and I was wondering what the options are for obtaining them?

Thanks for your help and looking forward to be working with WealthLab.
0
1,147
Solved
11 Replies

Reply

Bookmark

Sort
- ago
#1
Hi,

Tools menu > New Custom Indicator (Ctrl-Shift-I) gives you the sample code for three distinct indicator types: SMI, RSI and ATR.

The complete code for SMA can be obtained here: https://www.wealth-lab.com/Support/ExtensionApi/IndicatorLibrary
0
Best Answer
- ago
#2
And from the Github repo below you can get the source code of HiLoLimit and SwingHiLo indicators
https://github.com/Mkey85/WeathLab.Community/tree/main/Indicators

Warning: the SwingHiLo group of indicators can peek into the future.
0
- ago
#3
Thanks Eugene. Those are helpful as references.

I have been looking for examples on how to make a bandplot instead of a default line plot. I can't figure out how to set this plotstyle as a default in the indicator script and how to add a second and third timeseries for upper and lower bounds that will be plotted on the indicator plot.

Any examples are appreciated.
0
- ago
#4
QUOTE:
how to make a bandplot

I don't think there's a public example of a band indicator. But you can start by defining three independent line indicators; the upper band, the lower band, and then the center band. Once you get those running, you declare them as BandCompanion indicators so they associate together.

I looked into doing this at one point, but never completed the task. But the only thing special is the part where you declare them as BandCompanion indicators. Other than that, nothing is special from some other line indicator. Happy computing.
1
- ago
#5
Three independent indicators sounds straightforward.

But then, I am not 100% sure what to do next. Create a new indicator and choose a band plot?
And then, how and where do I declare the indicators as band companions? In the populate function?
Do I need to call the band companions somewhere so they appear on the plot?

Any example would be greatly appreciated.
0
Glitch8
 ( 10.65% )
- ago
#6
Declare it in the Companions property, here is an example of the BBLower declaring BBUpper as its companion,

CODE:
//return companion indicators public override List<string> Companions { get { List<string> c = new List<string>(); c.Add("BBUpper"); return c; } }
0
- ago
#7
The PlotStyles.Bands attribute fails to shade the space between the bands in the coded strategy below. I'm running WL7 Build 53.
CODE:
      public override void Initialize(BarHistory bars) {          PlotIndicator(new BBUpper(bars.Close,20,2.00), Color.FromArgb(255,80,119,189), PlotStyles.Bands);          PlotIndicator(new BBLower(bars.Close,20,2.00), Color.FromArgb(255,80,119,189), PlotStyles.Bands);       }
What's weird is if I drag and drop this same indicator into a Chart, it does shade between the bands. Is there a tricky way to get the coded version to shade between the bands?
0
- ago
#8
I have added the code before the populate function, compiled the script, and the BBUpper does not show up on the chart, neither for a line plot nor for a bandplot.

Any idea what I am doing wrong here? Seems like I am missing something about the understanding of how companion plots are plotted. I am trying to do this on the "Create new indicator" interface



0
- ago
#9
So the code you posted above is for the BBLower indicator. You missed defining the BandCompanionAbbreviation property.
CODE:
      public override string BandCompanionAbbreviation       {          get          {             return "BBUpper";          }       }
And, of course, you need to define the companion code for BBUpper indicator, which calls out the BBLower indicator.

I've only done indicator design with Visual Studio. The WL approach you're using should be easier, but I'm unfamiliar with those steps.
0
- ago
#10
Thanks for all your help everyone. Very much appreciated.

I was thinking that both of the indicators should show up in the chart tab of the "Create new indicator window". But they didn't. This really threw me off and made me think that something was wrong with my code while it wasn't.



I only realized that everything was fine once I drag and dropped my indicator on a live chart and the indicator+companion showed up.

This thread also helped me to understand where and how the companion and abbreviation should be defined (not in the same script), which was not obvious to me at all at the beginning. An example would have been super helpful.
https://www.wealth-lab.com/Discussion/Companions-BandCompanion-6084

Anyhow, I really like Wealth Lab for exploratory analysis. Dragging and dropping indicators is fast, and helps to quickly look at different approaches. There are a ton of indicators which is really great. Strategy testing is great too with lots of insights. Scripts for strategies included in the documentation are really helpful. However, scripts for indicators are missing which has made the experience really aweful. It shouldn't take a couple of hours to plot two lines on a chart... Maybe if full indicator scripts shall not be disclosed then it would be really helpful have examples of the basics, e.g. how to make two indicator lines on one pane.

Thanks again for all your help!
1
Cone8
 ( 6.24% )
- ago
#11
Thanks for the comments!

QUOTE:
e.g. how to make two indicator lines on one pane.
This is really simple with code or when dragging or dropping. In code, you only need to pass the same string for the Pane parameter in a PlotIndicator* or PlotTimeSeries* statement. For drag and drop, just select the Pane target in the drop dialog.

0

Reply

Bookmark

Sort