/********************************************************* Alexis C. Montenegro © October 2005 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(false); setStudyTitle("Symbol"); setCursorLabelName("Open", 0); setCursorLabelName("High", 1); setCursorLabelName("Low", 2); setCursorLabelName("Close", 3); setDefaultBarFgColor(Color.black, 0); setDefaultBarFgColor(Color.black, 1); setDefaultBarFgColor(Color.black, 2); setDefaultBarFgColor(Color.black, 3); setPlotType(PLOTTYPE_DOT, 0); setPlotType(PLOTTYPE_DOT, 1); setPlotType(PLOTTYPE_DOT, 2); setPlotType(PLOTTYPE_FLATLINES, 3); setDefaultBarThickness(0, 0); setDefaultBarThickness(0, 1); setDefaultBarThickness(0, 2); setDefaultBarThickness(0, 3); askForInput(); var fp1 = new FunctionParameter("Symbol", FunctionParameter.STRING); fp1.setDefault(); var fp2 = new FunctionParameter("Wick", FunctionParameter.COLOR); fp2.setDefault(Color.black); var fp3 = new FunctionParameter("Bars", FunctionParameter.NUMBER); fp3.setDefault(200); } var bInit = false; var xOpen = null; var xHigh = null; var xLow = null; var xClose = null; var iCntr = 0; var vColor = Color.black; function main(Symbol,Wick,Bars) { if(bInit==false){ if(Symbol==null) Symbol = getSymbol(); xOpen = open(sym(Symbol)); xHigh = high(sym(Symbol)); xLow = low(sym(Symbol)); xClose = close(sym(Symbol)); bInit = true; } if (getBarState()==BARSTATE_NEWBAR) { iCntr++; if (iCntr>Bars) iCntr = 0; } var nOpen = xOpen.getValue(0); var nHigh = xHigh.getValue(0); var nLow = xLow.getValue(0); var nClose = xClose.getValue(0); if(nHigh==null||nLow==null||nOpen==null||nClose==null) return; if(nClose>nOpen) vColor=Color.RGB(0,190,0); else if(nClose