public DollarTrailingStop(Position position, Spud <double> close, double stopLoss, string name, QREBridgeBase bridge) : base(position, name, STOP, close.manager) { this.close = close; this.stopLoss = stopLoss; this.bridge = bridge; tradePnl = close.transform(price => position.pnlNoSlippage(price, bridge.arguments().runInNativeCurrency, bridge.fxRate(position.symbol))); highWaterMark = dependsOn(new Max(tradePnl)); }
protected override double exitLevel() { return(position.priceAtPnlNoSlippage(Math.Max(0, highWaterMark) - stopLoss, bridge.arguments().runInNativeCurrency, bridge.fxRate(position.symbol))); }
public SystemArguments arguments() { return(bridge.arguments()); }
public static S create <S>(QREBridgeBase bridge) where S : System { return(create <S>(bridge.arguments().parameters.systemClassName(), bridge)); }