PROTECTED SOURCE SCRIPT

MACD Support/Resistance(Ayhan)

46
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).

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.