Skip to content
All library documents

Logistic Regression Signals with Multi-Timeframe Inputs and Fixed Holding Periods

Article TradingView scripts

Summary

This indicator presents logistic regression as a binary classification method that estimates event probabilities through a sigmoid function. Its implementation updates model weights with gradient descent over a configurable lookback window on each new bar, then derives directional states from the model output. Options include the source price, chart resolution, normalization window, learning rate, iteration count, signal filters based on volume or volatility, and a holding-period limit.

Signals can be generated by comparing price with a scaled model loss series or by crossovers between scaled loss and prediction series. A change in direction or expiry of the holding period marks an exit, while the script also displays alerts and rudimentary trade statistics. The author explicitly warns that signals repaint and that settings may need adjustment by asset; defaults were described as tested with EUR/USD. The included backtesting section is marked unfinished, so its displayed figures should not be treated as reliable evidence of strategy performance.

Key ideas

  • Logistic regression is used as a binary classifier whose output is shaped by a sigmoid function.
  • The script updates model weights on each bar using gradient descent and configurable training settings.
  • Directional signals use scaled model series, optionally filtered by volatility or volume conditions.
  • Positions are ended after a signal reversal or a configurable holding period.
  • The author warns that signals repaint, and the backtesting code is identified as unfinished.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.