Beispiel #1
0
 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));
 }
Beispiel #2
0
 protected override double exitLevel()
 {
     return(position.priceAtPnlNoSlippage(Math.Max(0, highWaterMark) - stopLoss, bridge.arguments().runInNativeCurrency, bridge.fxRate(position.symbol)));
 }
Beispiel #3
0
 public SystemArguments arguments()
 {
     return(bridge.arguments());
 }
Beispiel #4
0
 public static S create <S>(QREBridgeBase bridge) where S : System
 {
     return(create <S>(bridge.arguments().parameters.systemClassName(), bridge));
 }