I want to return the day of the week for each bar in a day interval chart. Using Day() I only get today's day which is 2 for Tuesday. How can I find every friday in the chart?
Thanks.
Thanks.
// Moving Average example with added slope function - S. Hare 8 17 2006
function preMain() {
setPriceStudy(false);
setStudyTitle("eMA Slope");
setCursorLabelName("eMA",0);
setDefaultBarFgColor(Color.blue,0);
setDefaultBarThickness(2,0);
}
var mySlope = null, eMA5 = null, bInit = false; // these are global variables, they can be seen in every part of the efs
function main() {
if(bInit == false){
eMA5 = ema(5); //defining a series
bInit = true;
}
mySlope = CheckSlope(eMA5); // sending the CheckSlope function a series
return mySlope;
}
function CheckSlope(tmpX){// CheckSlope function S. Hare 8 17 2006
var tmp = tmpX.getValue(-3);
if (tmp == null || tmp == 0){
debugPrintln ("26: eMA5.getValue(0) = "+ tmpX.getValue(0)+ ", eMA5.getValue(-3) = "+ tmpX.getValue(-3));
return null;
}
var time = rawtime(-3)-rawtime(0);
if (time ==null || time == 0){ // if the check for zero is not made, there is a potential for over-run when dividing by this number
return null;
}
var slope = (tmp - tmpX.getValue(0))/time; // time base seconds, therefore the slope is price change per second
return slope;
}
function preMain() {
setPriceStudy(true);
setStudyTitle("eMA Example");
setCursorLabelName("eMA5.getValue(0)",0);
setDefaultBarFgColor(Color.blue,0);
setDefaultBarThickness(1,0);
setCursorLabelName("eMA5.getValue(-3)",1);
setDefaultBarFgColor(Color.red,1);
setDefaultBarThickness(1,1);
}
var eMA5 = null, bInit = false; // these are global variables, they can be seen in every part of the efs
function main() {
if(bInit == false){
debugClear();
eMA5 = ema(5); //defining a series
bInit = true;
}
debugPrintln ("18: eMA5.getValue(0) = "+ eMA5.getValue(0)+ ", eMA5.getValue(-3) = "+ eMA5.getValue(-3));
return new Array(eMA5.getValue(0),eMA5.getValue(-3));
}
Comment