Hi,
I am writing a new efs script. In this script I am trying to use isIntraday() to check if the chart is an intraday chart. I have a 260 bar time template. For some reason the isIntraday() is returning D even if my chart is showing 30 min chart. I tried to check this by printing getInterval() and it also shows D instead of 30. I am baffled. I have looked in the forums and have not seen anything like this. The code is below. Any help would be greatly appreciated.
Regards,
Jane
var aFPArray = new Array();
function preMain() {
var dateObject = new Date();
var defaultDate = dateObject.getFullYear()*10000+(dateObject.getMont h()+1)*100+dateObject.getDate();
var x;
setPriceStudy(true);
setStudyTitle("CycleAdder");
setShowTitleParameters( false );
setShowCursorLabel(false); // supresses this study's label in cursor window
setComputeOnClose(); // forces this study to only update on each new bar
//initialize formula parameters
x=0;
aFPArray[x] = new FunctionParameter("lowDate", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Low Date");
setDefault(defaultDate);
}
aFPArray[x] = new FunctionParameter("lowTime", FunctionParameter.STRING);
with(aFPArray[x++]) {
setName("Low Time");
setDefault("1600");
}
aFPArray[x] = new FunctionParameter("period1", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Period 1");
setLowerLimit(1);
setDefault(38);
}
aFPArray[x] = new FunctionParameter("period2", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Period 2");
setLowerLimit(1);
setDefault(19);
}
aFPArray[x] = new FunctionParameter("skew2", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Skew 2");
setDefault(0);
}
aFPArray[x] = new FunctionParameter("amp1", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Amplitude 1");
setLowerLimit(1);
setDefault(10);
}
aFPArray[x] = new FunctionParameter("amp2", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Amplitude 2");
setLowerLimit(1);
setDefault(5);
}
aFPArray[x] = new FunctionParameter("show2", FunctionParameter.BOOLEAN);
with(aFPArray[x++]) {
setName( "Show 2");
addOption(true);
addOption(false);
setDefault(true);
}
aFPArray[x] = new FunctionParameter("showSum", FunctionParameter.BOOLEAN);
with(aFPArray[x++]) {
setName("Show Sum");
addOption(true);
addOption(false);
setDefault(true);
}
aFPArray[x] = new FunctionParameter("barLength", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Bar Length");
setLowerLimit(1);
setDefault(260);
}
aFPArray[x] = new FunctionParameter("degrees", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Degrees");
setLowerLimit(-360);
setUpperLimit(360);
setDefault(270);
}
askForInput("CycleAdder"); // force the script parameter menu to be displayed when the script
// is first loaded.
}
function main(lowDate, lowTime, period1, period2, skew2, amp1, amp2, show2, showSum, barLength, degrees) {
var angFreq1 = 0;
var angFreq2 = 0;
var lowBar = 50;
var backPlot = 0;
var phase1 = 0;
var phase2 = 0;
var numbBar = 253;
var barsToLow = 0;
var totalBars = 0;
var barsFromEnd = 0;
var loopCount = 0;
var textStr1 = 0;
var highMax = 0;
var lowMax = 99999;
if(getCurrentBarIndex() == 0) {
if(period1 != 0) angFreq1 = 360/period1;
if(period2 != 0) angFreq2 = 360/period2;
} else {
return;
}
debugPrintln(lowDate, "1 ");
debugPrintln(getInterval(), "2 ");
debugPrintln(isIntraday(), "3 ");
return 0;
}
I am writing a new efs script. In this script I am trying to use isIntraday() to check if the chart is an intraday chart. I have a 260 bar time template. For some reason the isIntraday() is returning D even if my chart is showing 30 min chart. I tried to check this by printing getInterval() and it also shows D instead of 30. I am baffled. I have looked in the forums and have not seen anything like this. The code is below. Any help would be greatly appreciated.
Regards,
Jane
var aFPArray = new Array();
function preMain() {
var dateObject = new Date();
var defaultDate = dateObject.getFullYear()*10000+(dateObject.getMont h()+1)*100+dateObject.getDate();
var x;
setPriceStudy(true);
setStudyTitle("CycleAdder");
setShowTitleParameters( false );
setShowCursorLabel(false); // supresses this study's label in cursor window
setComputeOnClose(); // forces this study to only update on each new bar
//initialize formula parameters
x=0;
aFPArray[x] = new FunctionParameter("lowDate", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Low Date");
setDefault(defaultDate);
}
aFPArray[x] = new FunctionParameter("lowTime", FunctionParameter.STRING);
with(aFPArray[x++]) {
setName("Low Time");
setDefault("1600");
}
aFPArray[x] = new FunctionParameter("period1", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Period 1");
setLowerLimit(1);
setDefault(38);
}
aFPArray[x] = new FunctionParameter("period2", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Period 2");
setLowerLimit(1);
setDefault(19);
}
aFPArray[x] = new FunctionParameter("skew2", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Skew 2");
setDefault(0);
}
aFPArray[x] = new FunctionParameter("amp1", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Amplitude 1");
setLowerLimit(1);
setDefault(10);
}
aFPArray[x] = new FunctionParameter("amp2", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Amplitude 2");
setLowerLimit(1);
setDefault(5);
}
aFPArray[x] = new FunctionParameter("show2", FunctionParameter.BOOLEAN);
with(aFPArray[x++]) {
setName( "Show 2");
addOption(true);
addOption(false);
setDefault(true);
}
aFPArray[x] = new FunctionParameter("showSum", FunctionParameter.BOOLEAN);
with(aFPArray[x++]) {
setName("Show Sum");
addOption(true);
addOption(false);
setDefault(true);
}
aFPArray[x] = new FunctionParameter("barLength", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Bar Length");
setLowerLimit(1);
setDefault(260);
}
aFPArray[x] = new FunctionParameter("degrees", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Degrees");
setLowerLimit(-360);
setUpperLimit(360);
setDefault(270);
}
askForInput("CycleAdder"); // force the script parameter menu to be displayed when the script
// is first loaded.
}
function main(lowDate, lowTime, period1, period2, skew2, amp1, amp2, show2, showSum, barLength, degrees) {
var angFreq1 = 0;
var angFreq2 = 0;
var lowBar = 50;
var backPlot = 0;
var phase1 = 0;
var phase2 = 0;
var numbBar = 253;
var barsToLow = 0;
var totalBars = 0;
var barsFromEnd = 0;
var loopCount = 0;
var textStr1 = 0;
var highMax = 0;
var lowMax = 99999;
if(getCurrentBarIndex() == 0) {
if(period1 != 0) angFreq1 = 360/period1;
if(period2 != 0) angFreq2 = 360/period2;
} else {
return;
}
debugPrintln(lowDate, "1 ");
debugPrintln(getInterval(), "2 ");
debugPrintln(isIntraday(), "3 ");
return 0;
}
Comment