concept CleanMoveStrategy extends G22TradingStrategy { // How clean the move must be settable double minCleanness = 2; // How profitable the move must be settable double minProfit = 0.5; // Factor for turning pullback into callback settable double callbackFactor = 1.5; // Max pullback of move settable double maxPullback = 1; persistable class Position extends G22TradingStrategy.Position { settable CallbackJuicer juicer; } srecord ProfitBeforeLeverageJuiceable(Position p) is Juiceable { public double juiceValue() { ret p.profitBeforeLeverage(); } } void price(double price) { if (currentPrice == price) ret; currentPrice = price; afterwards { change(); } for (p : openPositions()) { if (p.juicer != null) { var signals = p.juicer.calculateCloseSignals(); var strongest = highestBy(signals, s -> s.strength()); if (strongest != null && strongest.isTrigger()) p.close(strongest); } } } L openPositions() { ret (L) super.openPositions(); } }