//@version=6 indicator("RSI TMA", overlay=true) // Arrows on the main chart (overlay=true) // Input parameters rsiLength = input.int(2, title="RSI Length") rsiPrice = input.source(close, title="RSI Price") halfLength = input.int(2, title="Half Length") devPeriod = input.int(100, title="Deviation Period") deviations = input.float(0.7, title="Deviations") noDellArr = input.bool(false, title="No Delete Arrows") arrOtstup = input.int(0, title="Arrow Offset") arrUpColor = input.color(color.lime, title="Arrow Up Color") arrDnColor = input.color(color.red, title="Arrow Down Color") alertsMessage = input.bool(false, title="Alerts Message") alertsSound = input.bool(false, title="Alerts Sound") alertsEmail = input.bool(false, title="Alerts Email") alertsMobile = input.bool(false, title="Alerts Mobile") signalBar = input.int(0, title="Signal Bar") ...
//@version=5
indicator("Cumulative Effort & Result Index (CER Index) - Screenshot Style", overlay=false, max_lines_count=500)
// ---------- Inputs ----------
atrLen = input.int(14, "ATR Length")
normDiv = input.float(1000.0, "Normalization Divisor (for display)", step=1)
minEffort = input.int(1, "Min volume to consider", minval=0)
// ---------- Effort & Result ----------
effort = volume // raw effort = volume
result = close - open // result = price outcome
// Optionally ignore tiny volumes
effort := effort < minEffort ? 0 : effort
// Cumulative Effort x Result (raw)
cer_raw = effort * result
// normalize for plotting in indicator pane
cer = cer_raw / normDiv
// ---------- Threshold logic (Strong / Weak) ----------
// Use ATR as threshold for "big result"
atrVal = ta.atr(atrLen)
bigResult = math.abs(result) > atrVal
// buyer vs seller
isBuy = cer_raw > 0
isSell = cer_raw < 0
buyerStrong = isBuy and bigResult
buyerWeak = isBuy and not bigResult
sellerStrong = isSell and bigResult
sellerWeak = isSell and not bigResult
// ---------- Colors like screenshot ----------
colBuyerStrong = color.green
colBuyerWeak = color.blue
colSellerStrong = color.red
colSellerWeak = color.yellow
// ---------- Plot zero line ----------
hline(0, "Zero", color=color.gray, linestyle=hline.style_dotted)
// ---------- Plot triangles at cer value (so they center on zero line shape) ----------
plotshape(series = buyerStrong ? cer : na, title="Buyer Strong", style=shape.triangleup, location=location.absolute, color=colBuyerStrong, size=size.large)
plotshape(series = buyerWeak ? cer : na, title="Buyer Weak", style=shape.triangleup, location=location.absolute, color=colBuyerWeak, size=size.large)
plotshape(series = sellerStrong? cer : na, title="Seller Strong", style=shape.triangledown, location=location.absolute, color=colSellerStrong, size=size.large)
plotshape(series = sellerWeak ? cer : na, title="Seller Weak", style=shape.triangledown, location=location.absolute, color=colSellerWeak, size=size.large)
// ---------- Optional: small histogram behind triangles to show raw values ----------
plot(cer, title="CER (normalized)", style=plot.style_columns, linewidth=1, color = cer > 0 ? color.new(color.green,70) : color.new(color.red,70))
// ---------- Tooltip labels (optional small text on each shape) ----------
plotchar(buyerStrong ? cer : na, title="BS", char='B', location=location.absolute, color=color.white, size=size.tiny)
plotchar(buyerWeak ? cer : na, title="BW", char='b', location=location.absolute, color=color.white, size=size.tiny)
plotchar(sellerStrong ? cer : na, title="SS", char='S', location=location.absolute, color=color.white, size=size.tiny)
plotchar(sellerWeak ? cer : na, title="SW", char='s', location=location.absolute, color=color.white, size=size.tiny)
Comments
Post a Comment