PROTECTED SOURCE SCRIPT
MACD Support/Resistance(Ayhan)

1) Support/Resistance from MACD crosses (your blue/orange horizontal lines)
When MACD crosses DOWN (macdDown): it looks back ~5 bars and takes the highest high → saves it as a Resistance (orange horizontal line + diamond).
When MACD crosses UP (macdUp): it looks back ~5 bars and takes the lowest low → saves it as a Support (blue horizontal line + diamond).
So the blue line you circled is: a new Support level created right after a MACD UP cross.
2) Removes levels when they break
If price low goes below a Support level → “Support Broken” event, and that level is removed.
If price high goes above a Resistance level → “Resistance Broken” event, and that level is removed.
3) Finds nearest Support/Resistance + calculates risk/reward
From all active levels it finds:
Nearest Support below price (nearSup)
Nearest Resistance above price (nearRes)
Then it calculates:
Distance to each in %,
R/R for a long (buy) (stop at support, target at resistance),
Position size (lots) using account size + risk % per trade.
4) ADX (trend strength) + table
It calculates ADX (Wilder style) and shows Weak / Medium / Strong in the table.
5) Alerts (this is what you choose in TradingView)
Alert conditions included:
MACD Crossover Up
MACD Crossunder Down
New Support Created
New Resistance Created
Support Broken
Resistance Broken
In TradingView alarms, you select one of these under Condition.
6) ATF (if enabled)
ATF searches different periods, chooses the one with best fit (Pearson R), and draws:
A sloped midline + upper/lower channel, plus a small ATF table.
If you tell me which exact event should be your “BUY” (New Support? MACD UP? plus ADX filter?), I can align the alert to that logic and make the alert message clean (Telegram-ready if needed).
When MACD crosses DOWN (macdDown): it looks back ~5 bars and takes the highest high → saves it as a Resistance (orange horizontal line + diamond).
When MACD crosses UP (macdUp): it looks back ~5 bars and takes the lowest low → saves it as a Support (blue horizontal line + diamond).
So the blue line you circled is: a new Support level created right after a MACD UP cross.
2) Removes levels when they break
If price low goes below a Support level → “Support Broken” event, and that level is removed.
If price high goes above a Resistance level → “Resistance Broken” event, and that level is removed.
3) Finds nearest Support/Resistance + calculates risk/reward
From all active levels it finds:
Nearest Support below price (nearSup)
Nearest Resistance above price (nearRes)
Then it calculates:
Distance to each in %,
R/R for a long (buy) (stop at support, target at resistance),
Position size (lots) using account size + risk % per trade.
4) ADX (trend strength) + table
It calculates ADX (Wilder style) and shows Weak / Medium / Strong in the table.
5) Alerts (this is what you choose in TradingView)
Alert conditions included:
MACD Crossover Up
MACD Crossunder Down
New Support Created
New Resistance Created
Support Broken
Resistance Broken
In TradingView alarms, you select one of these under Condition.
6) ATF (if enabled)
ATF searches different periods, chooses the one with best fit (Pearson R), and draws:
A sloped midline + upper/lower channel, plus a small ATF table.
If you tell me which exact event should be your “BUY” (New Support? MACD UP? plus ADX filter?), I can align the alert to that logic and make the alert message clean (Telegram-ready if needed).
Script protégé
Ce script est publié en source fermée. Cependant, vous pouvez l'utiliser librement et sans aucune restriction – pour en savoir plus, cliquez ici.
Telegram kanalımızdakı sinyaller ücretsizdir.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script protégé
Ce script est publié en source fermée. Cependant, vous pouvez l'utiliser librement et sans aucune restriction – pour en savoir plus, cliquez ici.
Telegram kanalımızdakı sinyaller ücretsizdir.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.