/********************************************************* Alexis C. Montenegro © January 2006 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. **********************************************************/ var fpArray = new Array(); function preMain() { setPriceStudy(false); setStudyTitle("Chaikin Oscillator"); setCursorLabelName("CO"); setDefaultBarFgColor(Color.blue); setDefaultBarThickness(1); setPlotType(PLOTTYPE_LINE); var x=0; fpArray[x] = new FunctionParameter("Fast", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(3); } fpArray[x] = new FunctionParameter("Slow", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(10); } fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING); with(fpArray[x++]){ setDefault(); } fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING); with(fpArray[x++]){ setDefault(); } fpArray[x] = new FunctionParameter("Hist", FunctionParameter.BOOLEAN); with(fpArray[x++]){ setName("Plot as Histogram"); setDefault(false); } fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN); with(fpArray[x++]){ setName("Show Parameters"); setDefault(false); } } var bInit = false; var xCOsc = null; function main(Fast,Slow,Symbol,Interval,Hist,Params) { if(bInit == false){ if(Symbol == null) Symbol = getSymbol(); if(Interval == null) Interval = getInterval(); var vSymbol = Symbol+","+Interval; xCOsc = getSeries(efsInternal("calcCOsc",Fast,Slow,(sym(vSymbol)))); if(Hist == true) setPlotType(PLOTTYPE_HISTOGRAM); addBand(0, PS_SOLID, 1, Color.black,"0"); setShowTitleParameters(eval(Params)); bInit = true; } return xCOsc; } var xInit = false; var xFast = null; var xSlow = null; function calcCOsc(fast,slow,source){ if(xInit == false){ xFast = ema(fast,accDist()); xSlow = ema(slow,accDist()); xInit = true; } if(getCurrentBarCount()