The Question
How do I make the DiNapoli DeTrended Oscillator into a Multi-Colored Line?
The Problem
I've been trying for the past few days to try to turn the a regular DiNapoli Detrended Oscillator into a multi-colored "instant color line." I'm following Introductory Tutorial 3 as my guide (specifically pages 21-23 on creating an instant color line) and duplicate those settings on the DiNapoli. However, my attempts always result in a single color line.
The Desired Result
Before I go any further, check out the attachment below to get an idea of what I'm trying to create.
The "actual" is what I have right now which is a line with only a single color. However, what I would like to have (i.e. photoshopped) is a DiNapoli Detrended oscillator line that changes colors when it goes above or below the zero-line.
The (partially working) Code
Here's the best alteration that I could come up with (my additions in red).
What the previous code shows
What results is the red part of the code but not the blue.
Anyone have a good solution?
How do I make the DiNapoli DeTrended Oscillator into a Multi-Colored Line?
The Problem
I've been trying for the past few days to try to turn the a regular DiNapoli Detrended Oscillator into a multi-colored "instant color line." I'm following Introductory Tutorial 3 as my guide (specifically pages 21-23 on creating an instant color line) and duplicate those settings on the DiNapoli. However, my attempts always result in a single color line.
The Desired Result
Before I go any further, check out the attachment below to get an idea of what I'm trying to create.
The "actual" is what I have right now which is a line with only a single color. However, what I would like to have (i.e. photoshopped) is a DiNapoli Detrended oscillator line that changes colors when it goes above or below the zero-line.
The (partially working) Code
Here's the best alteration that I could come up with (my additions in red).
Code:
function preMain() { setStudyTitle("DiNapoli Detrended Oscillator"); setCursorLabelName("Detrend Osc",0); setDefaultBarFgColor(Color.RGB(0x75,0x71,0x99), 0); addBand(0, PS_DASH, 1,(Color.RGB(0x22,0x22,0x22)), "a"); [COLOR="#B22222"] setDefaultBarFgColor (Color.grey); setPlotType(PLOTTYPE_INSTANTCOLORLINE,0);[/COLOR] } function main(nLength) { if (nLength == null) nLength = 7; [COLOR="#B22222"] if (nLength >= 50) setBarFgColor (Color.blue); if (nLength < 50) setBarFgColor (Color.red);[/COLOR] var vPrice = getValue("close",0,-nLength); if(vPrice == null) return; var Detrend = 0.0; var Sum = 0.0; var i = 0; //Average for (i = 0; i < nLength; i++) Sum += vPrice[i]; Detrend = vPrice[0] - Sum / nLength; return Detrend; }
What results is the red part of the code but not the blue.
Anyone have a good solution?
Comment