OPEN-SOURCE SCRIPT
PRO Trade Manager

//version=5
indicator("PRO Trade Manager", shorttitle="PRO Trade Manager", overlay=false)
// ============================================================================
// INPUTS
//This code and all related materials are the exclusive property of Trade Confident LLC. Any reproduction, distribution, modification, or unauthorized use of this code, in whole or in part, is strictly prohibited without the express written consent of Trade Confident LLC. Violations may result in civil and/or criminal penalties to the fullest extent of the law.
// © Trade Confident LLC. All rights reserved.
// ============================================================================
// Moving Average Settings
maLength = input.int(15, "Signal Strength", minval=1, tooltip="Length of the moving average to measure deviation from (lower = more sensitive)")
maType = "SMA" // Fixed to SMA, no longer user-selectable
// Deviation Settings
deviationLength = input.int(20, "Deviation Period", minval=1, tooltip="Lookback period for standard deviation calculation")
// Signal Frequency dropdown - controls both upper and lower thresholds
signalFrequency = input.string("More/Good Accuracy", "Signal Frequency", options=["Normal/Highest Accuracy", "More/Good Accuracy", "Most/Moderate Accuracy"],
tooltip="Normal/Highest Accuracy = ±2.0 StdDev | More/Good Accuracy = ±1.5 StdDev | Most/Moderate Accuracy = ±1.0 StdDev")
// Set thresholds based on selected frequency
upperThreshold = signalFrequency == "Most/Moderate Accuracy" ? 1.0 : signalFrequency == "More/Good Accuracy" ? 1.5 : 2.0
lowerThreshold = signalFrequency == "Most/Moderate Accuracy" ? -1.0 : signalFrequency == "More/Good Accuracy" ? -1.5 : -2.0
// Continuation Signal Settings
atrMultiplier = input.float(2.0, "TP/DCA Market Breakout Detection", minval=0, step=0.5, tooltip="Number of ATR moves required to trigger continuation signals (Set to 0 to disable)")
// Visual Settings
showMA = false // MA display removed from settings
showSignals = input.bool(true, "Show Alert Signals", tooltip="Show visual signals when price is overextended")
// ============================================================================
// CALCULATIONS
// ============================================================================
// Calculate Moving Average based on type
ma = switch maType
"SMA" => ta.sma(close, maLength)
"EMA" => ta.ema(close, maLength)
"WMA" => ta.wma(close, maLength)
"VWMA" => ta.vwma(close, maLength)
=> ta.sma(close, maLength)
// Calculate deviation from MA
deviation = close - ma
// Calculate standard deviation
stdDev = ta.stdev(close, deviationLength)
// Calculate number of standard deviations away from MA
deviationScore = stdDev != 0 ? deviation / stdDev : 0
// Smooth the deviation score slightly for cleaner signals
smoothedDeviation = ta.ema(deviationScore, 3)
// ============================================================================
// SIGNALS
// ============================================================================
// Overextended conditions
overextendedHigh = smoothedDeviation >= upperThreshold
overextendedLow = smoothedDeviation <= lowerThreshold
// Signal triggers (crossing into overextended territory)
bullishSignal = ta.crossunder(smoothedDeviation, lowerThreshold)
bearishSignal = ta.crossover(smoothedDeviation, upperThreshold)
// Track if we're in bright histogram zones
isBrightGreen = smoothedDeviation <= lowerThreshold
isBrightRed = smoothedDeviation >= upperThreshold
// Track if we were in bright zone on previous bar
wasBrightGreen = smoothedDeviation[1] <= lowerThreshold
wasBrightRed = smoothedDeviation[1] >= upperThreshold
// Detect oscillator turning up after bright green (buy signal)
// Trigger if we were in bright green and oscillator turns up, even if no longer bright green
oscillatorTurningUp = smoothedDeviation > smoothedDeviation[1]
buySignal = barstate.isconfirmed and wasBrightGreen and oscillatorTurningUp and smoothedDeviation[1] <= smoothedDeviation[2]
// Detect oscillator turning down after bright red (sell signal)
// Trigger if we were in bright red and oscillator turns down, even if no longer bright red
oscillatorTurningDown = smoothedDeviation < smoothedDeviation[1]
sellSignal = barstate.isconfirmed and wasBrightRed and oscillatorTurningDown and smoothedDeviation[1] >= smoothedDeviation[2]
// ============================================================================
// ATR-BASED CONTINUATION SIGNALS
// ============================================================================
// Calculate ATR for distance measurement
atrLength = 14
atr = ta.atr(atrLength)
// Track price levels when ANY sell or buy signal occurs (original or continuation)
var float lastSellPrice = na
var float lastBuyPrice = na
// Initialize tracking on original signals
if sellSignal
lastSellPrice := close
if buySignal
lastBuyPrice := close
// Continuation Sell Signal: Price moved up by ATR multiplier from last red dot
// Disabled when atrMultiplier is set to 0
continuationSell = atrMultiplier > 0 and barstate.isconfirmed and not na(lastSellPrice) and close >= lastSellPrice + (atrMultiplier * atr)
// Continuation Buy Signal: Price moved down by ATR multiplier from last green dot
// Disabled when atrMultiplier is set to 0
continuationBuy = atrMultiplier > 0 and barstate.isconfirmed and not na(lastBuyPrice) and close <= lastBuyPrice - (atrMultiplier * atr)
// Update reference prices when continuation signals trigger (reset the 3 ATR counter)
if continuationSell
lastSellPrice := close
if continuationBuy
lastBuyPrice := close
// Combine original and continuation signals for plotting
allBuySignals = buySignal or continuationBuy
allSellSignals = sellSignal or continuationSell
// Track if a signal occurred to keep it visible on dashboard
// Signals trigger at barstate.isconfirmed (bar close)
var bool showBuyOnDashboard = false
var bool showSellOnDashboard = false
// Update dashboard flags immediately when signals occur
if allBuySignals
showBuyOnDashboard := true
showSellOnDashboard := false
else if allSellSignals
showSellOnDashboard := true
showBuyOnDashboard := false
else if barstate.isconfirmed
// Reset flags on bar close if no new signal
showBuyOnDashboard := false
showSellOnDashboard := false
// ============================================================================
// PLOTTING
// ============================================================================
// Professional color scheme
var color colorBullish = #00C853 // Professional green
var color colorBearish = #FF1744 // Professional red
var color colorNeutral = #2962FF // Professional blue
var color colorGrid = #363A45 // Dark gray for lines
var color colorBackground = #1E222D // Chart background
// Dynamic line color based on value
lineColor = smoothedDeviation > upperThreshold ? colorBearish :
smoothedDeviation < lowerThreshold ? colorBullish :
smoothedDeviation > 0 ? color.new(colorBearish, 50) :
color.new(colorBullish, 50)
// Plot the deviation oscillator with dynamic coloring
plot(smoothedDeviation, "Deviation Score", color=lineColor, linewidth=2)
// Plot zero line
hline(0, "Zero Line", color=color.new(colorGrid, 0), linestyle=hline.style_solid, linewidth=1)
// Subtle fill for overextended zones (without visible threshold lines)
upperLine = hline(upperThreshold, "Upper Threshold", color=color.new(color.gray, 100), linestyle=hline.style_dashed, linewidth=1)
lowerLine = hline(lowerThreshold, "Lower Threshold", color=color.new(color.gray, 100), linestyle=hline.style_dashed, linewidth=1)
fill(upperLine, hline(3), color=color.new(colorBearish, 95), title="Overextended High Zone")
fill(lowerLine, hline(-3), color=color.new(colorBullish, 95), title="Overextended Low Zone")
// Histogram style visualization (optional alternative)
histogramColor = smoothedDeviation >= upperThreshold ? color.new(colorBearish, 20) :
smoothedDeviation <= lowerThreshold ? color.new(colorBullish, 20) :
smoothedDeviation > 0 ? color.new(colorBearish, 80) :
color.new(colorBullish, 80)
plot(smoothedDeviation, "Histogram", color=histogramColor, style=plot.style_histogram, linewidth=3)
// ============================================================================
// BUY/SELL SIGNAL MARKERS
// ============================================================================
// Plot buy signals at -3.5 level (includes both initial and extended signals)
plot(allBuySignals ? -3.5 : na, title="Buy Signal", style=plot.style_circles,
color=color.new(colorBullish, 0), linewidth=4)
// Plot sell signals at 3.5 level (includes both initial and extended signals)
plot(allSellSignals ? 3.5 : na, title="Sell Signal", style=plot.style_circles,
color=color.new(colorBearish, 0), linewidth=4)
// ============================================================================
// ALERTS - SIMPLIFIED TO ONLY TWO ALERTS
// ============================================================================
// Alert 1: Long Entry/Short TP - fires on ANY green dot (original or continuation)
alertcondition(allBuySignals, "Long Entry/Short TP", "Long Entry/Short TP")
// Alert 2: Long TP/Short Entry - fires on ANY red dot (original or continuation)
alertcondition(allSellSignals, "Long TP/Short Entry", "Long TP/Short Entry")
// ============================================================================
// DATA DISPLAY
// ============================================================================
// Create a professional table for current readings
var color tableBgColor = #1a2332 // Dark blue background
var table infoTable = table.new(position.middle_right, 2, 2, border_width=1,
border_color=color.new(#2962FF, 30),
frame_width=1,
frame_color=color.new(#2962FF, 30))
if barstate.islast
// Determine status
statusText = overextendedHigh ? "OVEREXTENDED ↓" :
overextendedLow ? "OVEREXTENDED ↑" :
smoothedDeviation > 0 ? "Buyers In Control" : "Sellers In Control"
statusColor = overextendedHigh ? color.new(colorBearish, 0) :
overextendedLow ? color.new(colorBullish, 0) :
color.white
// Background color for status cell
statusBgColor = color.new(tableBgColor, 0)
// Status Row
table.cell(infoTable, 0, 0, "Status",
bgcolor=color.new(tableBgColor, 0),
text_color=color.white,
text_size=size.normal)
table.cell(infoTable, 1, 0, statusText,
bgcolor=statusBgColor,
text_color=statusColor,
text_size=size.normal)
// Signal Row - always show
table.cell(infoTable, 0, 1, "Signal",
bgcolor=color.new(tableBgColor, 0),
text_color=color.white,
text_size=size.normal)
// Show signal if flags are set (will stay visible during the bar)
if showBuyOnDashboard or showSellOnDashboard
// Green dot (buy signal) = "Long Entry/Short TP" with arrow up, white text on green background
// Red dot (sell signal) = "Long TP/Short Entry" with arrow down, white text on red background
signalText = showBuyOnDashboard ? "↑ Long Entry/Short TP" : "↓ Long TP/Short Entry"
signalColor = showBuyOnDashboard ? color.new(colorBullish, 0) : color.new(colorBearish, 0)
table.cell(infoTable, 1, 1, signalText,
bgcolor=signalColor,
text_color=color.white,
text_size=size.normal)
else
table.cell(infoTable, 1, 1, "Watching...",
bgcolor=color.new(tableBgColor, 0),
text_color=color.new(color.white, 60),
text_size=size.normal)
indicator("PRO Trade Manager", shorttitle="PRO Trade Manager", overlay=false)
// ============================================================================
// INPUTS
//This code and all related materials are the exclusive property of Trade Confident LLC. Any reproduction, distribution, modification, or unauthorized use of this code, in whole or in part, is strictly prohibited without the express written consent of Trade Confident LLC. Violations may result in civil and/or criminal penalties to the fullest extent of the law.
// © Trade Confident LLC. All rights reserved.
// ============================================================================
// Moving Average Settings
maLength = input.int(15, "Signal Strength", minval=1, tooltip="Length of the moving average to measure deviation from (lower = more sensitive)")
maType = "SMA" // Fixed to SMA, no longer user-selectable
// Deviation Settings
deviationLength = input.int(20, "Deviation Period", minval=1, tooltip="Lookback period for standard deviation calculation")
// Signal Frequency dropdown - controls both upper and lower thresholds
signalFrequency = input.string("More/Good Accuracy", "Signal Frequency", options=["Normal/Highest Accuracy", "More/Good Accuracy", "Most/Moderate Accuracy"],
tooltip="Normal/Highest Accuracy = ±2.0 StdDev | More/Good Accuracy = ±1.5 StdDev | Most/Moderate Accuracy = ±1.0 StdDev")
// Set thresholds based on selected frequency
upperThreshold = signalFrequency == "Most/Moderate Accuracy" ? 1.0 : signalFrequency == "More/Good Accuracy" ? 1.5 : 2.0
lowerThreshold = signalFrequency == "Most/Moderate Accuracy" ? -1.0 : signalFrequency == "More/Good Accuracy" ? -1.5 : -2.0
// Continuation Signal Settings
atrMultiplier = input.float(2.0, "TP/DCA Market Breakout Detection", minval=0, step=0.5, tooltip="Number of ATR moves required to trigger continuation signals (Set to 0 to disable)")
// Visual Settings
showMA = false // MA display removed from settings
showSignals = input.bool(true, "Show Alert Signals", tooltip="Show visual signals when price is overextended")
// ============================================================================
// CALCULATIONS
// ============================================================================
// Calculate Moving Average based on type
ma = switch maType
"SMA" => ta.sma(close, maLength)
"EMA" => ta.ema(close, maLength)
"WMA" => ta.wma(close, maLength)
"VWMA" => ta.vwma(close, maLength)
=> ta.sma(close, maLength)
// Calculate deviation from MA
deviation = close - ma
// Calculate standard deviation
stdDev = ta.stdev(close, deviationLength)
// Calculate number of standard deviations away from MA
deviationScore = stdDev != 0 ? deviation / stdDev : 0
// Smooth the deviation score slightly for cleaner signals
smoothedDeviation = ta.ema(deviationScore, 3)
// ============================================================================
// SIGNALS
// ============================================================================
// Overextended conditions
overextendedHigh = smoothedDeviation >= upperThreshold
overextendedLow = smoothedDeviation <= lowerThreshold
// Signal triggers (crossing into overextended territory)
bullishSignal = ta.crossunder(smoothedDeviation, lowerThreshold)
bearishSignal = ta.crossover(smoothedDeviation, upperThreshold)
// Track if we're in bright histogram zones
isBrightGreen = smoothedDeviation <= lowerThreshold
isBrightRed = smoothedDeviation >= upperThreshold
// Track if we were in bright zone on previous bar
wasBrightGreen = smoothedDeviation[1] <= lowerThreshold
wasBrightRed = smoothedDeviation[1] >= upperThreshold
// Detect oscillator turning up after bright green (buy signal)
// Trigger if we were in bright green and oscillator turns up, even if no longer bright green
oscillatorTurningUp = smoothedDeviation > smoothedDeviation[1]
buySignal = barstate.isconfirmed and wasBrightGreen and oscillatorTurningUp and smoothedDeviation[1] <= smoothedDeviation[2]
// Detect oscillator turning down after bright red (sell signal)
// Trigger if we were in bright red and oscillator turns down, even if no longer bright red
oscillatorTurningDown = smoothedDeviation < smoothedDeviation[1]
sellSignal = barstate.isconfirmed and wasBrightRed and oscillatorTurningDown and smoothedDeviation[1] >= smoothedDeviation[2]
// ============================================================================
// ATR-BASED CONTINUATION SIGNALS
// ============================================================================
// Calculate ATR for distance measurement
atrLength = 14
atr = ta.atr(atrLength)
// Track price levels when ANY sell or buy signal occurs (original or continuation)
var float lastSellPrice = na
var float lastBuyPrice = na
// Initialize tracking on original signals
if sellSignal
lastSellPrice := close
if buySignal
lastBuyPrice := close
// Continuation Sell Signal: Price moved up by ATR multiplier from last red dot
// Disabled when atrMultiplier is set to 0
continuationSell = atrMultiplier > 0 and barstate.isconfirmed and not na(lastSellPrice) and close >= lastSellPrice + (atrMultiplier * atr)
// Continuation Buy Signal: Price moved down by ATR multiplier from last green dot
// Disabled when atrMultiplier is set to 0
continuationBuy = atrMultiplier > 0 and barstate.isconfirmed and not na(lastBuyPrice) and close <= lastBuyPrice - (atrMultiplier * atr)
// Update reference prices when continuation signals trigger (reset the 3 ATR counter)
if continuationSell
lastSellPrice := close
if continuationBuy
lastBuyPrice := close
// Combine original and continuation signals for plotting
allBuySignals = buySignal or continuationBuy
allSellSignals = sellSignal or continuationSell
// Track if a signal occurred to keep it visible on dashboard
// Signals trigger at barstate.isconfirmed (bar close)
var bool showBuyOnDashboard = false
var bool showSellOnDashboard = false
// Update dashboard flags immediately when signals occur
if allBuySignals
showBuyOnDashboard := true
showSellOnDashboard := false
else if allSellSignals
showSellOnDashboard := true
showBuyOnDashboard := false
else if barstate.isconfirmed
// Reset flags on bar close if no new signal
showBuyOnDashboard := false
showSellOnDashboard := false
// ============================================================================
// PLOTTING
// ============================================================================
// Professional color scheme
var color colorBullish = #00C853 // Professional green
var color colorBearish = #FF1744 // Professional red
var color colorNeutral = #2962FF // Professional blue
var color colorGrid = #363A45 // Dark gray for lines
var color colorBackground = #1E222D // Chart background
// Dynamic line color based on value
lineColor = smoothedDeviation > upperThreshold ? colorBearish :
smoothedDeviation < lowerThreshold ? colorBullish :
smoothedDeviation > 0 ? color.new(colorBearish, 50) :
color.new(colorBullish, 50)
// Plot the deviation oscillator with dynamic coloring
plot(smoothedDeviation, "Deviation Score", color=lineColor, linewidth=2)
// Plot zero line
hline(0, "Zero Line", color=color.new(colorGrid, 0), linestyle=hline.style_solid, linewidth=1)
// Subtle fill for overextended zones (without visible threshold lines)
upperLine = hline(upperThreshold, "Upper Threshold", color=color.new(color.gray, 100), linestyle=hline.style_dashed, linewidth=1)
lowerLine = hline(lowerThreshold, "Lower Threshold", color=color.new(color.gray, 100), linestyle=hline.style_dashed, linewidth=1)
fill(upperLine, hline(3), color=color.new(colorBearish, 95), title="Overextended High Zone")
fill(lowerLine, hline(-3), color=color.new(colorBullish, 95), title="Overextended Low Zone")
// Histogram style visualization (optional alternative)
histogramColor = smoothedDeviation >= upperThreshold ? color.new(colorBearish, 20) :
smoothedDeviation <= lowerThreshold ? color.new(colorBullish, 20) :
smoothedDeviation > 0 ? color.new(colorBearish, 80) :
color.new(colorBullish, 80)
plot(smoothedDeviation, "Histogram", color=histogramColor, style=plot.style_histogram, linewidth=3)
// ============================================================================
// BUY/SELL SIGNAL MARKERS
// ============================================================================
// Plot buy signals at -3.5 level (includes both initial and extended signals)
plot(allBuySignals ? -3.5 : na, title="Buy Signal", style=plot.style_circles,
color=color.new(colorBullish, 0), linewidth=4)
// Plot sell signals at 3.5 level (includes both initial and extended signals)
plot(allSellSignals ? 3.5 : na, title="Sell Signal", style=plot.style_circles,
color=color.new(colorBearish, 0), linewidth=4)
// ============================================================================
// ALERTS - SIMPLIFIED TO ONLY TWO ALERTS
// ============================================================================
// Alert 1: Long Entry/Short TP - fires on ANY green dot (original or continuation)
alertcondition(allBuySignals, "Long Entry/Short TP", "Long Entry/Short TP")
// Alert 2: Long TP/Short Entry - fires on ANY red dot (original or continuation)
alertcondition(allSellSignals, "Long TP/Short Entry", "Long TP/Short Entry")
// ============================================================================
// DATA DISPLAY
// ============================================================================
// Create a professional table for current readings
var color tableBgColor = #1a2332 // Dark blue background
var table infoTable = table.new(position.middle_right, 2, 2, border_width=1,
border_color=color.new(#2962FF, 30),
frame_width=1,
frame_color=color.new(#2962FF, 30))
if barstate.islast
// Determine status
statusText = overextendedHigh ? "OVEREXTENDED ↓" :
overextendedLow ? "OVEREXTENDED ↑" :
smoothedDeviation > 0 ? "Buyers In Control" : "Sellers In Control"
statusColor = overextendedHigh ? color.new(colorBearish, 0) :
overextendedLow ? color.new(colorBullish, 0) :
color.white
// Background color for status cell
statusBgColor = color.new(tableBgColor, 0)
// Status Row
table.cell(infoTable, 0, 0, "Status",
bgcolor=color.new(tableBgColor, 0),
text_color=color.white,
text_size=size.normal)
table.cell(infoTable, 1, 0, statusText,
bgcolor=statusBgColor,
text_color=statusColor,
text_size=size.normal)
// Signal Row - always show
table.cell(infoTable, 0, 1, "Signal",
bgcolor=color.new(tableBgColor, 0),
text_color=color.white,
text_size=size.normal)
// Show signal if flags are set (will stay visible during the bar)
if showBuyOnDashboard or showSellOnDashboard
// Green dot (buy signal) = "Long Entry/Short TP" with arrow up, white text on green background
// Red dot (sell signal) = "Long TP/Short Entry" with arrow down, white text on red background
signalText = showBuyOnDashboard ? "↑ Long Entry/Short TP" : "↓ Long TP/Short Entry"
signalColor = showBuyOnDashboard ? color.new(colorBullish, 0) : color.new(colorBearish, 0)
table.cell(infoTable, 1, 1, signalText,
bgcolor=signalColor,
text_color=color.white,
text_size=size.normal)
else
table.cell(infoTable, 1, 1, "Watching...",
bgcolor=color.new(tableBgColor, 0),
text_color=color.new(color.white, 60),
text_size=size.normal)
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。