// ***************************************** 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/l/ddcud // // ****************************************************************************************************
// ________ Rules and FAQ text ___________________________ var const string titleRules = "***** Simple Market Metrics Trading Rules *****" var const string signalRules = "\n\n1. How to enter a trade:\n• Wait for a Buy or Sell signal to appear" var const string entryRules = "\n• If the signal remains when the candle closes, enter the trade with a market or limit order"
var const string tpRules = "\n\n2. How to exit a trade:\n• Take profit when the price reaches the profit target line" var const string exitRules = "\n• 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 = "\n\ne.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 = "\n\n1. What markets can this be traded with?\n• 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 = "\n\n2. What candle type should be used?\n• Simple Market Metrics was designed to be used on Heikin Ashi candles." var const string faq3 = "\n\n3. What are the preferred trading hours?\n• The preferred hours to trade are during the New York session between 10:00am EST and 3:00pm EST." var const string faq4 = "\n\n4. What timeframe should I trade?\n• The 1 and 2 minute timeframes are preferred with ES & NQ Futures" var const string faq5 = "\n\n5. What should I set the profit targets to?\n• ES - 1 min: 4\n• ES - 2 min: 8\n• NQ - 1 min: 20\n• NQ - 2 min: 40" var const string faq6 = "\n\n6. How many contracts should I start trading with prop firm accounts?\n• 50k - 5 micros on MES or MNQ \n• 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:\n\nThe 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 = "\n\nAlthough 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 = "\n\nTrading is risky, do not trade with money you are not comfortable losing.\nControl your risk by managing your position size accordingly, and please practice on a sim account before using real money." var const string finalNotes3 = "\n\nIf you need further assistance, contact us at simplemarketmetricsgmail.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")
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.')
// 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
// 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<line> linesArray, array<int> 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[pivotchopSensitivity] >= bar_index - lookbackchopSensitivity) pivotHighPrice = srcHigh[pivotchopSensitivity] pivotHighBar = bar_index[pivotchopSensitivity] 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[pivotchopSensitivity] >= bar_index - lookbackchopSensitivity) pivotLowPrice = srcLow[pivotchopSensitivity] pivotLowBar = bar_index[pivotchopSensitivity] 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)
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 ___________________________
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publications is governed by House rules. 您可以收藏它以在圖表上使用。