replace real with double. record noeq MPM2(real[] ticker) { record Juicer(real lossTolerance, real pullback /*, real smoothing*/) {} //class OpenOrder { real openingTime, direction; } //class Position { OpenOrder openOrder; real crest, profit; } record Position(real openingTime, real direction) { real openingPrice() { ret ticker(openingTime); } } record Eye(real width, real height, real interval) {} real ticker(real time) { ret ticker(iceil(time)); } // all "profit" functions return a positive or negative percent value real profit(Position p, real time) { ret (ticker(time)/p.openingPrice()*100-100)*p.direction; } real closingTime(Position p, Juicer j) { int time = iceil(p.openingTime); real openingPrice = ticker(time); real crest = -infinity(); while (time < ticker.length) { real profit = profit(p, time); crest = max(crest, profit); if (profit < -j.lossTolerance || profit <= crest-j.pullback) break; ++time; } ret time; } real profit(Position p, Juicer j) { ret profit(p, closingTime(p, j)); } real profitability(real time, Juicer j) { ret max( profit(new Position(time, -1), j), profit(new Position(time, 1), j)); } } ret new MPM2;