/* A TICK interpreter based on sound statistical principles. A FREE EOTPro (eotprolive.com) indicator. */ function preMain() { setPriceStudy(false); setShowTitleParameters(true); setStudyTitle("TickMolest"); setCursorLabelName("TICKv"); var fp1 = new FunctionParameter("cutoff1",FunctionParameter.NUMBER); fp1.setName("cutoff one"); fp1.setDefault(500); fp1.setLowerLimit(1); var fp2 = new FunctionParameter("cutoff2",FunctionParameter.NUMBER); fp2.setName("cutoff two"); fp2.setDefault(1100); fp2.setLowerLimit(2); setDefaultBarThickness(2,0); setPlotType(PLOTTYPE_HISTOGRAM, 0); } var oldtotal = 0; var total = 0; function main(cutoff1,cutoff2) { if(getBarState() == BARSTATE_ALLBARS) { oldtotal= 0; total = 0; } if(getBarState() == BARSTATE_NEWBAR) { oldtotal = total; } total = 0; var med = (high(0) + low(0))*0.5; if(high(0) > cutoff1) total += (high(0) - cutoff1); if(low(0) < -cutoff1) total -= (-cutoff1 - low(0)); if(med > cutoff1) total += (med - cutoff1); if(med < -cutoff1) total -= (-cutoff1 - med); if(high(0) > cutoff2) total += 2*(high(0) - cutoff2); if(low(0) < -cutoff2) total -= 2*(-cutoff2 - low(0)); return (oldtotal + 2.0*total)/3.0; }