Function validateSignal

Validates ISignalDto returned by getSignal, branching on the same logic as ClientStrategy GET_SIGNAL_FN.

When priceOpen is provided:

  • If currentPrice already reached priceOpen (shouldActivateImmediately) → validates as pending: currentPrice must be between SL and TP
  • Otherwise → validates as scheduled: priceOpen must be between SL and TP

When priceOpen is absent:

  • Validates as pending: currentPrice must be between SL and TP

Checks:

  • currentPrice is a finite positive number
  • Common signal fields via validateCommonSignal (position, prices, TP/SL relationships, minuteEstimatedTime)
  • Position-specific immediate-close protection (pending) or activation-close protection (scheduled)
  • Parameters

    • signal: ISignalDto

      Signal DTO returned by getSignal

    • currentPrice: number

      Current market price at the moment of signal creation

    Returns boolean

    true if signal is valid, false if validation errors were found (errors logged to console.error)