//@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") ...
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Author: MEOW PURR | Telegram: @MeowForex1
//@version=6
indicator("SMART MEOW MONEY", "SMM", overlay=true, max_labels_count=250)
// --- INFO ---
// SMART MEOW MONEY by MEOW PURR
// Professional Smart Money Concepts indicator with advanced dashboard
// Telegram: @MeowForex1
//
// Features: OB, Liquidity Sweeps, MSS, FVG, SL/TP, Fibonacci Dashboard
// =============================================================================
// INPUTS
// =============================================================================
string group_strategy = "Strategy Settings"
string group_risk = "Risk Management Settings"
string group_dashboard = "Dashboard Settings"
string group_visuals = "Visual Settings"
// -- Strategy Inputs
lookbackLength = input.int(20, "Liquidity Lookback", group = group_strategy, tooltip = "Number of bars to look back to find a high/low to be swept.")
pivotLeft = input.int(5, "Pivot Left Bars", group = group_strategy, tooltip = "Number of bars to the left of a pivot point for MSS.")
pivotRight = input.int(5, "Pivot Right Bars", group = group_strategy, tooltip = "Number of bars to the right of a pivot point for MSS.")
requireOB = input.bool(true, "Require Order Block?", group = group_strategy, tooltip = "If enabled, the liquidity sweep must originate from a valid Order Block.")
requireFVG = input.bool(true, "Require FVG on MSS?", group = group_strategy, tooltip = "If enabled, the Market Structure Shift must be accompanied by a Fair Value Gap.")
enforceAlternatingSignals = input.bool(true, "Enforce Alternating Signals?", group = group_strategy, tooltip = "If enabled, the indicator will only show a bullish signal after a bearish one, and vice-versa.")
// -- Risk Management Inputs
showSLTP = input.bool(true, "Show SL/TP Levels?", group = group_risk)
slBuffer = input.float(0.1, "SL Buffer %", group = group_risk, minval = 0, step = 0.05)
tp1_ratio = input.float(2.0, "TP1 Risk:Reward Ratio", group = group_risk, minval = 0.5, step = 0.5)
tp2_ratio = input.float(3.0, "TP2 Risk:Reward Ratio", group = group_risk, minval = 1.0, step = 0.5)
showTP2 = input.bool(true, "Show TP2?", group = group_risk)
// -- Dashboard Inputs
showDashboard = input.bool(true, "Show Dashboard?", group = group_dashboard)
dashboardTimeframe = input.timeframe("60", "Analysis Timeframe", group = group_dashboard, options=["60", "240"])
fibPeriod = input.int(50, "Fibonacci Lookback Period", group = group_dashboard, minval=20, maxval=200)
// -- Visual Inputs
showBG_Color = input.bool(false, "Show Background Color on Signal?", group = group_visuals)
showOB_FVG_Boxes = input.bool(false, "Show OB & FVG Boxes?", group = group_visuals)
showMSS_Targets = input.bool(false, "Show MSS Target Lines?", group = group_visuals)
showArrowLabels = input.bool(false, "Show Labels with Arrows?", group = group_visuals)
showAuthorInfo = input.bool(true, "Show Author Info?", group = group_visuals)
maxBoxes = input.int(10, "Max Boxes to Display", group = group_visuals)
// Colors
bullColor = input.color(color.new(color.lime, 0), "Bullish Color", group = group_visuals)
bearColor = input.color(color.new(color.fuchsia, 0), "Bearish Color", group = group_visuals)
obColor = input.color(color.new(color.gray, 70), "Order Block Color", group = group_visuals)
slColor = input.color(color.new(color.red, 0), "Stop Loss Color", group = group_visuals)
tp1Color = input.color(color.new(color.green, 0), "TP1 Color", group = group_visuals)
tp2Color = input.color(color.new(color.blue, 0), "TP2 Color", group = group_visuals)
// =============================================================================
// DASHBOARD CALCULATIONS
// =============================================================================
// Get Higher Timeframe Data for Dashboard
htf_high = request.security(syminfo.tickerid, dashboardTimeframe, ta.highest(high, fibPeriod))
htf_low = request.security(syminfo.tickerid, dashboardTimeframe, ta.lowest(low, fibPeriod))
htf_close = request.security(syminfo.tickerid, dashboardTimeframe, close)
// Calculate Fibonacci Levels
fib_range = htf_high - htf_low
fib_0 = htf_low
fib_236 = htf_low + (fib_range * 0.236)
fib_382 = htf_low + (fib_range * 0.382)
fib_50 = htf_low + (fib_range * 0.5)
fib_618 = htf_low + (fib_range * 0.618)
fib_786 = htf_low + (fib_range * 0.786)
fib_100 = htf_high
// Identify nearest key levels
current_price = close
nearest_support = current_price > fib_618 ? fib_618 : current_price > fib_50 ? fib_50 : current_price > fib_382 ? fib_382 : current_price > fib_236 ? fib_236 : fib_0
nearest_resistance = current_price < fib_382 ? fib_382 : current_price < fib_50 ? fib_50 : current_price < fib_618 ? fib_618 : current_price < fib_786 ? fib_786 : fib_100
// Calculate Daily High/Low for Liquidity
daily_high = request.security(syminfo.tickerid, "D", high)
daily_low = request.security(syminfo.tickerid, "D", low)
weekly_high = request.security(syminfo.tickerid, "W", high)
weekly_low = request.security(syminfo.tickerid, "W", low)
// Market Structure Analysis
trend = htf_close > fib_618 ? "BULLISH" : htf_close < fib_382 ? "BEARISH" : "NEUTRAL"
trend_color = trend == "BULLISH" ? color.lime : trend == "BEARISH" ? color.fuchsia : color.yellow
// =============================================================================
// DASHBOARD DISPLAY (UPPER RIGHT)
// =============================================================================
if showDashboard and barstate.islast
var table dashboardTable = table.new(position.top_right, 2, 12, border_width=2, border_color=color.white, frame_width=2, frame_color=color.white)
// Header - merged cells
table.cell(dashboardTable, 0, 0, "🐱 SMART MEOW MONEY", bgcolor=color.new(color.purple, 0), text_color=color.white, text_size=size.normal)
table.cell(dashboardTable, 1, 0, "", bgcolor=color.new(color.purple, 0))
table.merge_cells(dashboardTable, 0, 0, 1, 0)
// Market Structure
table.cell(dashboardTable, 0, 1, "TREND:", bgcolor=color.new(color.black, 0), text_color=color.white, text_size=size.small)
table.cell(dashboardTable, 1, 1, trend, bgcolor=color.new(trend_color, 20), text_color=color.white, text_size=size.small)
// Current Price
table.cell(dashboardTable, 0, 2, "PRICE:", bgcolor=color.new(color.black, 0), text_color=color.white, text_size=size.small)
table.cell(dashboardTable, 1, 2, str.tostring(close, format.mintick), bgcolor=color.new(color.gray, 20), text_color=color.white, text_size=size.small)
// Key Fibonacci Levels Header
table.cell(dashboardTable, 0, 3, "FIB LEVELS", bgcolor=color.new(color.blue, 0), text_color=color.white, text_size=size.small)
table.cell(dashboardTable, 1, 3, "", bgcolor=color.new(color.blue, 0))
table.merge_cells(dashboardTable, 0, 3, 1, 3)
// Fibonacci Values
table.cell(dashboardTable, 0, 4, "0.786:", bgcolor=color.new(color.black, 0), text_color=color.orange, text_size=size.tiny)
table.cell(dashboardTable, 1, 4, str.tostring(fib_786, format.mintick), bgcolor=color.new(color.black, 0), text_color=color.orange, text_size=size.tiny)
table.cell(dashboardTable, 0, 5, "0.618:", bgcolor=color.new(color.black, 0), text_color=color.yellow, text_size=size.tiny)
table.cell(dashboardTable, 1, 5, str.tostring(fib_618, format.mintick), bgcolor=color.new(color.black, 0), text_color=color.yellow, text_size=size.tiny)
table.cell(dashboardTable, 0, 6, "0.500:", bgcolor=color.new(color.black, 0), text_color=color.aqua, text_size=size.tiny)
table.cell(dashboardTable, 1, 6, str.tostring(fib_50, format.mintick), bgcolor=color.new(color.black, 0), text_color=color.aqua, text_size=size.tiny)
table.cell(dashboardTable, 0, 7, "0.382:", bgcolor=color.new(color.black, 0), text_color=color.lime, text_size=size.tiny)
table.cell(dashboardTable, 1, 7, str.tostring(fib_382, format.mintick), bgcolor=color.new(color.black, 0), text_color=color.lime, text_size=size.tiny)
// Liquidity Levels Header
table.cell(dashboardTable, 0, 8, "LIQUIDITY", bgcolor=color.new(color.red, 0), text_color=color.white, text_size=size.small)
table.cell(dashboardTable, 1, 8, "", bgcolor=color.new(color.red, 0))
table.merge_cells(dashboardTable, 0, 8, 1, 8)
// Liquidity Values
table.cell(dashboardTable, 0, 9, "D HIGH:", bgcolor=color.new(color.black, 0), text_color=color.red, text_size=size.tiny)
table.cell(dashboardTable, 1, 9, str.tostring(daily_high, format.mintick), bgcolor=color.new(color.black, 0), text_color=color.red, text_size=size.tiny)
table.cell(dashboardTable, 0, 10, "D LOW:", bgcolor=color.new(color.black, 0), text_color=color.green, text_size=size.tiny)
table.cell(dashboardTable, 1, 10, str.tostring(daily_low, format.mintick), bgcolor=color.new(color.black, 0), text_color=color.green, text_size=size.tiny)
// Next Key Level
table.cell(dashboardTable, 0, 11, close > fib_50 ? "TARGET:" : "SUPPORT:", bgcolor=color.new(color.purple, 0), text_color=color.white, text_size=size.tiny)
table.cell(dashboardTable, 1, 11, str.tostring(close > fib_50 ? nearest_resistance : nearest_support, format.mintick), bgcolor=color.new(color.purple, 0), text_color=color.yellow, text_size=size.tiny)
// =============================================================================
// AUTHOR INFO (BOTTOM)
// =============================================================================
if showAuthorInfo and barstate.islast
var table authorTable = table.new(position.bottom_center, 3, 1, border_width=1, border_color=color.white, frame_width=1, frame_color=color.white)
table.cell(authorTable, 0, 0, "🐱 SMART MEOW MONEY", bgcolor=color.new(color.purple, 0), text_color=color.white, text_size=size.small)
table.cell(authorTable, 1, 0, "by MEOW PURR", bgcolor=color.new(color.black, 0), text_color=color.lime, text_size=size.small)
table.cell(authorTable, 2, 0, "📱 @MeowForex1", bgcolor=color.new(color.blue, 0), text_color=color.white, text_size=size.small)
// =============================================================================
// LIBRARY
// =============================================================================
var box[] boxArray = array.new_box()
drawBox(color b_color, color b_border_color, float top_price, float bottom_price, int max_boxes) =>
box newBox = box.new(bar_index - 1, top_price, bar_index + 1, bottom_price,
bgcolor=b_color, border_color=b_border_color, extend=extend.right)
if boxArray.size() >= max_boxes
box oldBox = boxArray.shift()
box.delete(oldBox)
boxArray.push(newBox)
var line slLine = na
var line tp1Line = na
var line tp2Line = na
var label slLabel = na
var label tp1Label = na
var label tp2Label = na
deleteSLTPLines() =>
if not na(slLine)
line.delete(slLine)
if not na(tp1Line)
line.delete(tp1Line)
if not na(tp2Line)
line.delete(tp2Line)
if not na(slLabel)
label.delete(slLabel)
if not na(tp1Label)
label.delete(tp1Label)
if not na(tp2Label)
label.delete(tp2Label)
// =============================================================================
// CORE SMC COMPONENT IDENTIFICATION
// =============================================================================
bool isBullishFVG = low > high[2]
bool isBearishFVG = high < low[2]
float sweptHighLevel = ta.highest(high[1], lookbackLength)
float sweptLowLevel = ta.lowest(low[1], lookbackLength)
bool bearishSweep = high > sweptHighLevel and close < sweptHighLevel
bool bullishSweep = low < sweptLowLevel and close > sweptLowLevel
bool isBullishOB = close[1] < open[1] and bullishSweep
bool isBearishOB = close[1] > open[1] and bearishSweep
float pivotHighPrice = ta.pivothigh(high, pivotLeft, pivotRight)
float pivotLowPrice = ta.pivotlow(low, pivotLeft, pivotRight)
float lastPivotLow = ta.valuewhen(not na(pivotLowPrice), pivotLowPrice, 0)
float lastPivotHigh = ta.valuewhen(not na(pivotHighPrice), pivotHighPrice, 0)
// =============================================================================
// STATE MANAGEMENT
// =============================================================================
var bool waitingForBearishMSS = false
var float mssTargetLow = na
var float bearishSweepHigh = na
var float bearishSweptLevel = na
var bool waitingForBullishMSS = false
var float mssTargetHigh = na
var float bullishSweepLow = na
var float bullishSweptLevel = na
var int lastSignalType = 0
if bearishSweep and (not requireOB or isBearishOB)
waitingForBearishMSS := true
waitingForBullishMSS := false
mssTargetLow := lastPivotLow
bearishSweepHigh := high
bearishSweptLevel := sweptHighLevel
if showOB_FVG_Boxes and requireOB and isBearishOB
drawBox(obColor, color.new(color.black, 100), high[1], low[1], maxBoxes)
if bullishSweep and (not requireOB or isBullishOB)
waitingForBullishMSS := true
waitingForBearishMSS := false
mssTargetHigh := lastPivotHigh
bullishSweepLow := low
bullishSweptLevel := sweptLowLevel
if showOB_FVG_Boxes and requireOB and isBullishOB
drawBox(obColor, color.new(color.black, 100), high[1], low[1], maxBoxes)
if waitingForBearishMSS and high > bearishSweepHigh
waitingForBearishMSS := false
if waitingForBullishMSS and low < bullishSweepLow
waitingForBullishMSS := false
// =============================================================================
// SIGNAL CONFIRMATION
// =============================================================================
bool baseBearishMSS = waitingForBearishMSS and close < mssTargetLow and (not requireFVG or isBearishFVG)
bool baseBullishMSS = waitingForBullishMSS and close > mssTargetHigh and (not requireFVG or isBullishFVG)
bool finalBearishSignal = enforceAlternatingSignals ? (baseBearishMSS and lastSignalType != -1) : baseBearishMSS
bool finalBullishSignal = enforceAlternatingSignals ? (baseBullishMSS and lastSignalType != 1) : baseBullishMSS
// =============================================================================
// SL/TP CALCULATION AND PLOTTING
// =============================================================================
if finalBearishSignal
waitingForBearishMSS := false
lastSignalType := -1
if showSLTP
deleteSLTPLines()
float sl = bearishSweptLevel * (1 + slBuffer / 100)
float entry = close
float riskPoints = sl - entry
float tp1 = entry - (math.abs(riskPoints) * tp1_ratio)
float tp2 = entry - (math.abs(riskPoints) * tp2_ratio)
slLine := line.new(bar_index, sl, bar_index + 50, sl, color=slColor, style=line.style_dashed, width=2, extend=extend.right)
tp1Line := line.new(bar_index, tp1, bar_index + 50, tp1, color=tp1Color, style=line.style_solid, width=2, extend=extend.right)
if showTP2
tp2Line := line.new(bar_index, tp2, bar_index + 50, tp2, color=tp2Color, style=line.style_solid, width=2, extend=extend.right)
slLabel := label.new(bar_index + 5, sl, "SL", color=color.new(slColor, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
tp1Label := label.new(bar_index + 5, tp1, "TP1 (1:" + str.tostring(tp1_ratio) + ")", color=color.new(tp1Color, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
if showTP2
tp2Label := label.new(bar_index + 5, tp2, "TP2 (1:" + str.tostring(tp2_ratio) + ")", color=color.new(tp2Color, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
if showOB_FVG_Boxes and requireFVG and isBearishFVG
drawBox(color.new(bearColor, 80), na, high, low[2], maxBoxes)
if finalBullishSignal
waitingForBullishMSS := false
lastSignalType := 1
if showSLTP
deleteSLTPLines()
float sl = bullishSweptLevel * (1 - slBuffer / 100)
float entry = close
float riskPoints = entry - sl
float tp1 = entry + (math.abs(riskPoints) * tp1_ratio)
float tp2 = entry + (math.abs(riskPoints) * tp2_ratio)
slLine := line.new(bar_index, sl, bar_index + 50, sl, color=slColor, style=line.style_dashed, width=2, extend=extend.right)
tp1Line := line.new(bar_index, tp1, bar_index + 50, tp1, color=tp1Color, style=line.style_solid, width=2, extend=extend.right)
if showTP2
tp2Line := line.new(bar_index, tp2, bar_index + 50, tp2, color=tp2Color, style=line.style_solid, width=2, extend=extend.right)
slLabel := label.new(bar_index + 5, sl, "SL", color=color.new(slColor, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
tp1Label := label.new(bar_index + 5, tp1, "TP1 (1:" + str.tostring(tp1_ratio) + ")", color=color.new(tp1Color, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
if showTP2
tp2Label := label.new(bar_index + 5, tp2, "TP2 (1:" + str.tostring(tp2_ratio) + ")", color=color.new(tp2Color, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
if showOB_FVG_Boxes and requireFVG and isBullishFVG
drawBox(color.new(bullColor, 80), na, high[2], low, maxBoxes)
// =============================================================================
// VISUALS
// =============================================================================
plotshape(finalBullishSignal, title="Bullish Arrow", style=shape.triangleup, location=location.belowbar, color=bullColor, size=size.normal)
plotshape(finalBearishSignal, title="Bearish Arrow", style=shape.triangledown, location=location.abovebar, color=bearColor, size=size.normal)
bgcolor(showBG_Color and finalBearishSignal ? color.new(bearColor, 85) : showBG_Color and finalBullishSignal ? color.new(bullColor, 85) : na)
if finalBullishSignal and showArrowLabels
label.new(bar_index, low, "▲", style=label.style_label_up, color=color.new(bullColor, 100), textcolor=color.white, yloc=yloc.belowbar, size=size.tiny)
if finalBearishSignal and showArrowLabels
label.new(bar_index, high, "▼", style=label.style_label_down, color=color.new(bearColor, 100), textcolor=color.white, yloc=yloc.abovebar, size=size.tiny)
plot(showMSS_Targets and waitingForBearishMSS ? mssTargetLow : na, "Bearish MSS Target", color.new(bearColor, 50), style=plot.style_linebr, linewidth=2)
plot(showMSS_Targets and waitingForBullishMSS ? mssTargetHigh : na, "Bullish MSS Target", color.new(bullColor, 50), style=plot.style_linebr, linewidth=2)
// =============================================================================
// ALERTS
// =============================================================================
alertcondition(finalBullishSignal, title="SMART MEOW MONEY: BUY", message="🐱 SMART MEOW MONEY: Bullish Signal Confirmed! Check @MeowForex1")
alertcondition(finalBearishSignal, title="SMART MEOW MONEY: SELL", message="🐱 SMART MEOW MONEY: Bearish Signal Confirmed! Check @MeowForex1")
Comments
Post a Comment