Hi,
Is it possible to draw a Horizontal Line between two user chosen points in time (eg:10:00am to 3:00pm)?
Thanks,
Paul
Is it possible to draw a Horizontal Line between two user chosen points in time (eg:10:00am to 3:00pm)?
Thanks,
Paul
//debugClear();
function preMain() {
var aFPArray = new Array();
setPriceStudy(true);
//setStudyTitle("");
var x = 0;
aFPArray[x] = new FunctionParameter("StartTime", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Start Time (930)");
setLowerLimit(0);
setUpperLimit(2400);
addOption(300);
addOption(930);
addOption(2000);
setDefault(930);
}
aFPArray[x] = new FunctionParameter("EndTime", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("End Time (1630)");
setLowerLimit(0);
setUpperLimit(2400);
addOption(1130);
addOption(1615);
addOption(300);
setDefault(1615);
}
aFPArray[x] = new FunctionParameter("nThickness", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Line Thickness");
setLowerLimit(1);
setDefault(3);
}
aFPArray[x] = new FunctionParameter("cColorH", FunctionParameter.COLOR);
with(aFPArray[x++]) {
setName("High Color");
setDefault(Color.blue);
}
aFPArray[x] = new FunctionParameter("DrawHowMany", FunctionParameter.STRING);
with(aFPArray[x++]) {
setName("Draw For:");
addOption("Last Day");
addOption("All Days");
setDefault(3);
}
}
var vStartBar = null;
var vEndBar = null;
var startStop=false;
function main(StartTime,EndTime, nThickness, cColorH, DrawHowMany) {
drawLineAtTimes(StartTime,EndTime, nThickness, cColorH, DrawHowMany);
}
function drawLineAtTimes(StartTime,EndTime, nThickness, cColorH, DrawHowMany){
var nDate = getYear()+""+(getMonth()+1)+getDay();
var barTime=((hour(0) * 100) + minute(0));
var numOfLines=1;
if(DrawHowMany=="All Days") numOfLines=nDate;
if(day(0)!=day(-1)){
startStop=false;
}
if (barTime>=StartTime && EndTime>=barTime && !startStop){
vStartBar=getCurrentBarCount();
startStop=true;
}
if (barTime>=StartTime && EndTime>=barTime) {//uncomment the drawLineRelative you want & comment out the drawLineRelative you don't want
vEndBar=getCurrentBarCount();
//drawLineRelative( vStartBar-getCurrentBarCount(), close(vStartBar-getCurrentBarCount()), vEndBar-getCurrentBarCount(), close(vEndBar-getCurrentBarCount()), PS_SOLID, nThickness,cColorH, "xLine1"+numOfLines);//draws line from close of start bar to close of end bar
drawLineRelative( vStartBar-getCurrentBarCount(), close(vStartBar-getCurrentBarCount()), vEndBar-getCurrentBarCount(), close(vStartBar-getCurrentBarCount()), PS_SOLID, nThickness,cColorH, "xLine2"+numOfLines);//draws line at close of start bar
}
return;
}
Comment