/********************************************************* Alexis C. Montenegro © April 2004 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. **********************************************************/ function preMain() { setPriceStudy(true); setStudyTitle("HiLo_firstXminutes"); setCursorLabelName("High", 0); setCursorLabelName("Low", 1); setPlotType(PLOTTYPE_FLATLINES,0); setPlotType(PLOTTYPE_FLATLINES,1); setDefaultBarFgColor(Color.blue,0); setDefaultBarFgColor(Color.red,1); checkVersion(2,"http://share.esignal.com/ContentRoot/ACM%20Test/Formulas/HiLo_firstXminutes.efs"); var fp1 = new FunctionParameter("Start", FunctionParameter.NUMBER); fp1.setDefault(930); var fp2 = new FunctionParameter("End", FunctionParameter.NUMBER); fp2.setDefault(1030); var fp3 = new FunctionParameter("Display", FunctionParameter.STRING); fp3.setName("Show Initial Period"); fp3.addOption("Show"); fp3.addOption("Hide"); fp3.setDefault("Show"); } var vFlag = true; var vFlag2 = true var vHigh = null; var vLow = null; var vClose = null; var vDay1 = null; var vDay2 = null; function main(Start,End,Display) { if (getBarState() == BARSTATE_NEWBAR) { if (vDay1 == null) { vDay2 = getDay(0); } else { vDay2 = vDay1; } vDay1 = getDay(0); if (vDay1 != vDay2) { vHigh = null; vLow = null; vFlag = true; vFlag2 = false; } var vHour1 = (getHour()*100)+getMinute(); if(vHour1 >= Start){ vFlag2=true; } var vHour = (getHour()*100)+getMinute(); if (vHour >= End) { vFlag = false; vFlag2=false } } if (vFlag == true&&vFlag2==true) { if (vHigh == null) { vHigh = high(0); } if (vLow == null) { vLow = low(0); } vHigh = Math.max(high(0), vHigh); vLow = Math.min(low(0), vLow); vClose = close(0); } if(Display=="Hide"){ if(vFlag==false&&vHigh!=null&&vLow!=null){ var vHigh2 = vHigh; var vLow2 = vLow; } }else if(Display=="Show"){ var vHigh2 = vHigh; var vLow2 = vLow; } return new Array(vHigh2,vLow2); }