- ago
Hello,
A few questions about custom c# codded indicators

Is it possible to draw (or define) in c# :
- lines, dash lines, dot lines etc
- vertical background zones : between two datetimes/bar indexes
- horizontal background zones : between two values

Like in the joined screenshot

Best regards
0
239
7 Replies

Reply

Bookmark

Sort
- ago
#1
QUOTE:
Is it possible to draw (or define) in c# :
- lines, dash lines, dot lines etc

Of course. Here's list of supported plot styles at the moment:

Line
Histogram
Dots
ThickLine
ThickHistogram
DottedLine
DashedLine
BooleanDots - Render dots above or below the chart bars for any Indicator value greater than zero
Bands
ZigZag
Blocks
GradientBlocks
BarHistory
BarChart
HistogramTwoColor

https://www.wealth-lab.com/Support/ExtensionApi/IndicatorLibrary
https://www.wealth-lab.com/Support/ExtensionApi/PlotStyle
0
- ago
#2
QUOTE:
- horizontal background zones : between two values

There are several ways to approach it in WealthScript. For example, using PlotTimeSeriesOscillator, DrawPolygon etc. Here's one using DrawHorzLine. The trick here is to specify some hefty value for the thickness of the horizontal line:
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; using System.Collections.Generic; namespace WealthScript8 {    public class DrawHorzLineExample : UserStrategyBase    {       IndicatorBase _rsi;       public override void Initialize(BarHistory bars)       {          _rsi = RSI.Series(bars.Close, 7);          PlotIndicatorLine(_rsi);          //put lines at 30, 50 and 70 of RSI          DrawHorzLine(30, WLColor.FromArgb(30,WLColor.DarkRed), 30, LineStyle.Solid, _rsi.PaneTag, true);          DrawHorzLine(50, WLColor.FromArgb(30,WLColor.BlueViolet), 30, LineStyle.Solid, _rsi.PaneTag, true);          DrawHorzLine(70, WLColor.FromArgb(30,WLColor.DarkGreen), 30, LineStyle.Solid, _rsi.PaneTag, true);       }       public override void Execute(BarHistory bars, int idx)       {                }    } }
0
- ago
#3
QUOTE:
- vertical background zones : between two datetimes/bar indexes

What you're asking for is visual eye candy while an indicator's purpose is to return a value. Answer: it's possible in WealthScript. See SetBackgroundColor, SetBackgroundColorAllPanes.
0
- ago
#4
Sometimes it is part of an indicator's output to color the background of a Chart.

Of course this is possible in a C# coded strategy (using SetbackgroundColorAllPanes)

But say I want to provide an indicator that creates red/green background stripes in the price chart for my non-coder friends, i.e. the indicator is doing that drawing when dragged on a chart.

How can this be done?
0
- ago
#5
Example:
0
Cone8
 ( 2.85% )
- ago
#6
An Indicator can't do everything. The best you can do for an indicator is apply the Multi-Color Hack! for the series bar colors.

Other platforms do things like background colors with "Studies". You can make your own WealthLab study "extension", call it from a Strategy by passing it an instance of the Strategy class and draw what ever you like.
1
- ago
#7
I had hoped that a PlotStyle could modify the backround.

Is that possible -or- could this be a #FeatureRequest?
0

Reply

Bookmark

Sort