Support and Resistance Logistic Regression | Flux Charts

Published on MillionChart by ZeroEmotion.

This indicator uses a logistic regression model to find support and resistance levels and to attach a probability to each one, estimating how likely the level is to hold. It also labels retests and breaks of those levels and can send alerts for them.

How it works:
- It detects pivot highs and lows using a Pivot Length setting.
- At each pivot it records the RSI value and the candle body size (absolute difference between open and close) as model inputs.
- The model is trained on earlier pivots and on whether they were respected by price several times, learning how RSI and body size relate to a level becoming meaningful.
- For each new pivot it outputs a probability between 0 and 1. If that is above your Probability Threshold, the pivot is drawn as a support or resistance line.
- Price is then tracked against the line: an "R" label marks a retest where price bounces off it, and a "B" label marks a break where price closes beyond it.

Settings:
- Pivot Length: number of bars used to define a pivot.
- Target Respects: how many times a level must be respected to count as strong for the model.
- Probability Threshold: minimum probability needed before a level is plotted.
- Show Prediction Labels, Show Retests and Show Breaks: toggle the labels.
- Line style, width and colors can be changed.

Alerts are available for support retests, resistance retests, support breaks and resistance breaks.