Hi all,
I have been playing around with some of the code from the Super Indictator efs and at the same time trying to learn more about java script, but now I am stuck. I have gone over the code for the past hour and I have not made any progress. I am trying to make the put the CCI only into the Super indicator line, then later build other indicators in. Even if the indicator doesn't really work right with just the cci, what I am trying to understand is the concept for how to make it work. Right now when I try to run the code the window is just blank and the error window says the syntax is ok. Could someone take a look and tell me what I am missing? Thank you.
Chris
I have been playing around with some of the code from the Super Indictator efs and at the same time trying to learn more about java script, but now I am stuck. I have gone over the code for the past hour and I have not made any progress. I am trying to make the put the CCI only into the Super indicator line, then later build other indicators in. Even if the indicator doesn't really work right with just the cci, what I am trying to understand is the concept for how to make it work. Right now when I try to run the code the window is just blank and the error window says the syntax is ok. Could someone take a look and tell me what I am missing? Thank you.
Chris
PHP Code:
/*********************************************************
Team Effort © March 2004
Contributors Include:
Alexis C. Montenegro, Dan Ferry, Steve Hare,
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.
**********************************************************/
//There are no gaurantees!//
//This is an expirement using the sum of 3 studies plotted by a Moving Average
//with a few munipulations.// Please take LPL & HPH into consideration.
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Making the super indicator line that only contains the values from the CCI.
=====================================================================*/
var vCCI = null
var vcci0 = null;
var cci0 = null;
var vSum3 = null;
var aSum = null;
function preMain() {
setPriceStudy(false);
setStudyTitle("SuperDev");
setCursorLabelName("superfib", 0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarThickness(2, 0);
setPlotType(PLOTTYPE_LINE, 0);
addBand(70,PS_SOLID,1,Color.red);
addBand(30,PS_SOLID,1,Color.green);
//CCI
var fp1 = new FunctionParameter("CCILength",FunctionParameter.NUMBER);
fp1.setLowerLimit(1);fp1.setDefault(20);
var fp2 = new FunctionParameter("CCISource",FunctionParameter.STRING);
fp2.addOption("Close"); fp2.addOption("High"); fp2.addOption("Low");fp2.addOption("Open");
fp2.addOption("HL/2");fp2.addOption("HLC/3");fp2.setDefault("HLC/3");
}
function (CCILength,CCISource) {
if (MALength == null) MALength = 5;
if (vCCI == null) vCCI = new CCIStudy(CCILength,CCISource);
cci0=vCCI.getValue(MAStudy.MA)/3;
if(cci0 == null);
return;
vSum3 = (cci0);
if(vSum3==null)
return;
if(aSum == null) {
aSum = new Array(MALength);
}
if (getBarState() == BARSTATE_NEWBAR) {
aSum.pop();
aSum.unshift(vSum3);
} else {
aSum[0] = vSum3;
}
var nSum = 0;
for (i = 0; i < MALength; ++i) {
nSum += aSum[i];
}
var vSMA = nSum/MALength;
if(vSMA>70)
setBarFgColor(Color.red);
if(vSMA<10)
setBarFgColor(Color.lime);
return vSMA;
}
Comment