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).
受保护脚本
此脚本以闭源形式发布。 但是,您可以自由使用,没有任何限制 — 了解更多信息这里。
Telegram kanalımızdakı sinyaller ücretsizdir.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
受保护脚本
此脚本以闭源形式发布。 但是,您可以自由使用,没有任何限制 — 了解更多信息这里。
Telegram kanalımızdakı sinyaller ücretsizdir.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。