https://tr.tradingview.com/v/vwUt3cEJ/ trend hesaplaması.....
https://www.tradingview.com/x/RphIbUoL/
https://tr.tradingview.com/v/hjJw9cqN/ trend hesaplaması....
https://www.tradingview.com/x/bwCd1qHV/
https://tr.tradingview.com/v/g6Nyg5kS/ trend hesaplaması.....
https://www.tradingview.com/x/lqDItsjW/
üçünün kombine birleşmiş ve sade hali.....
https://www.tradingview.com/x/8tAQCJz7/
PHP Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © JacobMagleby
//@version=5
// { <DECLARATION STATEMENT>
indicator(title = "Dodge Trend [JacobMagleby]", shorttitle = "Dodge Trend [JacobMagleby] - Version 1.0.0", overlay = true, timeframe = "")
// } <DECLARATION STATEMENT>
// { <CONSTANT_DECLARATIONS>
INDICATOR_GROUP = "Indicator Settings"
COLOR_GROUP = "Color Settings"
COLOR_INLINE = "Color Inline"
// } <CONSTANTS>
// { <INPUTS>
lengthInput = input.int(
title = "Length",
defval = 5,
minval = 1,
group = INDICATOR_GROUP,
tooltip = "How Much Price Action To Take Into Consideration. Lower Values = More Reactive To Current Market Volatility.")
sizeInput = input.float(
title = "Size",
defval = 3.0,
minval = 0.1,
step = 0.1,
group = INDICATOR_GROUP,
tooltip = "How Wide The Gap Is From The Current Price To The Line When Flipping.")
sourceInput = input.source(
title = "Source",
defval = hl2,
group = INDICATOR_GROUP,
tooltip = "Source For The Dodge Line")
dodgeIntensity = input.float(
title = "Dodge Intensity",
defval = 95.0,
minval = 0.0,
maxval = 99,
step = 0.1,
group = INDICATOR_GROUP,
tooltip= "How Intense/Aggressive The Dodge Effect Is. Anything Above 96 Will Get Very Intense. 95 Is Recommended Default. 0 Will Yield Almost No Dodge Effect.")
upColorInput = input.color(
title = "",
defval = color.green,
group = COLOR_GROUP,
inline = COLOR_INLINE)
downColorInput = input.color(
title = "",
defval = color.red,
group = COLOR_GROUP,
inline = COLOR_INLINE)
// } <INPUTS>
// { <USER DEFINED TYPES>
type dodgeTrend
int length
float size
float source
color upColor
color downColor
float trueRangeAverage
float referenceTop
float referenceBottom
float lowestReferenceTop
float highestReferenceBottom
float activeTop
float activeBottom
float combinedValue
float direction
color currentColor
method updateDependencies(dodgeTrend self)=>
trueRangeAverage = ta.sma(ta.tr, lengthInput)
self.referenceTop := sourceInput + (trueRangeAverage * sizeInput)
self.referenceBottom := sourceInput - (trueRangeAverage * sizeInput)
if na(self.direction) and not na(self.referenceTop)
self.direction := 1
self.activeTop := na
self.activeBottom := self.referenceBottom
self.combinedValue := self.referenceBottom
self.highestReferenceBottom := self.referenceBottom
self.currentColor := self.upColor
self
method updateActives(dodgeTrend self)=>
self.lowestReferenceTop := ta.change(self.direction) ? self.referenceTop :
self.lowestReferenceTop
self.highestReferenceBottom := ta.change(self.direction) ? self.referenceBottom :
self.highestReferenceBottom
self.activeTop := self.direction == -1 and self.direction[1] == 1 ? self.referenceTop :
self.direction == 1 and self.direction[1] == -1 > 0 ? na :
self.activeTop
self.activeBottom := self.direction == 1 and self.direction[1] == -1 ? self.referenceBottom :
self.direction == -1 and self.direction[1] == 1 ? na :
self.activeBottom
rPrevB = self.referenceBottom[1]
rPrevBH = self.highestReferenceBottom
rPrevT = self.referenceTop[1]
rPrevTH = self.lowestReferenceTop
pullback = .60 * (100 - dodgeIntensity)
recover = .40 * (100 - dodgeIntensity)
if self.direction == 1
self.highestReferenceBottom := self.referenceBottom > self.highestReferenceBottom ? self.referenceBottom :
self.highestReferenceBottom
self.activeBottom := self.highestReferenceBottom > rPrevBH ? self.activeBottom + (self.highestReferenceBottom - rPrevBH) :
self.referenceBottom < rPrevB ? self.activeBottom - ((rPrevB - self.referenceBottom) / pullback) :
self.referenceBottom > rPrevB ? self.activeBottom + ((self.referenceBottom - rPrevB) / recover) :
self.activeBottom
self.combinedValue := self.activeBottom
self.direction := close < self.activeBottom ? -1 :
self.direction
self.currentColor := self.upColor
else
self.lowestReferenceTop := self.referenceTop < self.lowestReferenceTop ? self.referenceTop :
self.lowestReferenceTop
self.activeTop := self.lowestReferenceTop < rPrevTH ? self.activeTop - (rPrevTH - self.lowestReferenceTop) :
self.referenceTop > rPrevT ? self.activeTop + ((self.referenceTop - rPrevT) / pullback) :
self.referenceTop < rPrevT ? self.activeTop - ((rPrevT - self.referenceTop) / recover) :
self.activeTop
self.combinedValue := self.activeTop
self.direction := close > self.activeTop ? 1 :
self.direction
self.currentColor := self.downColor
self
method run(dodgeTrend self)=>
self.updateDependencies()
self.updateActives()
self
// } <USER DEFINED TYPES>
// { <CALCULATIONS>
var dodgeTrend = dodgeTrend.new(
length = lengthInput,
size = sizeInput,
source = sourceInput,
upColor = upColorInput,
downColor = downColorInput)
dodgeTrend.run()
// } <CALCULATIONS>
// { <VISUALS>
topBoundry = dodgeTrend.combinedValue + (ta.atr(1000) / 3)
botBoundry = dodgeTrend.combinedValue - (ta.atr(1000) / 3)
invisible = color.new(color.white, 100)
//topBoundryPlot = plot(topBoundry, color = invisible, editable = false)
//botBoundryPlot = plot(botBoundry, color = invisible, editable = false)
centerBoundryPlot = plot(dodgeTrend.combinedValue, "Dodge Trend", dodgeTrend.currentColor, 2)
//fill(topBoundryPlot, centerBoundryPlot, topBoundry, dodgeTrend.combinedValue, invisible, color.new(dodgeTrend.currentColor, 75))
//fill(centerBoundryPlot, botBoundryPlot, dodgeTrend.combinedValue, botBoundry, color.new(dodgeTrend.currentColor, 75), invisible)
// } <VISUALS>
// { <ALERTS>
alertcondition(
condition = dodgeTrend.direction == 1 and dodgeTrend.direction[1] == -1,
title = "Dodge Trend Flips Up")
alertcondition(
condition = dodgeTrend.direction == -1 and dodgeTrend.direction[1] == 1,
title = "Dodge Trend Flips Down")
// } <ALERTS>
/////////////////////////////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © justatradebro
//@version=5
ima_color = input.color(color.orange, title = 'IMA Color')
trail_color_up = input.color(color.rgb(76, 175, 79, 70), title = 'Trail Up')
trail_color_down = input.color(color.rgb(255, 82, 82, 70), title = 'Trail Down')
//candle_color_up = input.color(color.green, title = 'Candle Up')
//candle_color_down = input.color(color.red, title = 'Candle Down')
// IMA Calculation
length = 5 // Length parameter for IMA calculation
ph = 0.0
pl = 0.0
alpha = 2.5 / (length + 1)
ima = 0.0
ima := alpha * ohlc4[1] + (1 - alpha) * nz(ima[1])
p1 = plot(ima, color=ima_color, linewidth=2, title="Instantaneous Moving Average")
lowest_low = ta.lowest(low[1], 5)
highest_high = ta.highest(high[1], 5)
avg_low = ta.sma(low[1], 5)
avg_high = ta.sma(high[1], 5)
// Trailing stop
a = 0.0
b = 0.0
z = 0.0
c = 0.0
l = 0.0
s = 0.0
trail = 0.0
if bar_index > 1 and nz(a[1]) == 1
b := math.max(lowest_low, nz(b[1]))
z := avg_high < nz(b[1]) and close < low[1] ? 1 : nz(z[1])
a := avg_high < nz(b[1]) and close < low[1] ? 0 : nz(a[1])
c := avg_high < nz(b[1]) and close < low[1] ? highest_high : nz(c[1])
else if nz(a[1]) == 0
c := math.min(highest_high, nz(c[1]))
z := avg_low > nz(c[1]) and close > high[1] ? 0 : nz(z[1])
a := avg_low > nz(c[1]) and close > high[1] ? 1 : nz(a[1])
b := avg_low > nz(c[1]) and close > high[1] ? lowest_low : nz(b[1])
else
b := nz(b[1])
z := nz(z[1])
a := nz(a[1])
c := nz(c[1])
if z == 0
l := nz(z[1]) != 0 ? nz(s[1]) : math.max(nz(b[1]), nz(l[1]))
s := 0
else if nz(z[1]) != 1
s := nz(l[1])
l := 0
else if z == 1
s := math.min(c, nz(s[1]))
l := nz(l[1])
else
l := nz(l[1])
s := nz(s[1])
if l > 0
trail := l
else
trail := s
trail_color_cond = ima < trail ? trail_color_down : trail_color_up
//candle_color_cond = ohlc4 < trail ? candle_color_down : candle_color_up
//p2 = plot(trail, color=trail_color_cond, title = "Trail")
//plotcandle(open,high,low,close, color=candle_color_cond, wickcolor=candle_color_cond, bordercolor = candle_color_cond)
//fill(plot1=p1, plot2=p2, color=trail_color_cond)
//////////////////////////////////////////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TZack88
//@version=5
// ** ---> Inputs ------------- {
var bool positive = false
var bool negative = false
string RSI_group = "RSI Settings"
string mom_group = "Momentum Vales"
string visual = "Visuals"
int Len2 = input(14,"RSI 1ï¸âƒ£",inline = "rsi",group = RSI_group)
int pmom = input(65," Positive above",inline = "rsi1",group =RSI_group )
int nmom = input(32,"Negative below",inline = "rsi1",group =RSI_group )
bool showlabels = input(true,"Show Momentum â“",inline = "001",group =visual )
color p = input(color.rgb(76, 175, 79, 62),"Positive",inline = "001",group =visual )
color n = input(color.rgb(255, 82, 82, 66),"Negative",inline = "001",group =visual )
bool filleshow = input(true,"Show highlighter â“",inline = "002",group =visual )
color bull = input(color.rgb(76, 175, 79, 62),"Bull",inline = "002",group =visual )
color bear = input(color.rgb(255, 82, 82, 66),"Bear",inline = "002",group =visual )
rsi = ta.rsi(close, Len2)
//------------------- }
// ** ---> Momentums ------------- {
p_mom = rsi[1] < pmom and rsi > pmom and rsi > nmom and ta.change(ta.ema(close,5)) > 0
n_mom = rsi < nmom and ta.change(ta.ema(close,5)) < 0
if p_mom
positive:= true
negative:= false
if n_mom
positive:= false
negative:= true
// ** ---> Entry Conditions ------------- {
a11 = plot(filleshow ? ta.ema(high,5) : na,display = display.none,editable = false)
b11 = plot(filleshow ? ta.ema(low,10) : na,style = plot.style_stepline,color = color.red,display = display.none,editable = false)
// fill(a,b,color = color.from_gradient(rsi14,35,pmom,color.rgb(255, 82, 82, 66),color.rgb(76, 175, 79, 64)) )
fill(a11,b11,color = positive ? bull :bear ,editable = false)
//plotting
pcondition = positive and not positive[1]
ncondition2 = negative and not negative[1]
plotshape(showlabels ? pcondition: na , title="Positive Signal",style=shape.labelup, color=p, location= location.belowbar , size=size.tiny,text= "Positive",textcolor = color.white)
plotshape(showlabels ? ncondition2: na , title="Negative Signal",style=shape.labeldown, color=n, location= location.abovebar , size=size.tiny,text = "Negative",textcolor = color.white)
// Alerts
alertcondition(pcondition,"Positive Trend")
alertcondition(ncondition2,"Negative Trend")