Trend Meter indicator
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Trend Meter indicator
- This topic has 2 replies, 3 voices, and was last updated 2 years ago by robertogozzi.
-
-
03/28/2022 at 9:03 PM #190683
Buonasera,
è possibile tradurre questo indicatore di Tradingview? si chiama Trend Meter è viene utilizzato come filtro in varie strategie; ecco il codice:
//@version=4
// Created By Lij_MC
//
// Use as a supplementary Indicator to confirm your entries, but it is as good on it’s own.
//
// The indicator consists of 3 different Trend Meters and a Trend Bar which are used to confirm trend
//
// As a bonus Wave Trend Signals are marked as well, these are very powerful however please use with caution
//
// How to Use
//
// Look for Support or Resistance Levels for price to be attracted to
//
// Find confluence with other indicators
//
// Enter Long above the Setup Bar
//
// Enter Short Below the Setup Barstudy(title=”Trend Meter”)
// Inputs / Menus
// Trend Bar / Meter – Inputs / Menus
ShowTrendBar = true
WTSetups = input(true, “1 ———– Show Setups – Wave Trend Filtered by Trend”)
TMSetups = input(true, “2 ———– Show Setups – All 3 Trend Meters Now Align”)
MSBar1 = “Trend Filter” // input(title= “1 – Wave Trend Signals”, defval = “Trend Filter”, options = [“N/A”, “Trend Filter”, “Filter X”, “Filter X + Trend Filter”])
// MSBar1 = input(title= “1 – Wave Trend Signals”, defval = “Trend Filter”, options = [“N/A”, “Trend Filter”, “Filter X”, “Filter X + Trend Filter”])
MSBar2 = “Trend Filter” // input(title= “2 – Wave Trend Signals”, defval = “Filter X”, options = [“N/A”, “Trend Filter”, “Filter X”, “Filter X + Trend Filter”])
TrendBar1 = input(title=”3 – Trend Meter 1″, defval=”MACD Crossover – Fast – 8, 21, 5″, options=[“MACD Crossover – 12, 26, 9”, “MACD Crossover – Fast – 8, 21, 5”, “Mom Dad Cross (Top Dog Trading)”, “RSI Signal Line Cross – RSI 13, Sig 21”, “RSI 13: > or < 50”, “RSI 5: > or < 50”, “Trend Candles”, “N/A”]) // “MA Crossover”, “DAD Direction (Top Dog Trading)”,
TrendBar2 = input(title=”4 – Trend Meter 2″, defval=”RSI 13: > or < 50″, options=[“MACD Crossover – 12, 26, 9”, “MACD Crossover – Fast – 8, 21, 5”, “Mom Dad Cross (Top Dog Trading)”, “RSI Signal Line Cross – RSI 13, Sig 21”, “RSI 13: > or < 50”, “RSI 5: > or < 50”, “Trend Candles”, “N/A”]) // “MA Crossover”, “DAD Direction (Top Dog Trading)”,
TrendBar3 = input(title=”5 – Trend Meter 3″, defval=”RSI 5: > or < 50″, options=[“MACD Crossover – 12, 26, 9”, “MACD Crossover – Fast – 8, 21, 5”, “Mom Dad Cross (Top Dog Trading)”, “RSI Signal Line Cross – RSI 13, Sig 21”, “RSI 13: > or < 50”, “RSI 5: > or < 50”, “Trend Candles”, “N/A”]) // “MA Crossover”, “DAD Direction (Top Dog Trading)”,
TrendBar4 = input(title=”6 – Trend Bar 1″, defval=”MA Crossover”, options=[“MA Crossover”, “MA Direction – Fast MA – TB1”, “MA Direction – Slow MA – TB1”, “N/A”]) // “MACD Crossover – 12, 26 9”, “MACD Crossover – Fast – 8, 21, 5”, “DAD Direction (Top Dog Trading)”,
TrendBar5 = input(title=”7 – Trend Bar 2″, defval=”MA Crossover”, options=[“MA Crossover”, “MA Direction – Fast MA – TB2”, “MA Direction – Slow MA – TB2”, “N/A”]) // “MACD Crossover – 12, 26 9”, “MACD Crossover – Fast – 8, 21, 5”, “DAD Direction (Top Dog Trading)”,
////////////////Signals – Wave Trend/////////////////////////////////////////////////////////////////////////////////////////////////
// Wave Trend – RSI
RSIMC = rsi(close, 14)
// Wave Trend
ap = hlc3 // input(hlc3, “Wave Trend – Source”)
n1 = 9 //input(9, “Wave Trend – WT Channel Length”)
n2 = 12 // input(12, “Wave Trend – WT Average Length”)
esa = ema(ap, n1)
de = ema(abs(ap – esa), n1)
ci = (ap – esa) / (0.015 * de)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1, 3)// Wave Trend – Overbought & Oversold lines
obLevel2 = 60 // input( 60, “Wave Trend – WT Very Overbought”)
obLevel = 50 // input( 50, “Wave Trend – WT Overbought”)
osLevel = -50 // input(-50, “Wave Trend – WT Oversold”)
osLevel2 = -60 // input(-60, “Wave Trend – WT Very Oversold”)// Wave Trend – Conditions
WTCross = cross(wt1, wt2)
WTCrossUp = wt2 – wt1 <= 0
WTCrossDown = wt2 – wt1 >= 0
WTOverSold = wt2 <= osLevel2
WTOverBought = wt2 >= obLevel2// MA Inputs
MA1_Type = input(title=’Trend Bar 1 – Fast MA – Type’, defval=”EMA”, options=[“EMA”, “SMA”])
MA1_Length = input(5, title=’Trend Bar 1 – Fast MA – Length’, minval=1)MA2_Type = input(title=’Trend Bar 1 – Slow MA – Type’, defval=”EMA”, options=[“EMA”, “SMA”])
MA2_Length = input(11, title=’Trend Bar 1 – Slow MA – Length’, minval=1)MA3_Type = input(title=’Trend Bar 2 – Fast MA – Type’, defval=”EMA”, options=[“EMA”, “SMA”])
MA3_Length = input(13, title=’Trend Bar 2 – Fast MA – Length’, minval=1)MA4_Type = input(title=’Trend Bar 2 – Slow MA – Type’, defval=”SMA”, options=[“EMA”, “SMA”])
MA4_Length = input(36, title=’Trend Bar 2 – Slow MA – Length’, minval=1)// MA Calculations
MA1 = if MA1_Type == “SMA”
sma(close, MA1_Length)
else
ema(close, MA1_Length)MA2 = if MA2_Type == “SMA”
sma(close, MA2_Length)
else
ema(close, MA2_Length)MA3 = if MA3_Type == “SMA”
sma(close, MA3_Length)
else
ema(close, MA3_Length)MA4 = if MA4_Type == “SMA”
sma(close, MA4_Length)
else
ema(close, MA4_Length)// MA Crossover Condition
MACrossover1 = MA1 > MA2 ? 1 : 0
MACrossover2 = MA3 > MA4 ? 1 : 0
// MA Direction Condition
MA1Direction = MA1 > MA1[1] ? 1 : 0
MA2Direction = MA2 > MA2[1] ? 1 : 0
MA3Direction = MA3 > MA3[1] ? 1 : 0
MA4Direction = MA4 > MA4[1] ? 1 : 0
// MA Direction Change Condition
MA1PositiveDirectionChange = MA1Direction and not MA1Direction[1] ? 1 : 0
MA2PositiveDirectionChange = MA2Direction and not MA2Direction[1] ? 1 : 0
MA3PositiveDirectionChange = MA3Direction and not MA3Direction[1] ? 1 : 0
MA4PositiveDirectionChange = MA4Direction and not MA4Direction[1] ? 1 : 0
MA1NegativeDirectionChange = not MA1Direction and MA1Direction[1] ? 1 : 0
MA2NegativeDirectionChange = not MA2Direction and MA2Direction[1] ? 1 : 0
MA3NegativeDirectionChange = not MA3Direction and MA3Direction[1] ? 1 : 0
MA4NegativeDirectionChange = not MA4Direction and MA4Direction[1] ? 1 : 0
// MACD and MOM & DAD – Top Dog Trading
// Standard MACD Calculations
MACDfastMA = 12
MACDslowMA = 26
MACDsignalSmooth = 9MACDLine = ema(close, MACDfastMA) – ema(close, MACDslowMA)
SignalLine = ema(MACDLine, MACDsignalSmooth)
MACDHistogram = MACDLine – SignalLine
// MACD- Background Color Change Condition
MACDHistogramCross = MACDHistogram > 0 ? 1 : 0
MACDLineOverZero = MACDLine > 0 ? 1 : 0
MACDLineOverZeroandHistogramCross = MACDHistogramCross and MACDLineOverZero ? 1 : 0
MACDLineUnderZeroandHistogramCross = not MACDHistogramCross and not MACDLineOverZero ? 1 : 0
// Fast MACD Calculations
FastMACDfastMA = 8
FastMACDslowMA = 21
FastMACDsignalSmooth = 5FastMACDLine = ema(close, FastMACDfastMA) – ema(close, FastMACDslowMA)
FastSignalLine = ema(FastMACDLine, FastMACDsignalSmooth)
FastMACDHistogram = FastMACDLine – FastSignalLine
// Fast MACD- Background Color Change Condition
FastMACDHistogramCross = FastMACDHistogram > 0 ? 1 : 0
FastMACDLineOverZero = FastMACDLine > 0 ? 1 : 0
FastMACDLineOverZeroandHistogramCross = FastMACDHistogramCross and FastMACDLineOverZero ? 1 : 0
FastMACDLineUnderZeroandHistogramCross = not FastMACDHistogramCross and not FastMACDLineOverZero ? 1 : 0
// Top Dog Trading – Mom Dad Calculations
TopDog_Fast_MA = 5
TopDog_Slow_MA = 20
TopDog_Sig = 30TopDogMom = ema(close, TopDog_Fast_MA) – ema(close, TopDog_Slow_MA)
TopDogDad = ema(TopDogMom, TopDog_Sig)
// Top Dog Dad – Background Color Change Condition
TopDogDadDirection = TopDogDad > TopDogDad[1] ? 1 : 0
TopDogMomOverDad = TopDogMom > TopDogDad ? 1 : 0
TopDogMomOverZero = TopDogMom > 0 ? 1 : 0
TopDogDadDirectandMomOverZero = TopDogDadDirection and TopDogMomOverZero ? 1 : 0
TopDogDadDirectandMomUnderZero = not TopDogDadDirection and not TopDogMomOverZero ? 1 : 0
////// Trend Barmeter Calculations //////
// UCS_Trend / Trend Candles Trend Barmeter Calculations
//UCS_Trend by ucsgears copy Trend Candles
//Interpretation of TTM Trend bars. It is really close to the actual.haclose = ohlc4
haopen = 0.0
haopen := na(haopen[1]) ? (open + close) / 2 : (haopen[1] + haclose[1]) / 2
//hahigh = max(high, max(haopen, haclose))
//halow = min(low, min(haopen, haclose))ccolor = haclose – haopen > 0 ? 1 : 0
inside6 = haopen <= max(haopen[6], haclose[6]) and haopen >= min(haopen[6], haclose[6]) and
haclose <= max(haopen[6], haclose[6]) and haclose >= min(haopen[6], haclose[6]) ?
1 : 0inside5 = haopen <= max(haopen[5], haclose[5]) and haopen >= min(haopen[5], haclose[5]) and
haclose <= max(haopen[5], haclose[5]) and haclose >= min(haopen[5], haclose[5]) ?
1 : 0inside4 = haopen <= max(haopen[4], haclose[4]) and haopen >= min(haopen[4], haclose[4]) and
haclose <= max(haopen[4], haclose[4]) and haclose >= min(haopen[4], haclose[4]) ?
1 : 0inside3 = haopen <= max(haopen[3], haclose[3]) and haopen >= min(haopen[3], haclose[3]) and
haclose <= max(haopen[3], haclose[3]) and haclose >= min(haopen[3], haclose[3]) ?
1 : 0inside2 = haopen <= max(haopen[2], haclose[2]) and haopen >= min(haopen[2], haclose[2]) and
haclose <= max(haopen[2], haclose[2]) and haclose >= min(haopen[2], haclose[2]) ?
1 : 0inside1 = haopen <= max(haopen[1], haclose[1]) and haopen >= min(haopen[1], haclose[1]) and
haclose <= max(haopen[1], haclose[1]) and haclose >= min(haopen[1], haclose[1]) ?
1 : 0colorvalue = inside6 ? ccolor[6] : inside5 ? ccolor[5] : inside4 ? ccolor[4] :
inside3 ? ccolor[3] : inside2 ? ccolor[2] : inside1 ? ccolor[1] : ccolorTrendBarTrend_Candle_Color = colorvalue ? #288a75 : color.red
TrendBarTrend_Candle = colorvalue ? 1 : 0
// barcolor(Trend_Candle_Color , title = “Trend Candles”)
// barcolor(ShowTrendCandles? Trend_Candle_Color : na, title = “Trend Candles”)// RSI 5 Trend Barmeter Calculations
RSI5 = rsi(close, 5)
RSI5Above50 = RSI5 > 50 ? 1 : 0
RSI5Color = RSI5Above50 ? #288a75 : color.red
TrendBarRSI5Color = RSI5Above50 ? #288a75 : color.red
// RSI 5 Trend Barmeter Calculations
RSI13 = rsi(close, 13)
// Linear Regression Calculation For RSI Signal Line
SignalLineLength1 = 21
x = bar_index
y = RSI13
x_ = sma(x, SignalLineLength1)
y_ = sma(y, SignalLineLength1)
mx = stdev(x, SignalLineLength1)
my = stdev(y, SignalLineLength1)
c = correlation(x, y, SignalLineLength1)
slope = c * (my / mx)
inter = y_ – slope * x_
LinReg1 = x * slope + interRSISigDirection = LinReg1 > LinReg1[1] ? 1 : 0
RSISigCross = RSI13 > LinReg1 ? 1 : 0
RSI13Above50 = RSI13 > 50 ? 1 : 0
// Trend Barmeter Color Calculation
RSI13Color = RSI13Above50 ? #288a75 : color.red
TrendBarRSI13Color = RSI13Above50 ? #288a75 : color.red
TrendBarRSISigCrossColor = RSISigCross ? #288a75 : color.red
TrendBarMACDColor = MACDHistogramCross ? #288a75 : color.red
TrendBarFastMACDColor = FastMACDHistogramCross ? #288a75 : color.red
TrendBarMACrossColor = MACrossover1 ? #288a75 : color.red
TrendBarMomOverDadColor = TopDogMomOverDad ? #288a75 : color.red
TrendBarDadDirectionColor = TopDogDadDirection ? #288a75 : color.red
TrendBar1Result = TrendBar1 == “MA Crossover” ? MACrossover1 :
TrendBar1 == “MACD Crossover – 12, 26, 9” ? MACDHistogramCross :
TrendBar1 == “MACD Crossover – Fast – 8, 21, 5” ? FastMACDHistogramCross :
TrendBar1 == “Mom Dad Cross (Top Dog Trading)” ? TopDogMomOverDad :
TrendBar1 == “DAD Direction (Top Dog Trading)” ? TopDogDadDirection :
TrendBar1 == “RSI Signal Line Cross – RSI 13, Sig 21” ? RSISigCross :
TrendBar1 == “RSI 5: > or < 50” ? RSI5Above50 :
TrendBar1 == “RSI 13: > or < 50” ? RSI13Above50 :
TrendBar1 == “Trend Candles” ? TrendBarTrend_Candle : naTrendBar2Result = TrendBar2 == “MA Crossover” ? MACrossover1 :
TrendBar2 == “MACD Crossover – 12, 26, 9” ? MACDHistogramCross :
TrendBar2 == “MACD Crossover – Fast – 8, 21, 5” ? FastMACDHistogramCross :
TrendBar2 == “Mom Dad Cross (Top Dog Trading)” ? TopDogMomOverDad :
TrendBar2 == “DAD Direction (Top Dog Trading)” ? TopDogDadDirection :
TrendBar2 == “RSI Signal Line Cross – RSI 13, Sig 21” ? RSISigCross :
TrendBar2 == “RSI 5: > or < 50” ? RSI5Above50 :
TrendBar2 == “RSI 13: > or < 50” ? RSI13Above50 :
TrendBar2 == “Trend Candles” ? TrendBarTrend_Candle : naTrendBar3Result = TrendBar3 == “MA Crossover” ? MACrossover1 :
TrendBar3 == “MACD Crossover – 12, 26, 9” ? MACDHistogramCross :
TrendBar3 == “MACD Crossover – Fast – 8, 21, 5” ? FastMACDHistogramCross :
TrendBar3 == “Mom Dad Cross (Top Dog Trading)” ? TopDogMomOverDad :
TrendBar3 == “DAD Direction (Top Dog Trading)” ? TopDogDadDirection :
TrendBar3 == “RSI Signal Line Cross – RSI 13, Sig 21” ? RSISigCross :
TrendBar3 == “RSI 5: > or < 50” ? RSI5Above50 :
TrendBar3 == “RSI 13: > or < 50” ? RSI13Above50 :
TrendBar3 == “Trend Candles” ? TrendBarTrend_Candle : naTrendBars2Positive = TrendBar1Result and TrendBar2Result or TrendBar1Result and TrendBar3Result or
TrendBar2Result and TrendBar3Result ? 1 : 0TrendBars2Negative = not TrendBar1Result and not TrendBar2Result or
not TrendBar1Result and not TrendBar3Result or
not TrendBar2Result and not TrendBar3Result ? 1 : 0TrendBars3Positive = TrendBar1Result and TrendBar2Result and TrendBar3Result ? 1 : 0
TrendBars3Negative = not TrendBar1Result and not TrendBar2Result and not TrendBar3Result ? 1 : 0
// Signal Filters
// FilterX = (ema(close,15) > sma(close,15)) and (ema(close,15)[1] > sma(close,15)[1]) ? 1 : 0
// FilterXUp = ema(close,15) > sma(close,15) and ema(close, 11) > ema(close, 15) and ema(close,3) > ema(close,15) and ema(close,8) > ema(close,15) ? 1 : 0
// FilterXDown = ema(close,15) < sma(close,15) and ema(close, 11) < ema(close, 15) and ema(close,3) < ema(close,15) and ema(close,8) < ema(close,15) ? 1 : 0
FilterXUp = FastMACDHistogramCross and ema(close, 15) > ema(close, 15)[1]
FilterXDown = not FastMACDHistogramCross and ema(close, 15) < ema(close, 15)[1]
TrendFilterPlus = ema(close, 15) > ema(close, 20) and ema(close, 20) > ema(close, 30) and
ema(close, 30) > ema(close, 40) and ema(close, 40) > ema(close, 50) ? 1 : 0TrendFilterMinus = ema(close, 15) < ema(close, 20) and ema(close, 20) < ema(close, 30) and
ema(close, 30) < ema(close, 40) and ema(close, 40) < ema(close, 50) ? 1 : 0// // Wave Trend – Conditions
// WTCross = cross(wt1, wt2)
// WTCrossUp = wt2 – wt1 <= 0
// WTCrossDown = wt2 – wt1 >= 0
// WTOverSold = wt2 <= osLevel2
// WTOverBought = wt2 >= obLevel2MSBar1PositiveWaveTrendSignal = MSBar1 == “Filter X” ? FilterXUp and WTCross and WTCrossUp :
MSBar1 == “Trend Filter” ? TrendFilterPlus and WTCross and WTCrossUp :
MSBar1 == “Filter X + Trend Filter” ?
FilterXUp and TrendFilterPlus and WTCross and WTCrossUp : WTCross and WTCrossUp
MSBar1NegativeWaveTrendSignal = MSBar1 == “Filter X” ? FilterXDown and WTCross and WTCrossDown :
MSBar1 == “Trend Filter” ? TrendFilterMinus and WTCross and WTCrossDown :
MSBar1 == “Filter X + Trend Filter” ?
FilterXDown and TrendFilterMinus and WTCross and WTCrossDown :
WTCross and WTCrossDownMSBar2PositiveWaveTrendSignal = MSBar2 == “Filter X” ? FilterXUp and WTCross and WTCrossUp :
MSBar2 == “Trend Filter” ? TrendFilterPlus and WTCross and WTCrossUp :
MSBar2 == “Filter X + Trend Filter” ?
FilterXUp and TrendFilterPlus and WTCross and WTCrossUp : WTCross and WTCrossUp
MSBar2NegativeWaveTrendSignal = MSBar2 == “Filter X” ? FilterXDown and WTCross and WTCrossDown :
MSBar2 == “Trend Filter” ? TrendFilterMinus and WTCross and WTCrossDown :
MSBar2 == “Filter X + Trend Filter” ?
FilterXDown and TrendFilterMinus and WTCross and WTCrossDown :
WTCross and WTCrossDown// Alerts & Conditions – Wave Trend
alertcondition(MSBar1PositiveWaveTrendSignal, title=’Wave Trend – Long’, message=’Long – Wave Trend Signal – Trend Meter’)
alertcondition(MSBar1NegativeWaveTrendSignal, title=’Wave Trend – Short’, message=’Short – Wave Trend Signal – Trend Meter’)
alertcondition(MSBar1PositiveWaveTrendSignal or MSBar1NegativeWaveTrendSignal, title=’Wave Trend – Long or Short’, message=’Long or Short – Wave Trend Signal – Trend Meter’)// alertcondition(MSBar2PositiveWaveTrendSignal, title=’Alert-Wave Trend 2 — Long’, message=’Long – Wave Trend 2 Signal – Trend Meter’)
// alertcondition(MSBar2NegativeWaveTrendSignal, title=’Alert-Wave Trend 2 — Short’, message=’Short – Wave Trend 2 Signal – Trend Meter’)
// alertcondition(MSBar2PositiveWaveTrendSignal or MSBar2NegativeWaveTrendSignal, title=’Alert-Wave Trend 2-Long or Short’, message=’Long or Short – Wave Trend 2 Signal – Trend Meter’)// alertcondition(MSBar1PositiveWaveTrendSignal or MSBar2PositiveWaveTrendSignal, title=’Alert-Wave Trend — Long’, message=’Long – Wave Trend Signal – Trend Meter’)
// alertcondition(MSBar1NegativeWaveTrendSignal or MSBar2NegativeWaveTrendSignal, title=’Alert-Wave Trend — Short’, message=’Short – Wave Trend Signal – Trend Meter’)
// alertcondition(MSBar1PositiveWaveTrendSignal or MSBar1NegativeWaveTrendSignal or MSBar2PositiveWaveTrendSignal or MSBar2NegativeWaveTrendSignal, title=’Alert-Wave Trend – Long or Short’, message=’Long or Short – Wave Trend Signal – Trend Meter’)///////////////////////////////////////////////////////////////////////////////////////////////////////////////
BackgroundColorChangePositive = TrendBars3Positive and not TrendBars3Positive[1]
BackgroundColorChangeNegative = TrendBars3Negative and not TrendBars3Negative[1]// Signals Color Calculations
MSBar1Color = MSBar1PositiveWaveTrendSignal ? #288a75 :
MSBar1NegativeWaveTrendSignal ? color.red : naMSBar2Color = BackgroundColorChangePositive ? #288a75 :
BackgroundColorChangeNegative ? color.red : na// Trend Barmeter Color Assignments
TrendBar1Color = TrendBar1 == “N/A” ? na :
TrendBar1 == “MACD Crossover – 12, 26, 9” ? TrendBarMACDColor :
TrendBar1 == “MACD Crossover – Fast – 8, 21, 5” ? TrendBarFastMACDColor :
TrendBar1 == “Mom Dad Cross (Top Dog Trading)” ? TrendBarMomOverDadColor :
TrendBar1 == “DAD Direction (Top Dog Trading)” ? TrendBarDadDirectionColor :
TrendBar1 == “RSI Signal Line Cross – RSI 13, Sig 21” ? TrendBarRSISigCrossColor :
TrendBar1 == “RSI 5: > or < 50” ? TrendBarRSI5Color :
TrendBar1 == “RSI 13: > or < 50” ? TrendBarRSI13Color :
TrendBar1 == “Trend Candles” ? TrendBarTrend_Candle_Color :
TrendBar1 == “MA Crossover” ? TrendBarMACrossColor : naTrendBar2Color = TrendBar2 == “N/A” ? na :
TrendBar2 == “MACD Crossover – 12, 26, 9” ? TrendBarMACDColor :
TrendBar2 == “MACD Crossover – Fast – 8, 21, 5” ? TrendBarFastMACDColor :
TrendBar2 == “Mom Dad Cross (Top Dog Trading)” ? TrendBarMomOverDadColor :
TrendBar2 == “DAD Direction (Top Dog Trading)” ? TrendBarDadDirectionColor :
TrendBar2 == “RSI Signal Line Cross – RSI 13, Sig 21” ? TrendBarRSISigCrossColor :
TrendBar2 == “RSI 5: > or < 50” ? TrendBarRSI5Color :
TrendBar2 == “RSI 13: > or < 50” ? TrendBarRSI13Color :
TrendBar2 == “Trend Candles” ? TrendBarTrend_Candle_Color :
TrendBar2 == “MA Crossover” ? TrendBarMACrossColor : naTrendBar3Color = TrendBar3 == “N/A” ? na :
TrendBar3 == “MACD Crossover – 12, 26, 9” ? TrendBarMACDColor :
TrendBar3 == “MACD Crossover – Fast – 8, 21, 5” ? TrendBarFastMACDColor :
TrendBar3 == “Mom Dad Cross (Top Dog Trading)” ? TrendBarMomOverDadColor :
TrendBar3 == “DAD Direction (Top Dog Trading)” ? TrendBarDadDirectionColor :
TrendBar3 == “RSI Signal Line Cross – RSI 13, Sig 21” ? TrendBarRSISigCrossColor :
TrendBar3 == “RSI 5: > or < 50” ? TrendBarRSI5Color :
TrendBar3 == “RSI 13: > or < 50” ? TrendBarRSI13Color :
TrendBar3 == “Trend Candles” ? TrendBarTrend_Candle_Color :
TrendBar3 == “MA Crossover” ? TrendBarMACrossColor : naCrossoverType2 = TrendBar4 == “DAD Direction (Top Dog Trading)” ? TopDogDadDirection :
TrendBar4 == “MACD Crossover” ? MACDHistogramCross :
TrendBar4 == “MA Direction – Fast MA – TB1” ? MA1Direction :
TrendBar4 == “MA Direction – Slow MA – TB1” ? MA2Direction : MACrossover1color_1 = color.new(color.green, 20)
color_2 = color.new(color.red, 20)
TrendBar4Color1 = TrendBar4 == “N/A” ? na : CrossoverType2 ? color_1 : color_2// TrendBar4Color2 = TrendBar4==”N/A” ? na : TrendBar4==”DAD Direction (Top Dog Trading)” and TopDogDadDirectandMomOverZero ? color(green, 70) : TrendBar4==”DAD Direction (Top Dog Trading)” and TopDogDadDirectandMomUnderZero ? color(red, 70) : TrendBar4==”MACD Crossover – 12, 26, 9″ and MACDLineOverZeroandHistogramCross ? color(green, 70) : TrendBar4==”MACD Crossover – 12, 26, 9″ and MACDLineUnderZeroandHistogramCross ? color(red, 70) : TrendBar4==”MA Crossover” and CrossoverType2 ? color(green, 40) : TrendBar4==”MA Crossover” and not CrossoverType2 ? color(red, 40) : TrendBar4==”MA Direction – Fast MA” and CrossoverType2 ? color(green, 40) : TrendBar4==”MA Direction – Fast MA” and not CrossoverType2 ? color(red, 40) : na
CrossoverType3 = TrendBar5 == “DAD Direction (Top Dog Trading)” ? TopDogDadDirection :
TrendBar5 == “MACD Crossover” ? MACDHistogramCross :
TrendBar5 == “MA Direction – Fast MA – TB2” ? MA3Direction :
TrendBar5 == “MA Direction – Slow MA – TB2” ? MA4Direction : MACrossover2color_3 = color.new(color.green, 20)
color_4 = color.new(color.red, 20)
TrendBar5Color1 = TrendBar5 == “N/A” ? na : CrossoverType3 ? color_3 : color_4// TrendBar5Color2 = TrendBar5==”N/A” ? na : TrendBar5==”DAD Direction (Top Dog Trading)” and TopDogDadDirectandMomOverZero ? color(green, 70) : TrendBar5==”DAD Direction (Top Dog Trading)” and TopDogDadDirectandMomUnderZero ? color(red, 70) : TrendBar5==”MACD Crossover – 12, 26, 9″ and MACDLineOverZeroandHistogramCross ? color(green, 70) : TrendBar5==”MACD Crossover – 12, 26, 9″ and MACDLineUnderZeroandHistogramCross ? color(red, 70) : TrendBar5==”MA Crossover” and CrossoverType3 ? color(green, 40) : TrendBar5==”MA Crossover” and not CrossoverType3 ? color(red, 40) : TrendBar5==”MA Direction – Fast MA” and CrossoverType3 ? color(green, 40) : TrendBar5==”MA Direction – Fast MA” and not CrossoverType3 ? color(red, 40) : na
// Momentum Setup Plots
plot(ShowTrendBar and WTSetups ? 140.5 : na, title=”Signals 1 – Wave Trend Signals”, style=plot.style_circles, color=MSBar1Color, linewidth=3, transp=20)
plot(ShowTrendBar and TMSetups ? 134.5 : na, title=”Signals 2 – All 3 Trend Meters Now Align”, style=plot.style_circles, color=MSBar2Color, linewidth=3, transp=20)
// Trend Barmeter Plots
plot(ShowTrendBar ? 128.5 : na, title=”3 – Trend Meter”, style=plot.style_circles, color=TrendBar1Color, linewidth=2, transp=20)
plot(ShowTrendBar ? 122.5 : na, title=”4 – Trend Meter”, style=plot.style_circles, color=TrendBar2Color, linewidth=2, transp=20)
plot(ShowTrendBar ? 116.5 : na, title=”5 – Trend Meter”, style=plot.style_circles, color=TrendBar3Color, linewidth=2, transp=20)
plot(ShowTrendBar and not(TrendBar5 == “N/A”) ? 110 : na, title=”6 – Trend Bar 1 – Thin Line – Color”, style=plot.style_line, color=TrendBar4Color1, linewidth=4, transp=20)
plot(ShowTrendBar and TrendBar5 == “N/A” and not(TrendBar4 == “N/A”) ? 107.25 : na, title=”6 – Trend Bar 1 – Thick Line”, style=plot.style_line, color=TrendBar4Color1, linewidth=7, transp=20)plot(ShowTrendBar and not(TrendBar4 == “N/A”) ? 104.5 : na, title=”7 – Trend Bar 2 – Thin Line – Color”, style=plot.style_line, color=TrendBar5Color1, linewidth=4, transp=20)
plot(ShowTrendBar and TrendBar4 == “N/A” and not(TrendBar5 == “N/A”) ? 107.25 : na, title=”7 – Trend Bar 2 – Thick Line”, style=plot.style_line, color=TrendBar5Color1, linewidth=7, transp=20)// plot(ShowTrendBar and not (TrendBar5==”N/A”)? 110 : na, title=”6 – Trend Bar 1 – Thin Line – Color Highlight Momentum Above or Below 0″, style = line, color = TrendBar4Color2, linewidth = 4)
// plot(ShowTrendBar and not (TrendBar4==”N/A”)? 104.5 : na, title=”7 – Trend Bar 2 – Thin Line – Color Highlight Momentum Above or Below 0″, style = line, color = TrendBar5Color2, linewidth = 4)
// plot(ShowTrendBar and ((TrendBar5==”N/A”) and not (TrendBar4==”N/A”)) ? 107.25 : na, title=”6 – Trend Bar 1 – Thick Line – Color Highlight Momentum Above or Below 0″, style = line, color = TrendBar4Color2, linewidth = 7)
// plot(ShowTrendBar and ((TrendBar4==”N/A”) and not (TrendBar5==”N/A”)) ? 107.25 : na, title=”7 – Trend Bar 2 – Thick Line – Color Highlight Momentum Above or Below 0″, style = line, color = TrendBar5Color2, linewidth = 7)// Background Highlights
TrendBar3BarsSame = TrendBars3Positive ? color.green : TrendBars3Negative ? color.red : na
TMa = hline(113.7, color=color.new(color.white, 100))
TMb = hline(131.3, color=color.new(color.white, 100))
fill(TMa, TMb, color=TrendBar3BarsSame, transp=91, title=”Trend Meter Background Highlight – 3 Trend Meter Conditions Met”)
// Alerts & Conditions – Background Color
// BackgroundColorChangePositive = TrendBars3Positive and not TrendBars3Positive[1]
// BackgroundColorChangeNegative = TrendBars3Negative and not TrendBars3Negative[1]alertcondition(BackgroundColorChangePositive, title=’3 Trend Meters Turn Green’, message=’All 3 Trend Meters Turn Green – Trend Meter’)
alertcondition(BackgroundColorChangeNegative, title=’3 Trend Meters Turn Red’, message=’All 3 Trend Meters Turn Red – Trend Meter’)
alertcondition(BackgroundColorChangePositive or BackgroundColorChangeNegative, title=’3 Trend Meters Change Color’, message=’All 3 Trend Meters Change Color – Trend Meter’)RapidColorChangePositive = TrendBars3Positive and (TrendBars3Negative[1] or TrendBars3Negative[2])
RapidColorChangeNegative = TrendBars3Negative and (TrendBars3Positive[1] or TrendBars3Positive[2])alertcondition(RapidColorChangePositive, title=’3TrendMeters Rapid Change Red to Green’, message=’3 Trend Meters Rapid Change Red to Green – Trend Meter’)
alertcondition(RapidColorChangeNegative, title=’3TrendMeters Rapid Change Green to Red’, message=’3 Trend Meters Rapid Change Green to Red – Trend Meter’)
alertcondition(RapidColorChangePositive or RapidColorChangeNegative, title=’3TrendMeters Rapid Color Change’, message=’3 Trend Meters Rapid Color Change – Trend Meter’)MaxValueMACrossUp = crossover(ema(close, 5), ema(close, 11))
MaxValueMACrossDown = crossunder(ema(close, 5), ema(close, 11))alertcondition(MSBar1PositiveWaveTrendSignal or BackgroundColorChangePositive or MaxValueMACrossUp, title=’Any Positive Setup – Signals’, message=’Any Positive Setup – 3 Trend Meters Now Align or Filtered Wave Trend or 5 / 11 EMA Cross – Trend Meter’)
alertcondition(MSBar1NegativeWaveTrendSignal or BackgroundColorChangeNegative or MaxValueMACrossDown, title=’Any Negative Setup – Signals’, message=’Any Negative Setup – 3 Trend Meters Now Align or Filtered Wave Trend or 5 / 11 EMA Cross – Trend Meter’)
alertcondition(MSBar1PositiveWaveTrendSignal or MSBar1NegativeWaveTrendSignal or BackgroundColorChangePositive or BackgroundColorChangeNegative or MaxValueMACrossUp or MaxValueMACrossDown, title=’Any Setup – Signals’, message=’Any Setup – 3 Trend Meters Now Align or Filtered Wave Trend or 5 / 11 EMA Cross – Trend Meter’)// // Alerts & Conditions – Trend Candles
// TrendCandleGreenChange = TrendBarTrend_Candle and not TrendBarTrend_Candle[1]
// TrendCandleRedChange = not TrendBarTrend_Candle and TrendBarTrend_Candle[1]// alertcondition(TrendCandleGreenChange, title=’Alert-Trend Candles Changed to Green’, message=’Trend Candles Changed to Green – Trend Meter’)
// alertcondition(TrendCandleRedChange, title=’Alert-Trend Candles Changed to Red’, message=’Trend Candles Changed to Red – Trend Meter’)
// alertcondition(TrendCandleGreenChange or TrendCandleRedChange, title=’Alert-Trend Candles Changed Red/Green’, message=’Trend Candles Changed to Red or Green – Trend Meter’)// Alerts & Conditions – MA Crossing
TB1MACrossUp = crossover(MA1, MA2)
TB1MACrossDown = crossunder(MA1, MA2)alertcondition(TB1MACrossUp, title=’TB1 Fast MA X Above Slow MA’, message=’Trend Bar 1 – Fast MA X Above Slow MA – Trend Meter’)
alertcondition(TB1MACrossDown, title=’TB1 Fast MA X Below Slow MA’, message=’Trend Bar 1 – Fast MA X Below Slow MA – Trend Meter’)
alertcondition(TB1MACrossUp or TB1MACrossDown, title=’TB1 MAs X’, message=’Color Change – Trend Bar 1 – MAs Crossing – Trend Meter’)TB2MACrossUp = crossover(MA3, MA4)
TB2MACrossDown = crossunder(MA3, MA4)alertcondition(TB2MACrossUp, title=’TB2 Fast MA X Above Slow MA’, message=’Trend Bar 2 – Fast MA X Above Slow MA – Trend Meter’)
alertcondition(TB2MACrossDown, title=’TB2 Fast MA X Below Slow MA’, message=’Trend Bar 2 – Fast MA X Below Slow MA – Trend Meter’)
alertcondition(TB2MACrossUp or TB2MACrossDown, title=’TB2 MAs X’, message=’Color Change – Trend Bar 2 – MAs Crossing – Trend Meter’)alertcondition(BackgroundColorChangePositive and TB1MACrossUp, title=’3 Trend Meters Turn Green with TB 1′, message=’All 3 Trend Meters Turn Green with TB 1 – Trend Meter’)
alertcondition(BackgroundColorChangeNegative and TB1MACrossDown, title=’3 Trend Meters Turn Red with TB 1′, message=’All 3 Trend Meters Turn Red with TB 1 – Trend Meter’)
alertcondition(BackgroundColorChangePositive and TB1MACrossUp or BackgroundColorChangeNegative and TB1MACrossDown, title=’3 Trend Meters Change Color with TB 1′, message=’All 3 Trend Meters Change Color with TB 1 – Trend Meter’)alertcondition(BackgroundColorChangePositive and TB2MACrossUp, title=’3 Trend Meters Turn Green with TB 2′, message=’All 3 Trend Meters Turn Green with TB 2 – Trend Meter’)
alertcondition(BackgroundColorChangeNegative and TB2MACrossDown, title=’3 Trend Meters Turn Red with TB 2′, message=’All 3 Trend Meters Turn Red with TB 2 – Trend Meter’)
alertcondition(BackgroundColorChangePositive and TB2MACrossUp or BackgroundColorChangeNegative and TB2MACrossDown, title=’3 Trend Meters Change Color with TB 2′, message=’All 3 Trend Meters Change Color with TB 2 – Trend Meter’)alertcondition(BackgroundColorChangePositive and TB1MACrossUp and TB2MACrossUp, title=’3 Trend Meters Turn Green with TBs 1+2′, message=’All 3 Trend Meters Turn Green with Trend Bar 1+2 – Trend Meter’)
alertcondition(BackgroundColorChangeNegative and TB1MACrossDown and TB2MACrossDown, title=’3 Trend Meters Turn Red with TBs 1+2′, message=’All 3 Trend Meters Turn Red with Trend Bar 1+2 – Trend Meter’)
alertcondition(BackgroundColorChangePositive and TB1MACrossUp and TB2MACrossUp or BackgroundColorChangeNegative and TB1MACrossDown and TB2MACrossDown, title=’3 Trend Meters Change Color with TBs1+2′, message=’All 3 Trend Meters Change Color with Trend Bar 1+2 – Trend Meter’)// // Alerts & Conditions – RSI Signal Line Cross
// RSICrossOverSignalLine = crossover( RSI13, LinReg1)
// RSICrossUnderSignalLine = crossunder(RSI13, LinReg1)// alertcondition(RSICrossOverSignalLine, title=’Alert-RSI X Over Signal Line’, message=’RSI X Over Signal Line – Trend Meter’)
// alertcondition(RSICrossUnderSignalLine, title=’Alert-RSI X Under Signal Line’, message=’RSI X Under Signal Line – Trend Meter’)
// alertcondition(RSICrossOverSignalLine or RSICrossUnderSignalLine, title=’Alert-RSI X Signal Line’, message=’RSI X Signal Line – Trend Meter’)// // Alerts & Conditions – RSI13 Cross 50
// RSI13CrossOver50 = crossover( RSI13, 50)
// RSI13CrossUnder50 = crossunder(RSI13, 50)// alertcondition(RSI13CrossOver50, title=’Alert-Color Change-RSI 13 X Over 50′, message=’Color Change – RSI 13 X Over 50 – Trend Meter’)
// alertcondition(RSI13CrossUnder50, title=’Alert-Color Change-RSI 13 X Under 50′, message=’Color Change – RSI 13 X Under 50 – Trend Meter’)
// alertcondition(RSI13CrossOver50 or RSI13CrossUnder50, title=’Alert-Color Change-RSI 13 X 50′, message=’Color Change – RSI 13 X 50 – Trend Meter’)// // Alerts & Conditions – RSI5 Cross 50
// RSI5CrossOver50 = crossover( RSI5, 50)
// RSI5CrossUnder50 = crossunder(RSI5, 50)// alertcondition(RSI5CrossOver50, title=’Alert-Color Change-RSI 5 X Over 50′, message=’Color Change – RSI 5 X Over 50 – Trend Meter’)
// alertcondition(RSI5CrossUnder50, title=’Alert-Color Change-RSI 5 X Under 50′, message=’Color Change – RSI 5 X Under 50 – Trend Meter’)
// alertcondition(RSI5CrossOver50 or RSI5CrossUnder50, title=’Alert-Color Change-RSI 5 X 50′, message=’Color Change – RSI 5 X 50 – Trend Meter’)// // Alerts & Conditions – MACD Histogram Crossing 0
// MACDHistogramCrossUp = crossover(MACDHistogram, 0)
// MACDHistogramCrossDown = crossunder(MACDHistogram, 0)// alertcondition(MACDHistogramCrossUp, title=’Alert-MACD Histogram X Up’, message=’MACD Histogram X Up Over 0 – Trend Meter’)
// alertcondition(MACDHistogramCrossDown, title=’Alert-MACD Histogram X Down’, message=’MACD Histogram X Down Under 0 – Trend Meter’)
// alertcondition(MACDHistogramCrossUp or MACDHistogramCrossDown, title=’Alert-MACD Histogram Cross’, message=’MACD Histogram Crossing Over or Under 0 – Trend Meter’)// FastMACDHistogramCrossUp = crossover( FastMACDHistogram, 0)
// FastMACDHistogramCrossDown = crossunder(FastMACDHistogram, 0)// alertcondition(FastMACDHistogramCrossUp, title=’Alert-Fast MACD Histogram X Up’, message=’Fast MACD Histogram X Up Over 0 – Trend Meter’)
// alertcondition(FastMACDHistogramCrossDown, title=’Alert-Fast MACD Histogram X Down’, message=’Fast MACD Histogram X Down Under 0 – Trend Meter’)
// alertcondition(FastMACDHistogramCrossUp or FastMACDHistogramCrossDown, title=’Alert-Fast MACD Histogram Cross’, message=’Fast MACD Histogram X Over or Under 0 – Trend Meter’)// // Alerts & Conditions – Top Dog Dad Crossing
// TopDogMomCrossOverDad = crossover(TopDogMom, TopDogDad)
// TopDogMomCrossUnderDad = crossunder(TopDogMom, TopDogDad)// alertcondition(TopDogMomCrossOverDad, title=’Alert-TopDog Mom X Over Dad’, message=’TopDog Mom X Over Dad – Trend Meter’)
// alertcondition(TopDogMomCrossUnderDad, title=’Alert-TopDog Mom X Under Dad’, message=’TopDog Mom X Under Dad – Trend Meter’)
// alertcondition(TopDogMomCrossOverDad or TopDogMomCrossUnderDad, title=’Alert-TopDog Mom Xing Dad’, message=’TopDog Mom Crossing Dad – Trend Meter’)// Alerts – TB1 and TB2 MAs Direction Change
// alertcondition(MA1PositiveDirectionChange, title=’TB1 Fast MA Now Pointing Up’, message=’Trend Bar 1 – Fast MA Now Pointing Up – Trend Meter’)
// alertcondition(MA1NegativeDirectionChange, title=’TB1 Fast MA Now Pointing Down’, message=’Trend Bar 1 – Fast MA Now Pointing Down – Trend Meter’)
// alertcondition(MA1PositiveDirectionChange or MA1NegativeDirectionChange, title=’TB1 Fast MA Changed Direction’, message=’Trend Bar 1 – Fast MA Changed Direction – Trend Meter’)// alertcondition(MA2PositiveDirectionChange, title=’TB1 Slow MA Now Pointing Up’, message=’Trend Bar 1 – Slow MA Now Pointing Up – Trend Meter’)
// alertcondition(MA2NegativeDirectionChange, title=’TB1 Slow MA Now Pointing Down’, message=’Trend Bar 1 – Slow MA Now Pointing Down – Trend Meter’)
// alertcondition(MA2PositiveDirectionChange or MA2NegativeDirectionChange, title=’TB1 Slow MA Changed Direction’, message=’Trend Bar 1 – Slow MA Changed Direction – Trend Meter’)// alertcondition(MA3PositiveDirectionChange, title=’TB2 Fast MA Now Pointing Up’, message=’Trend Bar 2 – Fast MA Now Pointing Up – Trend Meter’)
// alertcondition(MA3NegativeDirectionChange, title=’TB2 Fast MA Now Pointing Down’, message=’Trend Bar 2 – Fast MA Now Pointing Down – Trend Meter’)
// alertcondition(MA3PositiveDirectionChange or MA3NegativeDirectionChange, title=’TB2 Fast MA Changed Direction’, message=’Trend Bar 2 – Fast MA Changed Direction – Trend Meter’)// alertcondition(MA4PositiveDirectionChange, title=’TB2 Slow MA Now Pointing Up’, message=’Trend Bar 2 – Slow MA Now Pointing Up – Trend Meter’)
// alertcondition(MA4NegativeDirectionChange, title=’TB2 Slow MA Now Pointing Down’, message=’Trend Bar 2 – Slow MA Now Pointing Down – Trend Meter’)
// alertcondition(MA4PositiveDirectionChange or MA4NegativeDirectionChange, title=’TB2 Slow MA Changed Direction’, message=’Trend Bar 2 – Slow MA Changed Direction – Trend Meter’)Indico anche il link di un video dove viene spiegata una strategia con il suo utilizzo: https://youtu.be/Vtfa9nJ6A34
Grazie,
Stefano
1 user thanked author for this post.
07/07/2022 at 10:08 PM #19700107/08/2022 at 5:20 PM #197017Gli serve la traduzione del codice, da Tradingview (che io non conosco molto) a ProRealTime.
-
AuthorPosts
Find exclusive trading pro-tools on