function preMain() { setPriceStudy(true); setStudyTitle("X Line"); setCursorLabelName("X",0); setCursorLabelName("AvgX",1); setDefaultBarFgColor(Color.brown,0); setDefaultBarFgColor(Color.yellow,1); setPlotType(PLOTTYPE_LINE,0); setPlotType(PLOTTYPE_LINE,1); setDefaultBarThickness(1,0); setDefaultBarThickness(2,1); } function main() { var X = 0; var AvgX = 0; X = close () - ema (30); AvgX = ema (14, X); return (X, AvgX); }