Class MarketHintSignal

All Implemented Interfaces:
Event<Strategy>, StrategySignal, StrategyEvent
Direct Known Subclasses:
BuySignal, SellSignal

public abstract class MarketHintSignal extends EventTypeValueSignal
Market hint signal
  • Field Details

  • Constructor Details

  • Method Details

    • setOrderKind

      public <T extends MarketHintSignal> T setOrderKind(@NonNull @NonNull MarketHintSignal.OrderKind orderKind)
    • setMaxTries

      public <T extends MarketHintSignal> T setMaxTries(int maxTries)
    • getMaxTries

      public Integer getMaxTries()
    • setSellPercent

      public <T extends MarketHintSignal> T setSellPercent(double percent)
    • getSellPercent

      public double getSellPercent()
    • setFlags

      public <T extends MarketHintSignal> T setFlags(@NonNull @NonNull com.wualabs.qtsurfer.engine.exchange.trade.OrderFlag... flags)
    • getFlags

      public Collection<com.wualabs.qtsurfer.engine.exchange.trade.OrderFlag> getFlags()
      Returns order flags (FOK, IOC, etc.) supporting multiple storage formats: array, single value, or collection. Returns null if no flags are set.
      Returns:
      the order flags collection, or null
    • setStopPrice

      public <T extends MarketHintSignal> T setStopPrice(Number stopPrice)
      Sets the stop-loss trigger price on this signal, allowing a BuySignal to carry stop-loss configuration so the pipeline can auto-place a stop order after the buy fills.
    • getStopPrice

      public Number getStopPrice()
    • setStopLimitPrice

      public <T extends MarketHintSignal> T setStopLimitPrice(Number limitPrice)
      Sets the limit price for a stop-limit order. If not set, the stop will be placed as a stop-market order.
    • getStopLimitPrice

      public Number getStopLimitPrice()
    • setTrailPercent

      public <T extends MarketHintSignal> T setTrailPercent(Number trailPercent)
      Sets the trailing-stop distance as a PERCENT of the running price extreme . Only meaningful when getOrderKind() is MarketHintSignal.OrderKind.stopTrailing: the backtest pending-order resolver tracks max(extreme, tick.last()) for a trailing SELL (mirrored as a running min for a trailing BUY) and fires when price retraces this percent from that extreme, filling at the trigger level.
    • getTrailPercent

      public Number getTrailPercent()
    • setStopCondition

      public <T extends MarketHintSignal> T setStopCondition(BooleanSupplier stopCondition)
      Gates an engine-side stop (trailing or fixed) this signal arms on a strategy-supplied macro condition: the stop then fires only on a price crossing and while the predicate returns true, reproducing the ScalpingV2 "stop only in confirmed weakness" pattern as a config seam rather than per-strategy code. The predicate is consulted afresh on every observed price, so a strategy can suppress a stop while the wider trend is still in its favour and let it through once that turns.

      Unset (the default) means always fire — behaviour is unchanged for a strategy that never sets one. This can only take effect on an engine-side stop: a native resting order on the exchange fires unconditionally and cannot consult a live predicate, which is one of the reasons conditional stops are emulated in the engine. Setting a stop condition on a signal that also carries a fixed stop price places that stop engine-side instead of as a native order.

    • getStopCondition

      public BooleanSupplier getStopCondition()
    • hasStopLoss

      public boolean hasStopLoss()
      Returns whether this signal carries stop-loss parameters.
    • copy

      public abstract <T extends MarketHintSignal> T copy()
    • copyInternal

      protected <T extends MarketHintSignal> T copyInternal(@NonNull T copy)
      Copies all properties, timestamp, and order kind to the target signal. Used by subclass copy() implementations to clone signal state.
      Parameters:
      copy - the target signal to copy state into
      Returns:
      the populated copy
    • getKind

      public MarketHintSignal.Kind getKind()
    • getPrice

      public Number getPrice()
    • getOrderKind

      public MarketHintSignal.OrderKind getOrderKind()