Greetings,
I've hacked together a gap up/down EFS and it's working great on stocks. One problem though. I need the futures (YM, ES) to calculate on the same time 1600 close and 930am open. I've been sitting here for a few hours trying to figure out how to do that. I guess I don't have the expertise. Could someone edit this code so it will correctly calculate the futures gaps? Is that a tall order? Help appreicated. Feel free to DL and use the script all night long. Heres a screen shot and below the code will follow.
I've hacked together a gap up/down EFS and it's working great on stocks. One problem though. I need the futures (YM, ES) to calculate on the same time 1600 close and 930am open. I've been sitting here for a few hours trying to figure out how to do that. I guess I don't have the expertise. Could someone edit this code so it will correctly calculate the futures gaps? Is that a tall order? Help appreicated. Feel free to DL and use the script all night long. Heres a screen shot and below the code will follow.
PHP Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("Gap Zone");
setCursorLabelName("PD-O", 0); // Today Open
setCursorLabelName("TD-O", 1); // Prev Open
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.blue, 1);
setDefaultBarThickness(2, 0);
setDefaultBarThickness(4, 1);
setPlotType(PLOTTYPE_FLATLINES, 0);
setPlotType(PLOTTYPE_FLATLINES, 1);
}
var bInit = false;
var xOpen = null;
var xHigh = null;
var xLow = null;
var xClose = null;
function main() {
if(isMonthly() || isWeekly() || isDaily())
return;
if(bInit == false){
xOpen = open(inv("D"));
xClose = close(inv("D"));
bInit = true;
}
var vOpen = getSeries(xOpen);
var vClose = xClose.getValue(-1);
if(vOpen == null || vClose == null)
return;
gap=(vOpen-vClose);
gap=rnd(gap,2);
if (gap > 0) drawTextPixel(250, 20, "| GAP UP: +"+gap+" |", Color.RGB(255,255,255), Color.RGB(0,0,255), Text.ONTOP, "Arial", 20, "Gap");
if (gap < 0) drawTextPixel(250, 20, "| GAP DOWN: "+gap+" |", Color.RGB(255,255,255), Color.RGB(255,0,0), Text.ONTOP, "Arial", 20, "Gap");
drawTextAbsolute (-5, vOpen, "*Gap Boundary*", Color.black, Color.white, Text.ONTOP | Text.CENTER, "Courier", 8, "TodayOpen" );
drawTextAbsolute (-5, vClose, "*Gap Boundary*", Color.black, Color.white, Text.ONTOP | Text.CENTER, "Courier", 8, "PrevClse" );
return new Array (vOpen,vClose);
}
//==rnd will round to N digits (thanks TRO for rounding code)
function rnd(value, N) {
var n;
var mult=1;
for(n=0;n<N;n++) mult*=10;
value*=mult;
return Math.round( value,N)/mult;
}
Comment