MACD Bullish Crossover IndicatorThis is just a test to see if the indicator works and gives a buy signal.
Candlestick analysis
Renko Sincronizado a VelasTeniendo en cuenta los precios máximos y mínimos alcanzados en cada una de las velas, aplicando también a cualquier tipo de gráficos, podemos obtener ladrillos del tamaño que definamos en TICKS, para de esta forma poder visualizar RENKO sobre dichas velas.
Pin Bar Detector (open)The Pin Bar Detector script is designed to identify and highlight pin bars (reversal candles) on a price chart. It scans for bullish and bearish pin bars based on wick-to-body ratio, candle size, and price structure.
🔹 Features & How It Works
✅ Detects Both Bullish & Bearish Pin Bars
Bullish Pin Bar (Hammer): Long lower wick, small body near the top, and little to no upper wick.
Bearish Pin Bar (Shooting Star): Long upper wick, small body near the bottom, and little to no lower wick.
✅ Wick-to-Body Ratio Calculation
The wick must be at least 2x the size of the body to be considered a valid pin bar.
The script dynamically checks if the upper or lower wick dominates the candle to classify it.
✅ Key Level Filtering (Optional)
The script can be modified to only detect pin bars at VWAP, 50 EMA, Support/Resistance, or First 15-Min High/Low for stronger trade signals.
✅ Customizable Inputs
Users can adjust the minimum wick-to-body ratio to refine detection.
Option to show/hide pin bars that form in choppy or sideways markets.
✅ Pin Bar Confirmation (Optional)
Can include a volume filter to detect pin bars with significant market participation.
Can add ATR confirmation to check if the pin bar forms during high volatility periods.
🔹 How to Use It in Your Trading
1️⃣ Enable the script on your chart to automatically highlight pin bars.
2️⃣ Wait for confirmation (volume spike or key level rejection) before entering a trade.
3️⃣ Use stop-loss below/above the pin bar wick to control risk.
4️⃣ Target key resistance/support levels for take-profit.
🔹 Final Thoughts
Pin bars are powerful reversal signals, but they work best at strong support/resistance zones with volume confirmation.
This script helps eliminate false pin bars by ensuring the wick-to-body ratio is valid.
Can be combined with VWAP, 50 EMA, and ATR to create a high-probability trading system.
Kutu Çizme GöstergesiDip ve Tepelerden dönüşleri yakalamaya yardımcı olabilecek bir kutu çizer. Geliştirme süreci devam etmektedir.
Дивергенции Как этот скрипт будет отображаться на графике
1. Медвежьи дивергенции:
• Когда цена достигает нового максимума (обозначается стрелкой вниз с красным цветом), но RSI не подтверждает это движение (падает), вы увидите красную метку “🔻” над соответствующей свечой.
2. Бычьи дивергенции:
• Когда цена достигает нового минимума (обозначается стрелкой вверх с зеленым цветом), но RSI не подтверждает это движение (растет), вы увидите зеленую метку “🔺” под соответствующей свечой.
3. RSI:
• Индикатор RSI будет отображаться в отдельной панели под основным графиком. На этой панели будут горизонтальные линии для уровней перекупленности (70) и перепроданности (30).
9-30wma//@version=5
indicator("Custom Indicator", overlay=true)
// 9 Günlük EMA ve 30 Günlük WMA
ema9 = ta.ema(close, 9)
wma30 = ta.wma(close, 30)
// Kapanışların 9 EMA ve 30 WMA seviyelerinin üzerinde olup olmadığını kontrol et
isCloseAboveEma9 = close > ema9
isCloseAboveWma30 = close > wma30
// Mavi sinyal: 9 EMA'nın altında, fakat 30 WMA'nın üstünde kapanış yapan ilk mum
blueSignalCondition = ta.crossover(close, ema9) and close < ema9 and close > wma30
// Yeşil sinyal: Mavi sinyali veren mumun üst seviyesinin üstünde kapanış yapan ilk mum
greenSignalCondition = close > ta.highest(blueSignalCondition ? high : na, 1) and blueSignalCondition
// Mavi ve yeşil sinyal çizimleri
plotshape(series=blueSignalCondition, color=color.blue, style=shape.labelup, location=location.belowbar, size=size.small, title="Blue Signal")
plotshape(series=greenSignalCondition, color=color.green, style=shape.labelup, location=location.belowbar, size=size.small, title="Green Signal")
Previous Candle Highs and lowsThis indicator is used to find the previous candles Highs and Lows. Which is helps us to find the trend and the liquidity in previous candles.
Candle Body Size Highlighter with Alertsan alert and marker to show that a candle body difference between open and close has closed above a certain size
Simple Market Metrics v5// ***************************************** ATTENTION ************************************************
//
// These metrics are not to be reproduced, copied, or distributed to anyone besides the original owner.
// Doing so is in direct violation of Simple Market Metrics policies, and penalties will apply.
//
// simplemarketmetrics.gumroad.com
//
// ****************************************************************************************************
//@version=5
indicator("Simple Market Metrics v5", max_lines_count=500, max_labels_count=500, behind_chart=false) // SMM v5
// ________ Rules and FAQ text ___________________________
var const string titleRules = "***** Simple Market Metrics Trading Rules *****"
var const string signalRules = " 1. How to enter a trade: • Wait for a Buy or Sell signal to appear"
var const string entryRules = " • If the signal remains when the candle closes, enter the trade with a market or limit order"
var const string tpRules = " 2. How to exit a trade: • Take profit when the price reaches the profit target line"
var const string exitRules = " • Stop out of the trade if the white dot remains on the opposite side of the profit wave only when the candle has closed."
var const string exitExample = " e.g. If you are in a long trade, and a candle closes with the white dot below the profit wave, close the trade."
var const string tradingRules = titleRules + signalRules + entryRules + tpRules + exitRules + exitExample
var const string faq = "--------| Frequently Asked Questions |--------"
var const string faq1 = " 1. What markets can this be traded with? • Simple Market Metrics works with any market, but the ES & NQ Futures are the preferred markets to trade this system with."
var const string faq2 = " 2. What candle type should be used? • Simple Market Metrics was designed to be used on Heikin Ashi candles."
var const string faq3 = " 3. What are the preferred trading hours? • The preferred hours to trade are during the New York session between 10:00am EST and 3:00pm EST."
var const string faq4 = " 4. What timeframe should I trade? • The 1 and 2 minute timeframes are preferred with ES & NQ Futures"
var const string faq5 = " 5. What should I set the profit targets to? • ES - 1 min: 4 • ES - 2 min: 8 • NQ - 1 min: 20 • NQ - 2 min: 40"
var const string faq6 = " 6. How many contracts should I start trading with prop firm accounts? • 50k - 5 micros on MES or MNQ • 150k - 2 minis on ES or NQ"
var const string faqText = faq + faq1 + faq2 + faq3 + faq4 + faq5 + faq6
var const string finalNotes = "Some final notes: The Simple Market Metrics trading system has been built specifically for trading the ES & NQ Futures markets, with the goal of small but consistent daily profits."
var const string finalNotes1 = " Although you may trade any market and timeframe you wish, it is up to you to determine the best settings for other markets and timeframes."
var const string finalNotes2 = " Trading is risky, do not trade with money you are not comfortable losing. Control your risk by managing your position size accordingly, and please practice on a sim account before using real money."
var const string finalNotes3 = " If you need further assistance, contact us at simplemarketmetrics@gmail.com"
var const string notesText = finalNotes + finalNotes1 + finalNotes2 + finalNotes3
// ________ All Inputs Here ___________________________
var const string startHereGroup = "------------------> START HERE <------------------"
rulesCheck = input.bool(false, title="Please Read The Trading Rules ----->", group=startHereGroup, tooltip=tradingRules)
faqCheck = input.bool(false, title="Frequently Asked Questions ------->", group=startHereGroup, tooltip=faqText)
notesCheck = input.bool(false, title="Final Notes & Contact Info --------->", group=startHereGroup, tooltip=notesText)
var bool disableWarning = false
//Signals Inputs
var signalsGroupName = '----- Signal Settings -----'
enableBuySellSignals = input.bool(true,title='Enable Buy & Sell Signals', group=signalsGroupName)
startHour = input.int(9, title="Start Time (HH:mm)", minval=0, maxval=23, group=signalsGroupName, inline="startTime")
startMinute = input.int(0, title=":", minval=0, maxval=59, group=signalsGroupName, inline="startTime", tooltip="This time is based on timezone of the exchange, NOT the timezone your chart is set to. So please adjust accordingly. e.g. The exchange for NQ & ES are in the Central Timezone.")
endHour = input.int(11, title="End Time (HH:mm)", minval=0, maxval=23, group=signalsGroupName, inline="endTime")
endMinute = input.int(0, title=":", minval=0, maxval=59, group=signalsGroupName, inline="endTime")
buySignalColor = input.color(color.new(#4caf50, 0),'Buy Signal Color', group=signalsGroupName)
sellSignalColor = input.color(color.new(#b22833, 0), 'Sell Signal Color', group=signalsGroupName)
enableBuySellPrice = input.bool(true,title='Enable Buy & Sell Price', group=signalsGroupName)
enableChopFilter = input.bool(true, title='Enable Chop Filter', group=signalsGroupName, tooltip='This helps to reduce signals during choppy markets, and will produce less signals overall when enabled.')
enableMaFilter = input.bool(true, 'Enable MA Filter',group=signalsGroupName)
maFilterType = input.string("EMA","MA Filter Type", options = ,group=signalsGroupName)
maFilterLength = input.int(200, 'MA Filter Period', minval=1,group=signalsGroupName)
maFilterColor = input.color(color.new(color.white, 0), 'MA Filter Color', group=signalsGroupName)
// Profit Inputs
var profitWaveGroupName = '----- Profit Settings -----'
enableProfitLines = input.bool(true, title='Enable Profit Target Lines', group=profitWaveGroupName)
profitTarget = input.int(20, title='Profit Target (Ticks/Pips/Cents)', group=profitWaveGroupName, tooltip='Profit target value is based on the minimum move of the instrument. For Futures that is ticks, FX is pips, Stocks are cents, etc.')
profitTargetMaxLines = input.int(10, title='Max Profit Target Lines', group=profitWaveGroupName, tooltip='Maximum amount of profit target lines to display on your chart.')
profitTargetColor = input.color(color.new(color.yellow, 0),'Profit Target Lines Color', group=profitWaveGroupName)
enableProfitWave = input.bool(true, "Enable Profit Wave", group=profitWaveGroupName)
profitWaveUpperBullishColor = input.color(color.new(#00ff8480, 50),'Profit Wave Bullish Top Color', group=profitWaveGroupName)
profitWaveLowerBullishColor = input.color(color.new(color.green, 50), 'Profit Wave Bullish Bottom Color', group=profitWaveGroupName)
profitWaveLowerBearishColor = input.color(color.new(#8c0000, 50), 'Profit Wave Bearish Top Color', group=profitWaveGroupName)
profitWaveUpperBearishColor = input.color(color.new(#ff0000, 50),'Profit Wave Bearish Bottom Color', group=profitWaveGroupName)
// Background Trend Inputs
var backgroundTrendGroupName = '----- Background Trend Settings -----'
enableBgColor = input.bool(true, "Enable Background Trend Color", group=backgroundTrendGroupName)
bgTrendBullishCol = input.color(color.new(#66ff00, 70),'Bullish Background Color', group=backgroundTrendGroupName)
bgTrendBearishCol = input.color(color.new(#ff0000, 70), 'Bearish Background Color', group=backgroundTrendGroupName)
// Candle Coloring Inputs
var candleSettings = "----- Candle Settings -----"
bullishCandleColor = input.color(color.new(#089981, 0),'Bullish Candle Color', group=candleSettings)
bearishCandleColor = input.color(color.new(#f23645, 0), 'Bearish Candle Color', group=candleSettings)
enableTrendCandleColoring = input.bool(true,title='Enable Candle Color Matching', group=candleSettings)
candleColoringType = input.string("Profit Wave",title='Match Candle Colors To', options= , group=candleSettings)
// Support / Resistance Inputs
var sdGroupName = '----- Support & Resistance Settings -----'
ensr = input.bool(true,title='Enable Support & Resistance Lines', group=sdGroupName)
resistanceColor = input.color(#ff0000,'Resistance Lines Color', group=sdGroupName)
supportColor = input.color(#66ff00,'Support Lines Color', group=sdGroupName)
srStyle = input.string("Dotted", options= , title="Support & Resistance Lines Style", group=sdGroupName)
srLineWidth = input.int(2, "Support & Resistance Lines Width", minval=1, maxval=5, step=1, group=sdGroupName)
extendLinesType = input.string('Close', title='Extend Lines Until', options= , group=sdGroupName, tooltip='Extend the lines until price touches them or a candle closes beyond them.')
pivotchopSensitivity = 20
maxSrLines = 50
// Real Price Inputs
var rplGroupName = '----- Real Price Settings -----'
showrealprice = input(false, title="Enable Real Price Line", group=rplGroupName)
extendLine = input(false, title="Extend Real Price Line", group=rplGroupName)
showrealpricelinecolor = input(color.new(color.white, 0), title="Real Price Line Color", group=rplGroupName)
realpricewidth = input.string("Thin", options= , title="Real Price Line Width", group=rplGroupName)
realpricestyle = input.string("Dotted", options= , title="Real Price Line Style", group=rplGroupName)
plotrealsrcClosedots = input.bool(true, title="Enable Real Close Price Dots", group=rplGroupName)
realsrcClosecolour = input(color.new(color.white, 0), title="Real Close Price Dot Color", group=rplGroupName)
size = input.string("Small", options= , title="Real Close Price Dot Size", group=rplGroupName)
// Matrix Inputs
var matrixGroupName = '----- Matrix Settings -----'
var matrixInlineName = "matrixInlineName"
matrixStyle = input.string("Horizontal", "Layout Style", options= , group=matrixGroupName)
matrixPosition = input.string("Bottom Right", "Location On Chart", options= , group=matrixGroupName)
matrixTimeframeColor = input.color(color.purple,'Timeframe Cell Color', group=matrixGroupName, inline="matrixTimeframeColors")
matrixTimeframeTextColor = input.color(color.white,'Text Color', group=matrixGroupName, inline="matrixTimeframeColors")
enableMatrixTF1 = input.bool(true, "Enable Matrix Timeframe 1", group=matrixGroupName, inline="matrixRow1")
matrixTF1 = input.timeframe("1", "", group=matrixGroupName, inline="matrixRow1")
enableMatrixTF2 = input.bool(true, "Enable Matrix Timeframe 2", group=matrixGroupName, inline="matrixRow2")
matrixTF2 = input.timeframe("2", "", group=matrixGroupName, inline="matrixRow2")
enableMatrixTF3 = input.bool(true, "Enable Matrix Timeframe 3", group=matrixGroupName, inline="matrixRow3")
matrixTF3 = input.timeframe("5", "", group=matrixGroupName, inline="matrixRow3")
matrixColumn1 = input.bool(true, "Show Avg True Range (ATR)", group=matrixGroupName)
matrixAtrLength = input.int(defval=3, minval=1, title="Avg True Range (ATR) Length", group=matrixGroupName)
matrixAtrColor = input.color(color.blue,'ATR Cell Color', group=matrixGroupName, inline="matrixAtrColors")
matrixAtrTextColor = input.color(color.white,'Text Color', group=matrixGroupName, inline="matrixAtrColors")
matrixColumn2 = input.bool(true, "Show Current Candle Column", group=matrixGroupName)
matrixColumn3 = input.bool(true, "Show Trend Column", group=matrixGroupName)
matrixColumn4 = input.bool(true, "Show Profit Wave Column", group=matrixGroupName)
matrixColumn5 = input.bool(true, "Show Money Flow Column", group=matrixGroupName)
matrixHeaderColor = input.color(color.black,'Header Cell Color', group=matrixGroupName, inline="matrixHeaderColors")
matrixHeaderTextColor = input.color(color.white,'Text Color', group=matrixGroupName, inline="matrixHeaderColors")
matrixBullishColor = input.color(color.green,'Bullish Cell Color', group=matrixGroupName, inline="matrixBullishColors")
matrixBullishTextColor = input.color(color.white,'Text Color', group=matrixGroupName, inline="matrixBullishColors")
matrixBearishColor = input.color(color.red,'Bearish Cell Color', group=matrixGroupName, inline="matrixBearishColors")
matrixBearishTextColor = input.color(color.white,'Text Color', group=matrixGroupName, inline="matrixBearishColors")
// Dashboard Inputs
var dashboardSettings = "----- Dashboard Settings -----"
positionMatrixOnTop = input.bool(true, "Show Matrix History Above Money Flow?", group=dashboardSettings)
enableMatrixDashboard1 = input.bool(true, "Enable Matrix History for Timeframe 1", group=dashboardSettings)
enableMatrixDashboard2 = input.bool(true, "Enable Matrix History for Timeframe 2", group=dashboardSettings)
enableMatrixDashboard3 = input.bool(true, "Enable Matrix History for Timeframe 3", group=dashboardSettings)
enableMatrixDashboardLabels = input.bool(true, "Enable Matrix Timeframe Labels", group=dashboardSettings)
enableDashboard = input.bool(true, "Enable Money Flow Display", group=dashboardSettings)
enableDashboardBuySellSignals = input.bool(false,title='Enable Buy & Sell Signals on Dashboard', group=dashboardSettings)
showInsideLines = input.bool(false, "Enable Level Lines", group=dashboardSettings)
levelLinesStyle = input.string("Solid", options= , title="Level Lines Style", group=dashboardSettings)
trendDotsSize = input.int(1, "trendSwitch Dots Size", minval=1, maxval=10, step=1, group=dashboardSettings)
crossoverDotsSize = input.int(3, "Signal Dots Size", minval=3, maxval=10, step=1, group=dashboardSettings)
mfiBullishColor = input.color(color.lime,'Money Flow Bullish Color', group=dashboardSettings)
mfiBearishColor = input.color(color.red,'Money Flow Bearish Color', group=dashboardSettings)
// Others
disableWarning := input.bool(false, title="Disable Heikin Ashi Warning", group="Other Settings")
// ----------------------------------------------------------------------------------------------------------------------------------
startTime = timestamp(year, month, dayofmonth, startHour, startMinute)
endTime = timestamp(year, month, dayofmonth, endHour, endMinute)
isValidTimeRange = (time >= startTime and time < endTime)
// ________ Price & Candle Logic ___________________________
var isHAChartType = chart.is_heikinashi
var label myLabel = na
labelDisplayed = false
var const string warningText = " ⚠️ WARNING!!! ⚠️ You MUST set the chart candle type to Heikin Ashi for the signals to display correctly. This message will disappear when you've done so. "
if not isHAChartType and not disableWarning and not labelDisplayed
enableBgColor := false
enableBuySellSignals := false
enableProfitLines := false
enableTrendCandleColoring := false
enableProfitWave := false
ensr := false
// plotrealsrcClosedots := false
middle_price = (high + low) / 2
visible_bar_count = bar_index - ta.valuewhen(time == chart.left_visible_bar_time, bar_index, 0)
middle_bar_index = bar_index
if na(myLabel)
myLabel := label.new(x=middle_bar_index, y=middle_price, text=warningText, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_center, color=color.red, textcolor=color.white, size=size.huge, textalign=text.align_center, force_overlay=true)
else
myLabel.set_x(middle_bar_index)
myLabel.set_y(middle_price)
labelDisplayed := true
else if isHAChartType or disableWarning
myLabel := na
srcHlc3 = hlc3
srcOpen = open
srcHigh = high
srcLow = low
srcClose = close
real_price = ticker.new(prefix=syminfo.prefix, ticker=syminfo.ticker)
real_close = request.security(symbol=real_price, timeframe='', expression=close, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)
profitWaveEmaFast = ta.ema(srcClose, 8)
profitWaveEmaMedium = ta.ema(srcClose, 13)
profitWaveEmaSlow = ta.ema(srcClose, 21)
chopSensitivity = 1
trueRange = math.max(math.max(high-low, math.abs(high-nz(close ))), math.abs(low-nz(close )))
diPlusCalculation = high-nz(high ) > nz(low )-low ? math.max(high-nz(high ), 0): 0
diMinusCalculation = nz(low )-low > high-nz(high ) ? math.max(nz(low )-low, 0): 0
smoothedTrueRange = 0.0
smoothedTrueRange := nz(smoothedTrueRange ) - (nz(smoothedTrueRange )/chopSensitivity) + trueRange
smoothedDiPlus = 0.0
smoothedDiPlus := nz(smoothedDiPlus ) - (nz(smoothedDiPlus )/chopSensitivity) + diPlusCalculation
smoothedDiMinus = 0.0
smoothedDiMinus := nz(smoothedDiMinus ) - (nz(smoothedDiMinus )/chopSensitivity) + diMinusCalculation
diPlus = smoothedDiPlus / smoothedTrueRange * 100
diMinus = smoothedDiMinus / smoothedTrueRange * 100
dx = math.abs(diPlus-diMinus) / (diPlus+diMinus)*100
ADX = ta.sma(dx, chopSensitivity)
GetTrendDirection(srcHigh, srcLow) =>
Up = (srcHigh + srcLow) / 2 - (1.3 * ta.atr(8))
Dn = (srcHigh + srcLow) / 2 + (1.3 * ta.atr(8))
float trendUp = na
float trendDown = na
trendSwitch = 0
trendUp := srcClose > trendUp ? math.max(Up,trendUp ) : Up
trendDown := srcClose < trendDown ? math.min(Dn,trendDown ) : Dn
trendSwitch := srcClose > trendDown ? 1: srcClose < trendUp ? -1: nz(trendSwitch ,1)
trendDirection = trendSwitch == 1 ? trendUp : trendDown
= GetTrendDirection(srcHigh, srcLow)
bullishTrend = trendDirection == trendUp
bearishTrend = trendDirection == trendDown
maFilter = switch maFilterType
"EMA" => ta.ema(srcClose, maFilterLength)
"SMA" => ta.sma(srcClose, maFilterLength)
"VWMA" => ta.vwma(srcClose, maFilterLength)
"RMA" => ta.rma(srcClose, maFilterLength)
"Hull" => ta.wma(2*ta.wma(srcClose, maFilterLength/2)-ta.wma(srcClose, maFilterLength), math.floor(math.sqrt(maFilterLength)))
=> na
plot(enableMaFilter ? maFilter : na, force_overlay=true, title = "Filter MA", color=maFilterColor, linewidth=2)
// ________ Background Trend Logic ___________________________
backgroundTrendColor = color.white
if (trendDirection == trendUp)
backgroundTrendColor := bgTrendBullishCol
else if (trendDirection == trendDown)
backgroundTrendColor := bgTrendBearishCol
else
backgroundTrendColor := backgroundTrendColor
bgcolor(enableBgColor ? backgroundTrendColor : na, force_overlay = true)
// Base Candle coloring
candleColor = color.gray
candleColor := if (srcClose > srcOpen)
bullishCandleColor
else if (srcClose < srcOpen)
bearishCandleColor
else
candleColor
if (enableTrendCandleColoring and candleColoringType == "Trend")
candleColor := if (backgroundTrendColor == bgTrendBullishCol)
bullishCandleColor
else if (backgroundTrendColor == bgTrendBearishCol)
bearishCandleColor
else
candleColor
else if (enableTrendCandleColoring and candleColoringType == "Profit Wave")
candleColor := if (real_close > profitWaveEmaSlow)
bullishCandleColor
else if (real_close < profitWaveEmaSlow)
bearishCandleColor
else
candleColor
plotcandle(srcOpen, srcHigh, srcLow, srcClose, "SMM Candles", color=candleColor, wickcolor=candleColor, bordercolor=candleColor, force_overlay=true)
// ________ Signals Logic ___________________________
var bool buySignal = false
var bool sellSignal = false
buySignal := trendDirection == trendUp
sellSignal := trendDirection == trendDown
mfl = ta.mfi(srcHlc3, 10)
enum Mode
buy = "Buy Mode"
sell = "Sell Mode"
none = "none"
var Mode currentMode = Mode.none
if (backgroundTrendColor != backgroundTrendColor )
currentMode := Mode.none
strongBullishCandle = srcClose > srcOpen and math.floor(srcOpen) == math.floor(srcLow) and real_close > profitWaveEmaFast and real_close > profitWaveEmaSlow
strongBearishCandle = srcClose < srcOpen and math.floor(srcOpen) == math.floor(srcHigh) and real_close < profitWaveEmaFast and real_close < profitWaveEmaSlow
realClosePriceText = enableBuySellPrice ? " $" + str.tostring(real_close, format.mintick) : ""
bool canBuy = true
bool canSell = true
if (enableChopFilter)
canBuy := math.floor(diPlus) > math.floor(diMinus) and math.floor(diPlus) >= 45
canSell := math.floor(diMinus) > math.floor(diPlus) and math.floor(diMinus) >= 45
else
canBuy := true
canSell := true
var int currentSignalBarIndex = na
// Bullish signals
maFilterBuy = enableMaFilter ? srcOpen > maFilter : true
mfiBuy = enableChopFilter ? mfl > 52 : true
buy_con = buySignal and backgroundTrendColor == bgTrendBullishCol and strongBullishCandle and currentMode != Mode.buy and mfiBuy and canBuy
if (buy_con and enableBuySellSignals)
currentMode := Mode.buy
if isValidTimeRange and maFilterBuy
label.new(bar_index, low, style=label.style_label_up, color=buySignalColor, size=size.normal, yloc=yloc.belowbar, text="Buy"+realClosePriceText, textcolor=color.white, force_overlay=true)
currentSignalBarIndex := bar_index
// Bearish signals
maFilterSell = enableMaFilter ? srcOpen < maFilter : true
mfiSell = enableChopFilter ? mfl < 52 : true
sell_con = sellSignal and backgroundTrendColor == bgTrendBearishCol and strongBearishCandle and currentMode != Mode.sell and mfiSell and canSell
if (sell_con and enableBuySellSignals)
currentMode := Mode.sell
if isValidTimeRange and maFilterSell
label.new(bar_index, high, style=label.style_label_down, color=sellSignalColor, size=size.normal, yloc=yloc.abovebar, text="Sell"+realClosePriceText, textcolor=color.white, force_overlay=true)
currentSignalBarIndex := bar_index
// Profit Target lines
var line targetLines = array.new_line(0)
var label targetLabels = array.new_label(0)
var float targetPrice = na
if (((buy_con and maFilterBuy) or (sell_con and maFilterSell)) and enableBuySellSignals and enableProfitLines)
if array.size(targetLines) >= profitTargetMaxLines
oldestLine = array.get(targetLines, 0)
oldestLabel = array.get(targetLabels, 0)
line.delete(oldestLine)
label.delete(oldestLabel)
array.remove(targetLines, 0)
array.remove(targetLabels, 0)
targetPrice := buy_con ? real_close + (profitTarget * syminfo.mintick) : sell_con ? real_close - (profitTarget * syminfo.mintick) : na
if isValidTimeRange
newLine = line.new(bar_index-7, targetPrice, bar_index + 5, targetPrice, color=profitTargetColor, width=2, force_overlay=true)
array.push(targetLines, newLine)
newLabel = label.new(bar_index-3, targetPrice, text="$"+str.tostring(targetPrice, format.mintick), style=label.style_none, textcolor=profitTargetColor, force_overlay=true)
array.push(targetLabels, newLabel)
// Reset for more signals within continuous trend
if (currentMode == Mode.buy and real_close < profitWaveEmaSlow and srcClose < profitWaveEmaSlow)
currentMode := Mode.none
currentSignalBarIndex := na
if (currentMode == Mode.sell and real_close > profitWaveEmaSlow and srcClose > profitWaveEmaSlow)
currentMode := Mode.none
currentSignalBarIndex := na
profitTargetCondition = if not na(currentSignalBarIndex) and bar_index > currentSignalBarIndex
currentMode == Mode.buy ? srcHigh >= targetPrice : currentMode == Mode.sell ? srcLow <= targetPrice : na
// Signal Alerts
alertcondition(condition=buy_con and canBuy,title='Buy alert', message='Buy')
alertcondition(condition=sell_con and canSell,title='Sell alert', message='Sell')
alertcondition(condition=enableBuySellSignals and enableProfitLines ? profitTargetCondition : na, title="Profit Target", message="Profit Target Hit!")
if profitTargetCondition
targetPrice := na
currentSignalBarIndex := na
// ________ Profit Wave Logic ___________________________
pwPlot1 = plot(enableProfitWave ? profitWaveEmaFast : na, title="Profit Wave Line 1", color=color.new(color.white, 100), linewidth=1, force_overlay = true)
pwPlot2 = plot(enableProfitWave ? profitWaveEmaMedium : na, title="Profit Wave Line 2", color=color.new(color.white, 100), linewidth=1, force_overlay = true)
pwPlot3 = plot(enableProfitWave ? profitWaveEmaSlow : na, title="Profit Wave Line 3", color=color.new(color.white, 100), linewidth=1, force_overlay = true)
pwUpperBullishColor = real_close > profitWaveEmaSlow ? profitWaveUpperBullishColor : color.new(color.lime, 100)
pwLowerBullishColor = real_close > profitWaveEmaSlow ? profitWaveLowerBullishColor : color.new(color.green, 100)
fill(pwPlot1, pwPlot2, pwUpperBullishColor)
fill(pwPlot2, pwPlot3, pwLowerBullishColor)
pwUpperBearishColor = real_close < profitWaveEmaSlow ? profitWaveUpperBearishColor : color.new(#ff0000, 100)
pwLowerBearishColor = real_close < profitWaveEmaSlow ? profitWaveLowerBearishColor : color.new(#8c0000, 100)
fill(pwPlot1, pwPlot2, pwUpperBearishColor)
fill(pwPlot2, pwPlot3, pwLowerBearishColor)
// ________ Support / Resistance Logic ___________________________
srLineStyle = switch srStyle
"Solid" => line.style_solid
"Dotted" => line.style_dotted
"Dashed" => line.style_dashed
// Identify pivot highs and pivot lows
pivotHigh = ta.pivothigh(srcHigh, pivotchopSensitivity, pivotchopSensitivity)
pivotLow = ta.pivotlow(srcLow, pivotchopSensitivity, pivotchopSensitivity)
// Initialize arrays to store the lines
var line resistanceLines = array.new_line(0)
var line supportLines = array.new_line(0)
var int resistanceTouchBars = array.new_int(0)
var int supportTouchBars = array.new_int(0)
lookbackchopSensitivity = 500
// Function to manage line limits (removing the oldest line if limit is exceeded)
f_manage_line_limit(array linesArray, array touchBarsArray) =>
if array.size(linesArray) > maxSrLines
// Delete the first (oldest) line
line.delete(array.shift(linesArray))
// Remove the first touch bar value
array.shift(touchBarsArray)
// Draw new resistance line if a new pivot high is detected
if (ensr and not na(pivotHigh) and bar_index >= bar_index - lookbackchopSensitivity)
pivotHighPrice = srcHigh
pivotHighBar = bar_index
resistanceLine = line.new(pivotHighBar, pivotHighPrice, bar_index + 1, pivotHighPrice, style=srLineStyle, width=srLineWidth, color=resistanceColor, extend=extend.right, force_overlay=true)
array.push(resistanceLines, resistanceLine)
array.push(resistanceTouchBars, na) // No touch yet
f_manage_line_limit(resistanceLines, resistanceTouchBars) // Manage the line limit
// Draw new support line if a new pivot low is detected
if (ensr and not na(pivotLow) and bar_index >= bar_index - lookbackchopSensitivity)
pivotLowPrice = srcLow
pivotLowBar = bar_index
supportLine = line.new(pivotLowBar, pivotLowPrice, bar_index + 1, pivotLowPrice, style=srLineStyle, width=srLineWidth, color=supportColor, extend=extend.right, force_overlay=true)
array.push(supportLines, supportLine)
array.push(supportTouchBars, na) // No touch yet
f_manage_line_limit(supportLines, supportTouchBars) // Manage the line limit
// Loop through the resistance lines and stop their extension if the price touches them
if array.size(resistanceLines) > 0
resLineStop = extendLinesType == 'Close' ? srcClose : srcHigh
for i = 0 to array.size(resistanceLines) - 1
line currentResistanceLine = array.get(resistanceLines, i)
resistancePrice = line.get_y1(currentResistanceLine)
touchBar = array.get(resistanceTouchBars, i)
// Update the line to the current candle unless already touched
if na(touchBar)
line.set_x2(currentResistanceLine, bar_index)
line.set_extend(currentResistanceLine, extend.none)
// Check if the price touches the resistance and we haven't already stopped the line
if na(touchBar) and resLineStop >= resistancePrice
line.set_x2(currentResistanceLine, bar_index)
line.set_extend(currentResistanceLine, extend.none)
array.set(resistanceTouchBars, i, bar_index) // Store the bar where the price touched
// Loop through the support lines and stop their extension if the price touches them
if array.size(supportLines) > 0
supLineStop = extendLinesType == 'Close' ? srcClose : srcLow
for i = 0 to array.size(supportLines) - 1
line currentSupportLine = array.get(supportLines, i)
supportPrice = line.get_y1(currentSupportLine)
touchBar = array.get(supportTouchBars, i)
// Update the line to the current candle unless already touched
if na(touchBar)
line.set_x2(currentSupportLine, bar_index)
line.set_extend(currentSupportLine, extend.none)
// Check if the price touches the support and we haven't already stopped the line
if na(touchBar) and supLineStop <= supportPrice
line.set_x2(currentSupportLine, bar_index)
line.set_extend(currentSupportLine, extend.none)
array.set(supportTouchBars, i, bar_index) // Store the bar where the price touched
// ________ Real Price Logic ___________________________Original open source code from Real Price + Dots by PHVNTOM_TRADER
showrealpricemicrodotsauto = (plotrealsrcClosedots and size=="Auto" ? display.all : display.none)
showrealpricemicrodotssmall = (plotrealsrcClosedots and size=="Small" ? display.all : display.none)
showrealpricedotslarge = (plotrealsrcClosedots and size=="Large" ? display.all : display.none)
_width = switch realpricewidth
"Thin" => 1
"Thick" => 2
// Real Price Line
if(showrealprice and (realpricestyle == "Solid"))
real_price_line = line.new(bar_index , real_close, bar_index, real_close, xloc.bar_index, (extendLine ? extend.both : extend.right), showrealpricelinecolor, line.style_solid, _width, force_overlay = true)
line.delete(real_price_line )
if(showrealprice and (realpricestyle == "Dotted"))
real_price_line = line.new(bar_index , real_close, bar_index, real_close, xloc.bar_index, (extendLine ? extend.both : extend.right), showrealpricelinecolor, line.style_dotted, _width, force_overlay = true)
line.delete(real_price_line )
if(showrealprice and (realpricestyle == "Dashed"))
real_price_line = line.new(bar_index , real_close, bar_index, real_close, xloc.bar_index, (extendLine ? extend.both : extend.right), showrealpricelinecolor, line.style_dashed, _width, force_overlay = true)
line.delete(real_price_line )
// Real Price srcClose Dots
plotchar(series=real_close, title="Real Close dots", location=location.absolute, color=realsrcClosecolour, editable=false, char="•", size=size.auto, display=showrealpricemicrodotsauto, force_overlay = true)
plotchar(series=real_close, title="Real Close dots", location=location.absolute, color=realsrcClosecolour, editable=false, char="•", size=size.tiny, display=showrealpricemicrodotssmall, force_overlay = true)
plotshape(series=real_close, title="Real Close dots", location=location.absolute, color=realsrcClosecolour, editable=false, style=shape.circle, size=size.auto, display=showrealpricedotslarge, force_overlay = true)
// ________ Dashboard Oscillator Logic ___________________________
hlineStyle = switch levelLinesStyle
"Dotted" => hline.style_dotted
"Dashed" => hline.style_dashed
=> hline.style_solid
top_1 = hline(enableDashboard ? 100 : na,color=color.new(#ff1b1b,50),linestyle=hline.style_solid)
top_2 = hline(enableDashboard ? 90 : na,color=color.new(#ff2626,50),linestyle=hline.style_solid)
top_3 = hline(enableDashboard ? 80 : na,color=color.new(#ff3f3f,50),linestyle=hline.style_solid)
top_4 = hline(showInsideLines and enableDashboard ? 70 : na,color=color.new(#ff5050,50),linestyle=hlineStyle)
top_5 = hline(showInsideLines and enableDashboard ? 60 : na,color=color.new(#ff6464,50),linestyle=hlineStyle)
top_6 = hline(showInsideLines and enableDashboard ? 50 : na,color=color.new(#ff6464,100),linestyle=hlineStyle)
bottom_1 = hline(enableDashboard ? 0 : na,color=color.new(#047200,50),linestyle=hline.style_solid)
bottom_2 = hline(enableDashboard ? 10 : na,color=color.new(#047e00,50),linestyle=hline.style_solid)
bottom_3 = hline(enableDashboard ? 20 : na,color=color.new(#048900,50),linestyle=hline.style_solid)
bottom_4 = hline(showInsideLines and enableDashboard ? 30 : na,color=color.new(#059f00,50),linestyle=hlineStyle)
bottom_5 = hline(showInsideLines and enableDashboard ? 40 : na,color=color.new(#06b200,50),linestyle=hlineStyle)
bottom_6 = hline(showInsideLines and enableDashboard ? 50 : na,color=color.new(#06b200,100),linestyle=hlineStyle)
fill(top_1, top_2, color=color.new(#ff1b1b,20), title="Overbought Extreme Background")
fill(top_2, top_3, color=color.new(#ff2626,40), title="Overbought Start Background")
fill(bottom_1, bottom_2, color=color.new(#047200,10), title="Oversold Start Background")
fill(bottom_3, bottom_2, color=color.new(#047e00,40), title="Oversold Extreme Background")
dotsColor = bullishTrend ? #66ff00 : #ff0000
plot(enableDashboard ? 50 : na,color=dotsColor,style= plot.style_circles, title="Dashboard Center Line trendSwitch Dots", linewidth=trendDotsSize)
plotDashboardBuy = buy_con and enableDashboardBuySellSignals and canBuy and isValidTimeRange and maFilterBuy
plotDashboardSell = sell_con and enableDashboardBuySellSignals and canSell and isValidTimeRange and maFilterSell
plotshape(plotDashboardBuy and enableDashboard ? 10 : na,title='Dashboard Buy Signal',style=shape.labelup,location=location.absolute,text='Buy',textcolor=color.white,color=buySignalColor)
plotshape(plotDashboardSell and enableDashboard ? 90 : na,title='Dashboard Sell Signal',style=shape.labeldown,location=location.absolute,text='Sell',textcolor=color.white,color=sellSignalColor)
mfiTrendColor = if (mfl > 50)
mfiBullishColor
else if (mfl < 50)
mfiBearishColor
else
color.white
plot(enableDashboard ? mfl : na, "Dashboard Money Flow Line", color=mfiTrendColor, style=plot.style_stepline)
plot(plotDashboardBuy and enableDashboard ? 50 : na, color=#66ff00, style=plot.style_circles,linewidth=crossoverDotsSize,title='Dashboard Crossover Up Dots')
plot(plotDashboardSell and enableDashboard ? 50 : na, color=#ff0000, style=plot.style_circles,linewidth=crossoverDotsSize,title='Dashboard Crossover Down Dots')
// ________ Matrix Data Table Logic ___________________________
getMatrixRealClose(ticker, timeframe) =>
request.security(ticker, timeframe, close, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)
getMatrixTrendData(timeframe) =>
= request.security(syminfo.tickerid, timeframe, GetTrendDirection(srcHigh, srcLow))
mBackgroundTrendColor = color.gray
mTrendTextColor = color.white
mTrendStatus = ""
if (mTrendDirection == mTrendUp)
mBackgroundTrendColor := matrixBullishColor
mTrendTextColor := matrixBullishTextColor
mTrendStatus := "Bullish"
else if (mTrendDirection == mTrendDown)
mBackgroundTrendColor := matrixBearishColor
mTrendTextColor := matrixBearishTextColor
mTrendStatus := "Bearish"
else
mBackgroundTrendColor := mBackgroundTrendColor
mTrendTextColor := mTrendTextColor
mTrendStatus := mTrendStatus
getMatrixProfitWaveData(timeframe, realClose) =>
mProfitWaveEmaSlow = request.security(syminfo.tickerid, timeframe, ta.ema(srcClose, 21))
mProfitWaveColor = color.gray
mProfitWaveTextColor = color.white
mProfitWaveStatus = ""
if realClose > mProfitWaveEmaSlow
mProfitWaveColor := color.new(matrixBullishColor,0)
mProfitWaveTextColor := matrixBullishTextColor
mProfitWaveStatus := "Bullish"
else if realClose < mProfitWaveEmaSlow
mProfitWaveColor := color.new(matrixBearishColor,0)
mProfitWaveTextColor := matrixBearishTextColor
mProfitWaveStatus := "Bearish"
else
mProfitWaveColor := mProfitWaveColor
mProfitWaveTextColor := mProfitWaveTextColor
mProfitWaveStatus := mProfitWaveStatus
getMatrixCandleData(timeframe, trendStatus, profitWaveStatus) =>
= request.security(syminfo.tickerid, timeframe, )
mCandleColor = color.gray
mCandleStatus = ""
if (mClose > mOpen)
mCandleColor := matrixBullishColor
mCandleStatus := "↑"
else if (mClose < mOpen)
mCandleColor := matrixBearishColor
mCandleStatus := "↓"
else
mCandleColor := mCandleColor
mCandleStatus := mCandleStatus
if (enableTrendCandleColoring and candleColoringType == "Trend")
if (trendStatus == "Bullish")
mCandleColor := matrixBullishColor
mCandleStatus := "↑"
else if (trendStatus == "Bearish")
mCandleColor := matrixBearishColor
mCandleStatus := "↓"
else
mCandleColor := mCandleColor
mCandleStatus := mCandleStatus
else if (enableTrendCandleColoring and candleColoringType == "Profit Wave")
if (profitWaveStatus == "Bullish")
mCandleColor := matrixBullishColor
mCandleStatus := "↑"
else if (profitWaveStatus == "Bearish")
mCandleColor := matrixBearishColor
mCandleStatus := "↓"
else
mCandleColor := mCandleColor
mCandleStatus := mCandleStatus
getMatrixMfiData(timeframe) =>
mMfi = request.security(syminfo.tickerid, timeframe, ta.mfi(srcHlc3, 10))
mMfiColor = color.gray
mMfiTextColor = color.white
mMfiStatus = ""
if (mMfi > 50)
mMfiColor := matrixBullishColor
mMfiTextColor := matrixBullishTextColor
mMfiStatus := "Bullish"
else if (mMfi < 50)
mMfiColor := matrixBearishColor
mMfiTextColor := matrixBearishTextColor
mMfiStatus := "Bearish"
else
mMfiColor := mMfiColor
mMfiTextColor := mMfiTextColor
mMfiStatus := mMfiStatus
getMatrixAtr(timeframe) =>
atrValue = request.security(syminfo.tickerid, timeframe, ta.atr(matrixAtrLength))
str.tostring(atrValue, "#.#")
getMatrixHeaderCol(col) =>
matrixStyle == "Vertical" ? 0 : col
getMatrixHeaderRow(row) =>
matrixStyle == "Vertical" ? row : 0
getMatrixTfCol(col) =>
matrixStyle == "Vertical" ? col : 0
getMatrixTfRow(tf, row) =>
matrixStyle == "Vertical" ? row : tf
getMatrixDataCol(tf, col) =>
matrixStyle == "Vertical" ? tf : col
getMatrixDataRow(tf, row) =>
matrixStyle == "Vertical" ? row : tf
m1RealClose = getMatrixRealClose(real_price, matrixTF1)
= getMatrixTrendData(matrixTF1)
= getMatrixProfitWaveData(matrixTF1, m1RealClose)
= getMatrixMfiData(matrixTF1)
m2RealClose = getMatrixRealClose(real_price, matrixTF2)
= getMatrixTrendData(matrixTF2)
= getMatrixProfitWaveData(matrixTF2, m2RealClose)
= getMatrixMfiData(matrixTF2)
m3RealClose = getMatrixRealClose(real_price, matrixTF3)
= getMatrixTrendData(matrixTF3)
= getMatrixProfitWaveData(matrixTF3, m3RealClose)
= getMatrixMfiData(matrixTF3)
if enableMatrixTF1 or enableMatrixTF2 or enableMatrixTF3
tablePosition = switch matrixPosition
"Top Left" => position.top_left
"Top Center" => position.top_center
"Top Right" => position.top_right
"Bottom Left" => position.bottom_left
"Bottom Center" => position.bottom_center
=> position.bottom_right
var columns = 6
var rows = 4
if matrixStyle == "Vertical"
columns := 4
rows := 6
var table matrixDataTable = table.new(position=tablePosition, columns=columns, rows=rows, frame_color=color.gray, frame_width=1, border_width=1, bgcolor=color.new(color.gray, 0), force_overlay=true)
table.cell(matrixDataTable, 0, 0, text="TimeFrame", text_color=matrixHeaderTextColor, bgcolor=matrixHeaderColor)
if matrixColumn1
atrText = "ATR(" + str.tostring(matrixAtrLength) + ")"
table.cell(matrixDataTable, getMatrixHeaderCol(1), getMatrixHeaderRow(1), text=atrText, text_color=matrixHeaderTextColor, bgcolor=matrixHeaderColor)
if matrixColumn2
table.cell(matrixDataTable, getMatrixHeaderCol(2), getMatrixHeaderRow(2), text="Candle", text_color=matrixHeaderTextColor, bgcolor=matrixHeaderColor)
if matrixColumn3
table.cell(matrixDataTable, getMatrixHeaderCol(3), getMatrixHeaderRow(3), text="Background", text_color=matrixHeaderTextColor, bgcolor=matrixHeaderColor)
if matrixColumn4
table.cell(matrixDataTable, getMatrixHeaderCol(4), getMatrixHeaderRow(4), text="Profit Wave", text_color=matrixHeaderTextColor, bgcolor=matrixHeaderColor)
if matrixColumn5
table.cell(matrixDataTable, getMatrixHeaderCol(5), getMatrixHeaderRow(5), text="Money Flow", text_color=matrixHeaderTextColor, bgcolor=matrixHeaderColor)
if enableMatrixTF1
m1Atr = getMatrixAtr(matrixTF1)
= getMatrixCandleData(matrixTF1, m1TrendStatus, m1ProfitWaveStatus)
table.cell(matrixDataTable, getMatrixTfCol(1), getMatrixTfRow(1, 0), text=matrixTF1, text_color=matrixTimeframeTextColor, bgcolor=matrixTimeframeColor)
if matrixColumn1
table.cell(matrixDataTable, getMatrixDataCol(1,1), getMatrixDataRow(1,1), text=m1Atr, text_color=matrixAtrTextColor, bgcolor=matrixAtrColor)
if matrixColumn2
table.cell(matrixDataTable, getMatrixDataCol(1,2), getMatrixDataRow(1,2), text=m1CandleStatus, text_color=color.white, bgcolor=m1CandleColor)
if matrixColumn3
table.cell(matrixDataTable, getMatrixDataCol(1,3), getMatrixDataRow(1,3), text=m1TrendStatus, text_color=m1TrendTextColor, bgcolor=color.new(m1BackgroundTrendColor,0))
if matrixColumn4
table.cell(matrixDataTable, getMatrixDataCol(1,4), getMatrixDataRow(1,4), text=m1ProfitWaveStatus, text_color=m1ProfitWaveTextColor, bgcolor=m1ProfitWaveColor)
if matrixColumn5
table.cell(matrixDataTable, getMatrixDataCol(1,5), getMatrixDataRow(1,5), text=m1MfiStatus, text_color=m1MfiTextColor, bgcolor=m1MfiColor)
if enableMatrixTF2
m2Atr = getMatrixAtr(matrixTF2)
= getMatrixCandleData(matrixTF2, m2TrendStatus, m2ProfitWaveStatus)
table.cell(matrixDataTable, getMatrixTfCol(2), getMatrixTfRow(2, 0), text=matrixTF2, text_color=matrixTimeframeTextColor, bgcolor=matrixTimeframeColor)
if matrixColumn1
table.cell(matrixDataTable, getMatrixDataCol(2,1), getMatrixDataRow(2,1), text=m2Atr, text_color=matrixAtrTextColor, bgcolor=matrixAtrColor)
if matrixColumn2
table.cell(matrixDataTable, getMatrixDataCol(2,2), getMatrixDataRow(2,2), text=m2CandleStatus, text_color=color.white, bgcolor=m2CandleColor)
if matrixColumn3
table.cell(matrixDataTable, getMatrixDataCol(2,3), getMatrixDataRow(2,3), text=m2TrendStatus, text_color=m2TrendTextColor, bgcolor=color.new(m2BackgroundTrendColor,0))
if matrixColumn4
table.cell(matrixDataTable, getMatrixDataCol(2,4), getMatrixDataRow(2,4), text=m2ProfitWaveStatus, text_color=m2ProfitWaveTextColor, bgcolor=m2ProfitWaveColor)
if matrixColumn5
table.cell(matrixDataTable, getMatrixDataCol(2,5), getMatrixDataRow(2,5), text=m2MfiStatus, text_color=m2MfiTextColor, bgcolor=m2MfiColor)
if enableMatrixTF3
m3Atr = getMatrixAtr(matrixTF3)
= getMatrixCandleData(matrixTF3, m3TrendStatus, m3ProfitWaveStatus)
table.cell(matrixDataTable, getMatrixTfCol(3), getMatrixTfRow(3, 0), text=matrixTF3, text_color=matrixTimeframeTextColor, bgcolor=matrixTimeframeColor)
if matrixColumn1
table.cell(matrixDataTable, getMatrixDataCol(3,1), getMatrixDataRow(3,1), text=m3Atr, text_color=matrixAtrTextColor, bgcolor=matrixAtrColor)
if matrixColumn2
table.cell(matrixDataTable, getMatrixDataCol(3,2), getMatrixDataRow(3,2), text=m3CandleStatus, text_color=color.white, bgcolor=m3CandleColor)
if matrixColumn3
table.cell(matrixDataTable, getMatrixDataCol(3,3), getMatrixDataRow(3,3), text=m3TrendStatus, text_color=m3TrendTextColor, bgcolor=color.new(m3BackgroundTrendColor,0))
if matrixColumn4
table.cell(matrixDataTable, getMatrixDataCol(3,4), getMatrixDataRow(3,4), text=m3ProfitWaveStatus, text_color=m3ProfitWaveTextColor, bgcolor=m3ProfitWaveColor)
if matrixColumn5
table.cell(matrixDataTable, getMatrixDataCol(3,5), getMatrixDataRow(3,5), text=m3MfiStatus, text_color=m3MfiTextColor, bgcolor=m3MfiColor)
lw_plots = 4
plotStyle = plot.style_stepline
var int md1Trend = enableMatrixDashboard1 ? -10 : 0
var int md1Profit = enableMatrixDashboard1 ? -15 : 0
var int md1Mfi = enableMatrixDashboard1 ? -20 : 0
var int md2Trend = enableMatrixDashboard2 ? md1Mfi - 10 : md1Trend
var int md2Profit = enableMatrixDashboard2 ? md2Trend - 5 : md1Profit
var int md2Mfi = enableMatrixDashboard2 ? md2Profit - 5 : md1Mfi
var int md3Trend = enableMatrixDashboard3 ? md2Mfi - 10 : 0
var int md3Profit = enableMatrixDashboard3 ? md3Trend - 5 : 0
var int md3Mfi = enableMatrixDashboard3 ? md3Profit - 5 : 0
if positionMatrixOnTop
md1Trend := enableMatrixDashboard1 ? md1Profit + 5 : 100
md1Profit := enableMatrixDashboard1 ? md1Mfi + 5 : 100
md1Mfi := enableMatrixDashboard1 ? md2Trend + 10 : 100
md2Trend := enableMatrixDashboard2 ? md2Profit + 5 : md3Trend
md2Profit := enableMatrixDashboard2 ? md2Mfi + 5 : md3Profit
md2Mfi := enableMatrixDashboard2 ? md3Trend + 10 : md3Mfi
md3Trend := enableMatrixDashboard3 ? 120 : 100
md3Profit := enableMatrixDashboard3 ? 115 : 100
md3Mfi := enableMatrixDashboard3 ? 110 : 100
var label md1TrendLabel = na
var label md1ProfitLabel = na
var label md1MfiLabel = na
var label md2TrendLabel = na
var label md2ProfitLabel = na
var label md2MfiLabel = na
var label md3TrendLabel = na
var label md3ProfitLabel = na
var label md3MfiLabel = na
if barstate.islast and enableMatrixDashboardLabels
if enableMatrixDashboard1 and na(md1TrendLabel)
md1TrendLabel := label.new(x=bar_index , y=md1Trend, text="Background - "+matrixTF1, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
md1ProfitLabel := label.new(x=bar_index , y=md1Profit, text="Profit Wave - "+matrixTF1, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
md1MfiLabel := label.new(x=bar_index , y=md1Mfi, text="Money Flow - "+matrixTF1, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
else if enableMatrixDashboard1
label.set_x(md1TrendLabel, bar_index )
label.set_x(md1ProfitLabel, bar_index )
label.set_x(md1MfiLabel, bar_index )
if enableMatrixDashboard2 and na(md2TrendLabel)
md2TrendLabel := label.new(x=bar_index , y=md2Trend, text="Background - "+matrixTF2, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
md2ProfitLabel := label.new(x=bar_index , y=md2Profit, text="Profit Wave - "+matrixTF2, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
md2MfiLabel := label.new(x=bar_index , y=md2Mfi, text="Money Flow - "+matrixTF2, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
else if enableMatrixDashboard2
label.set_x(md2TrendLabel, bar_index )
label.set_x(md2ProfitLabel, bar_index )
label.set_x(md2MfiLabel, bar_index )
if enableMatrixDashboard3 and na(md3TrendLabel)
md3TrendLabel := label.new(x=bar_index , y=md3Trend, text="Background - "+matrixTF3, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
md3ProfitLabel := label.new(x=bar_index , y=md3Profit, text="Profit Wave - "+matrixTF3, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
md3MfiLabel := label.new(x=bar_index , y=md3Mfi, text="Money Flow - "+matrixTF3, style=label.style_label_left, textcolor=color.white, color=color.new(color.white, 100), size=size.tiny)
else if enableMatrixDashboard3
label.set_x(md3TrendLabel, bar_index )
label.set_x(md3ProfitLabel, bar_index )
label.set_x(md3MfiLabel, bar_index )
else
label.delete(md1TrendLabel)
md1TrendLabel := na
label.delete(md1ProfitLabel)
md1ProfitLabel := na
label.delete(md1MfiLabel)
md1MfiLabel := na
label.delete(md2TrendLabel)
md2TrendLabel := na
label.delete(md2ProfitLabel)
md2ProfitLabel := na
label.delete(md2MfiLabel)
md2MfiLabel := na
label.delete(md3TrendLabel)
md3TrendLabel := na
label.delete(md3ProfitLabel)
md3ProfitLabel := na
label.delete(md3MfiLabel)
md3MfiLabel := na
plot(series=enableMatrixDashboard1 ? md1Trend : na, title="Trend", color=m1BackgroundTrendColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard1 ? md1Profit : na, title="Profit Wave", color=m1ProfitWaveColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard1 ? md1Mfi : na, title="MFI", color=m1MfiColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard2 ? md2Trend : na, title="Trend 2", color=m2BackgroundTrendColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard2 ? md2Profit : na, title="Profit Wave 2", color=m2ProfitWaveColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard2 ? md2Mfi : na, title="MFI 2", color=m2MfiColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard3 ? md3Trend : na, title="Trend 3", color=m3BackgroundTrendColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard3 ? md3Profit : na, title="Profit Wave 3", color=m3ProfitWaveColor, linewidth=lw_plots, style=plotStyle, editable=false)
plot(series=enableMatrixDashboard3 ? md3Mfi : na, title="MFI 3", color=m3MfiColor, linewidth=lw_plots, style=plotStyle, editable=false)
USDT.D + USDT.C ALL TIMEFRAMESThis indicator combines the dominance of USDT (USDT.D) and USDC (USDC.D) to track total stablecoin market share across all timeframes. It displays the combined dominance as candlesticks, providing a clearer view of market liquidity shifts and investor sentiment.
📌 How to Use:
Green candles indicate rising stablecoin dominance (potential risk-off sentiment).
Red candles indicate declining stablecoin dominance (potential risk-on sentiment).
Works on all timeframes, from intraday scalping to macro trend analysis.
This tool is essential for traders looking to analyze stablecoin liquidity flow, identify market turning points, and refine trading strategies based on stablecoin dominance behavior. 🚀
Highlight Specific Candles hi this indicator helps ni highlighting any partcular day or particular candle
this is helpful in studying the tred and chart for analysis.
Custom MA Crossover (1-10min)//@version=5
indicator("Custom MA Crossover (1-10min)", overlay=true, shorttitle="CMA Cross 1-10min")
// Inputs
fast_length = input.int(5, title="Fast MA Length", minval=1) // Adjusted for shorter timeframes
slow_length = input.int(14, title="Slow MA Length", minval=1) // Adjusted for shorter timeframes
ma_type = input.string(title="MA Type", options= , defval="EMA")
use_timeframe_filter = input.bool(true, title="Restrict to 1-10min Timeframes?")
volume_filter = input.bool(true, title="Use Volume Filter?")
min_volume = input.float(1.5, title="Minimum Volume Multiplier", step=0.1) // Filter for higher volume candles
// Timeframe Check
is_allowed_timeframe = (timeframe.isminutes and timeframe.multiplier >= 1 and timeframe.multiplier <= 10) or not use_timeframe_filter
// Calculations
fast_ma = ma_type == "SMA" ? ta.sma(close, fast_length) : ta.ema(close, fast_length)
slow_ma = ma_type == "SMA" ? ta.sma(close, slow_length) : ta.ema(close, slow_length)
// Volume Filter
volume_avg = ta.sma(volume, 20) // 20-period average volume
is_high_volume = volume >= volume_avg * min_volume
// Crossover signals with filters
bullish = ta.crossover(fast_ma, slow_ma) and is_allowed_timeframe and (not volume_filter or is_high_volume)
bearish = ta.crossunder(fast_ma, slow_ma) and is_allowed_timeframe and (not volume_filter or is_high_volume)
// Plotting
plot(fast_ma, color=color.new(color.blue, 0), title="Fast MA")
plot(slow_ma, color=color.new(color.red, 0), title="Slow MA")
// Plot signals
plotshape(bullish, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Bullish Signal")
plotshape(bearish, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Bearish Signal")
// Alerts
alertcondition(bullish, title="Bullish Crossover", message="Fast MA crossed above Slow MA on a 1-10min chart")
alertcondition(bearish, title="Bearish Crossover", message="Fast MA crossed below Slow MA on a 1-10min chart")