Hello could u please look and see what i'm missing in this code.
I'm trying to get the price bars go green when +DM crosses up thru -DM and red price bars when the opposite occours.
Your help would be much apprieciated.
/************************************************** *******
Alexis C. Montenegro © July 2003
Use and/or modify this code freely. If you redistribute it
please include this and/or any other comment blocks and a
description of any changes you make.
************************************************** ********/
var vADX = null
function preMain() {
setPriceStudy(false);
setStudyTitle("ADXDM");
setCursorLabelName("ADX", 0);
setCursorLabelName("+DI", 1);
setCursorLabelName("-DI", 2);
setDefaultBarFgColor(Color.RGB(255, 0, 255), 0); //adx color
setDefaultBarFgColor(Color.green, 1); //+DI color
setDefaultBarFgColor(Color.red, 2); //-DI color
setDefaultBarThickness(1,0); //ADX Line thickness
setDefaultBarThickness(1,1); //+DI Line thickness
setDefaultBarThickness(1,2); //-DI Line thickness
setColorPriceBars(true);
setDefaultPriceBarColor(Color.grey);
var fp1 = new FunctionParameter("DILength", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(14); //Edit this value to set a new default
var fp2 = new FunctionParameter("ADXLength", FunctionParameter.NUMBER);
fp2.setLowerLimit(1);
fp2.setDefault(14); //Edit this value to set a new default
}
function main(DILength, ADXLength) {
if (vADX == null) vADX = new ADXDMStudy(DILength, ADXLength);
/************************************************** ****************
Insert your code following this text block
Use vADX.getValue(ADXDMStudy.ADX) and vADX.getValue(ADXDMStudy.PDI)
and vADX.getValue(ADXDMStudy.NDI) for your code
************************************************** *****************/
if(vADX.getValue(ADXDMStudy.PDI)<vADX.getValue(ADX DMStudy.NDI));
setPriceBarColor(Color.red);
if(vADX.getValue(ADXDMStudy.PDI)>vADX.getValue(ADX DMStudy.NDI));
setPriceBarColor(Color.white);
else if(1==1)
setPriceBarColor(Color.yellow);
return new Array(vADX.getValue(ADXDMStudy.ADX), vADX.getValue(ADXDMStudy.PDI), vADX.getValue(ADXDMStudy.NDI));
}
I'm trying to get the price bars go green when +DM crosses up thru -DM and red price bars when the opposite occours.
Your help would be much apprieciated.
/************************************************** *******
Alexis C. Montenegro © July 2003
Use and/or modify this code freely. If you redistribute it
please include this and/or any other comment blocks and a
description of any changes you make.
************************************************** ********/
var vADX = null
function preMain() {
setPriceStudy(false);
setStudyTitle("ADXDM");
setCursorLabelName("ADX", 0);
setCursorLabelName("+DI", 1);
setCursorLabelName("-DI", 2);
setDefaultBarFgColor(Color.RGB(255, 0, 255), 0); //adx color
setDefaultBarFgColor(Color.green, 1); //+DI color
setDefaultBarFgColor(Color.red, 2); //-DI color
setDefaultBarThickness(1,0); //ADX Line thickness
setDefaultBarThickness(1,1); //+DI Line thickness
setDefaultBarThickness(1,2); //-DI Line thickness
setColorPriceBars(true);
setDefaultPriceBarColor(Color.grey);
var fp1 = new FunctionParameter("DILength", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(14); //Edit this value to set a new default
var fp2 = new FunctionParameter("ADXLength", FunctionParameter.NUMBER);
fp2.setLowerLimit(1);
fp2.setDefault(14); //Edit this value to set a new default
}
function main(DILength, ADXLength) {
if (vADX == null) vADX = new ADXDMStudy(DILength, ADXLength);
/************************************************** ****************
Insert your code following this text block
Use vADX.getValue(ADXDMStudy.ADX) and vADX.getValue(ADXDMStudy.PDI)
and vADX.getValue(ADXDMStudy.NDI) for your code
************************************************** *****************/
if(vADX.getValue(ADXDMStudy.PDI)<vADX.getValue(ADX DMStudy.NDI));
setPriceBarColor(Color.red);
if(vADX.getValue(ADXDMStudy.PDI)>vADX.getValue(ADX DMStudy.NDI));
setPriceBarColor(Color.white);
else if(1==1)
setPriceBarColor(Color.yellow);
return new Array(vADX.getValue(ADXDMStudy.ADX), vADX.getValue(ADXDMStudy.PDI), vADX.getValue(ADXDMStudy.NDI));
}
Comment