This indicator combines pivot-based support and resistance levels with multi-timeframe MACD crossovers and a higher-timeframe exponential moving average trend filter.
//@version=4
// EMA Section
study(title="MACD + Support / Resistance", shorttitle="MACD + Support & Resist", overlay=true, max_labels_count = 500)
lookback = input(title = "Pivot Lookback", type = input.integer, defval = 10, minval = 1)
epsilon = input(title = "Price Epsilon (%)", type = input.float, defval = 0.5, minval = 0.1)
emaRes = input(title = "EMA Resolution", type = input.resolution, defval = "D")
emaSrc = input(title = "EMA Source", type = input.source, defval = close)
emaLength = input(title = "EMA Length", type = input.integer, defval = 100, minval = 1)
ema100 = ema(emaSrc, emaLength)
ema100Daily = security(syminfo.tickerid, emaRes, ema100[barstate.isrealtime ? 1 : 0], barmerge.gaps_off, barmerge.lookahead_off)
emaLong = close > ema100Daily
emaShort = close < ema100Daily
plot(ema100Daily, "EMA", color = color.white, linewidth = 2)
epsilon /= 100
// 100 EMA, MACD, previous high or low
prevHigh = pivothigh(close, lookback, lookback)
prevLow = pivotlow(close, lookback, lookback)
// MACD
// Getting inputs
macdRes = input(title = "MACD Resolution", type = input.resolution, defval = "30")
fast_length = input(title="MACD Fast Length", type=input.integer, defval=12)
slow_length = input(title="MACD Slow Length", type=input.integer, defval=26)
src = input(title="MACD Source", type=input.source, defval=close)
signal_length = input(title="MACD Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)
sma_source = input(title="MACD Simple MA (Oscillator)", type=input.bool, defval=false)
sma_signal = input(title="MACD Simple MA (Signal Line)", type=input.bool, defval=false)
displayPivots = input(title = "Display Pivot Labels", type = input.bool, defval = false)
// Calculating
fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)
slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)
hist = macd - signal
macdSec = security(syminfo.tickerid, macdRes, macd[barstate.isrealtime ? 1 : 0], barmerge.gaps_off, barmerge.lookahead_off)
signalSec = security(syminfo.tickerid, macdRes, signal[barstate.isrealtime ? 1 : 0], barmerge.gaps_off, barmerge.lookahead_off)
macdCrossDown = crossunder(macdSec, signalSec)
macdCrossUp = crossover(macdSec, signalSec)
var bool highPointReached = na
var bool lowPointReached = na
if (high + (epsilon * high)) >= prevHigh
if displayPivots
label.new(bar_index, y = na, yloc = yloc.abovebar, color = color.green, style = label.style_triangledown)
highPointReached := true
else
highPointReached := na
if (low - (epsilon * low)) <= prevLow
if displayPivots
label.new(bar_index, y = na, yloc = yloc.belowbar, color = color.red, style = label.style_triangleup)
lowPointReached := true
else
lowPointReached := na
macdPriceLong = false
macdPriceShort = false
if macdCrossDown and barssince(not na(highPointReached)) < lookback
macdPriceShort := true
if macdCrossUp and barssince(not na(lowPointReached)) < lookback
macdPriceLong := true
if not na(prevHigh) and displayPivots
label.new(bar_index - lookback, y = na, yloc = yloc.abovebar, style = label.style_triangledown)
if not na(prevLow) and displayPivots
label.new(bar_index - lookback, y = na, yloc = yloc.belowbar, style = label.style_triangleup)
long = macdPriceLong and emaLong
short = macdPriceShort and emaShort
if long
label.new(x = bar_index, y = na, text = "Long", yloc = yloc.abovebar, color = color.green)
if short
label.new(x = bar_index, y = na, text = "Short", yloc = yloc.abovebar, color = color.red)
// Alerts
alertcondition(long, title = "Long Signal", message = "Long @ {{timenow}}: {{ticker}} -> {{interval}}: {{close}}")
alertcondition(short, title = "Short Signal", message = "Short @ {{timenow}}: {{ticker}} -> {{interval}}: {{close}}")
Overview
MACD + Support / Resistance identifies support and resistance touches using pivot highs and lows within a user-defined percentage band. Bullish signals occur when price bounces near support and the MACD crosses up above the higher-timeframe EMA; bearish signals require a resistance test, a MACD cross down, and price below the EMA. All visuals and signals plot directly on the price chart. Historical signals may repaint because higher-timeframe data handles historical and real-time bars differently.
Multi-timeframe EMA trend filter
Multi-timeframe MACD crossover detection
Pivot high and low support and resistance detection
Configurable price tolerance threshold for pivot touches
Optional visual pivot and crossover labels on chart
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Pivot Lookback
int
10
lookback
Price Epsilon (%)
float
0.5
epsilon
EMA Resolution
timeframe
D
emaRes
EMA Source
source
close
emaSrc
EMA Length
int
100
emaLength
MACD Resolution
timeframe
30
macdRes
MACD Fast Length
int
12
fast_length
MACD Slow Length
int
26
slow_length
MACD Source
source
close
src
MACD Signal Smoothing
int
9
signal_length
MACD Simple MA (Oscillator)
bool
false
sma_source
MACD Simple MA (Signal Line)
bool
false
sma_signal
Show all 13 settings
Setting
Type
Default
Variable
Display Pivot Labels
bool
false
displayPivots
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This script provides an indicator-based backtesting engine framework that simulates trade entries, exits, and filtering directly on the price chart. It evaluates selected entry rules and multi-layered filters, including moving average trends, volume increases,
This overlay indicator plots Central Pivot Range levels and bands across yearly, quarterly, monthly, weekly, daily, and six-hour periods. Each timeframe can be shown or hidden, and pivot and band colors are set separately. It also marks MACD momentum and EMA t
The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma
This indicator calculates pivot high and pivot low points on the price chart based on configurable left and right bar counts. Confirmed pivot highs and lows are plotted with negative bar offsets directly on the price chart using line and cross styles. Addition
This overlay indicator marks call and put setups from EMAs, RSI, MACD, and a SPY volume ratio. A call needs higher highs, RSI above its minimum, rising MACD, above-average proxy volume, and a rising trend EMA; a put reverses those tests. Early markers use an E
This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts