//@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=6
indicator(shorttitle="MAYFAIR FX SCALPER", title="Bollinger Bands (2, 3, 4 StdDev) with RSI", overlay=true)
// Hardcoded settings
length = 20 // Hardcoded Length
maType = "SMA" // Hardcoded Basis MA Type
src = input(close, title="MM Source") // Still configurable
// Moving average function
ma(source, length, _type) =>
switch _type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
// Calculate the basis line
basis = ma(src, length, maType)
offset = 0 // Hardcoded offset
// Function to calculate Bollinger Bands
calculateBands(_basis, _mult, _src, _length) =>
dev = _mult * ta.stdev(_src, _length)
[_basis + dev, _basis - dev]
// Calculate bands (2, 3, 4 StdDev)
[upper_2, lower_2] = calculateBands(basis, 2.0, src, length)
[upper_3, lower_3] = calculateBands(basis, 3.0, src, length)
[upper_4, lower_4] = calculateBands(basis, 4.0, src, length)
// Plot basis line
plot(basis, "MAYFAIR SCALPER FX", color=color.new(#2962FF, 100), offset=offset)
// Plot bands
p1_3_outer = plot(upper_3, "IGNORE", color=color.new(#FFA726, 100), offset=offset)
p2_3_outer = plot(lower_3, "IGNORE", color=color.new(#4CAF50, 100), offset=offset)
// Fill the outer region of 3 StdDev (excluding inner 2 StdDev)
fill(p1_3_outer, plot(upper_2, "UPPER 1", color=color.new(color.red, 100)), color=color.new(color.red, 85), title="UPPER 1")
fill(p2_3_outer, plot(lower_2, "LOWER 1", color=color.new(color.green, 100)), color=color.new(color.teal, 85), title="LOWER 1")
p1_4 = plot(upper_4, "UPPER 2", color=color.new(#FFEB3B, 80), offset=offset)
p2_4 = plot(lower_4, "LOWER 2", color=color.new(#00BCD4, 80), offset=offset)
// Fill the outer region of 4 StdDev
fill(p1_4, p1_3_outer, color=color.new(color.red, 60), title="UPPER 2")
fill(p2_4, p2_3_outer, color=color.new(color.teal, 60), title="LOWER 2")
// RSI Settings
rsi_length = input.int(14, title="MM Length")
rsi_overbought = input.int(73, title="SELL Level")
rsi_oversold = input.int(31, title="BUY Level")
rsi = ta.rsi(src, rsi_length)
// Buy and Sell Signals with Small Arrows and Simple Text
plotshape(series=rsi >= rsi_overbought, location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny, title="SELL", text="SELL", textcolor=color.red)
plotshape(series=rsi <= rsi_oversold, location=location.belowbar, color=color.green, style=shape.triangleup, size=size.tiny, title="BUY", text="BUY", textcolor=color.green)
// Adding simple text labels for "SELL" and "BUY" on the right side
if (rsi >= 73)
label.new(x=bar_index, y=high + 1500.5 * syminfo.mintick, color=color.red, textcolor=color.red, size=size.small, style=label.style_none, textalign=text.align_center)
if (rsi <= 31)
label.new(x=bar_index, y=low - 1500.0 * syminfo.mintick, color=color.green, textcolor=color.green, size=size.small, style=label.style_none, textalign=text.align_center)
Comments
Post a Comment