Color Fill for Custom Indicator Overbought/Oversol
Author: johnwlab
Creation Date: 3/31/2009 7:27 PM
profile picture

johnwlab

#1
I am a new user working on developing custom indicators
using Wealthlab Pro V5.3. Currently having difficulty
coding different colored fill areas for Overbought and
Oversold areas in a manner similar to that displayed
by the Drag and Drop Indicators. Does anybody know
the best approach or have a coding example for creating
colored fill for Indicator Overbought/Oversold areas?

One reason for coding a custom CCI indicator pane is
with the Drag and Drop Indicators you can not create
separate Panes for the same Indicator with different
parameter values (e.g. CCI(14) and CCI(70)). A second
reason is if possible it would be nice to have different
shades of colors in the Indicator Overbought/Oversold areas.
(e.g. light red = -100 < CCI < -200; dark red CCI < -200)

To implement Overbought/Oversold colored fill areas I have
tried using the PlotSeriesFillBand and PlotSeriesDualFillband
commands with no success. The best I have been able to do
so far is change the color of the plotted Indicator Line
for the Overbought/Oversold levels (see Strategy Code below).
Would appreciate any suggestions or example code segments.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
QUOTE:
tried using the PlotSeriesFillBand and PlotSeriesDualFillband
commands with no success

You should be using PlotSeriesOscillator:
CODE:
Please log in to see this code.


CODE:
Please log in to see this code.

As a side note, beware of starting the trading loop at bar 10 when your CCI indicator has a period of 55 (and can take values up to 200). Currently it won't hurt but can do when you add trading rules.

QUOTE:
it would be nice to have different
shades of colors in the Indicator Overbought/Oversold areas.
(e.g. light red = -100 < CCI < -200; dark red CCI < -200)

This was possible even in WL4 but is too tedious.
profile picture

Cone

#3
Just in case it's not obvious, you can do the shades of colors by plotting more than once, making sure that you plot the lighter colors first -

CODE:
Please log in to see this code.
profile picture

Eugene

#4
Cute! Live and learn :)
profile picture

johnwlab

#5
Problem solved. PlotSeriesOscilltor command works like a
charm. Thanks for both reply posts with examples which were
very helpful. Nice to be able to develop Custom Indicators
and be able to control parameters via Strategy Parameters.
Thanks for help.