Crypto_Wolf_Traders_V6
Crypto_Wolf_Traders_V6
0 at
https://mozilla.org/MPL/2.0/
// © Crypto_Wolf_Traders
//@version=5
strategy("Crypto_Wolf_Traders_V6", overlay=true, max_labels_count=500,
default_qty_type = strategy.percent_of_equity, default_qty_value = 25,
initial_capital = 100)
///////////////////////////////////////////////////////////////////////////////
//-----------------------------CRYPTO-WOLF-TRADERS---------------------------//
///////////////////////////////////////////////////////////////////////////////
// SIGNAL MEANINGS//
//"Buy Label" = Strong Buy//
//"Sell Label" = Strong Sell//
//"Don't Long" = Green Cross//
//"Don't Short" = Red Cross//
//"Weak Buy " = Green Circle//
//"Weak Sell" = Red Circle//
//"Reversal Buy" = Green Diamond//
//"Reversal Sell" = Red Diamond//
// Main Indicator
// Functions
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r
: x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
percWidth(len, perc) => (ta.highest(len) - ta.lowest(len)) * perc / 100
securityNoRep(sym, res, src) => request.security(sym, res, src, barmerge.gaps_off,
barmerge.lookahead_on)
swingPoints(prd) =>
pivHi = ta.pivothigh(prd, prd)
pivLo = ta.pivotlow (prd, prd)
last_pivHi = ta.valuewhen(pivHi, pivHi, 1)
last_pivLo = ta.valuewhen(pivLo, pivLo, 1)
hh = pivHi and pivHi > last_pivHi ? pivHi : na
lh = pivHi and pivHi < last_pivHi ? pivHi : na
hl = pivLo and pivLo > last_pivLo ? pivLo : na
ll = pivLo and pivLo < last_pivLo ? pivLo : na
[hh, lh, hl, ll]
f_chartTfInMinutes() =>
float _resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
f_kc(src, len, sensitivity) =>
basis = ta.sma(src, len)
span = ta.atr(len)
[basis + span * sensitivity, basis - span * sensitivity]
wavetrend(src, chlLen, avgLen) =>
esa = ta.ema(src, chlLen)
d = ta.ema(math.abs(src - esa), chlLen)
ci = (src - esa) / (0.015 * d)
wt1 = ta.ema(ci, avgLen)
wt2 = ta.sma(wt1, 3)
[wt1, wt2]
f_top_fractal(src) => src[4] < src[2] and src[3] < src[2] and src[2] > src[1] and
src[2] > src[0]
f_bot_fractal(src) => src[4] > src[2] and src[3] > src[2] and src[2] < src[1] and
src[2] < src[0]
f_fractalize (src) => f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0
f_findDivs(src, topLimit, botLimit) =>
fractalTop = f_fractalize(src) > 0 and src[2] >= topLimit ? src[2] : na
fractalBot = f_fractalize(src) < 0 and src[2] <= botLimit ? src[2] : na
highPrev = ta.valuewhen(fractalTop, src[2], 0)[2]
highPrice = ta.valuewhen(fractalTop, high[2], 0)[2]
lowPrev = ta.valuewhen(fractalBot, src[2], 0)[2]
lowPrice = ta.valuewhen(fractalBot, low[2], 0)[2]
bearSignal = fractalTop and high[1] > highPrice and src[1] < highPrev
bullSignal = fractalBot and low[1] < lowPrice and src[1] > lowPrev
[bearSignal, bullSignal]
// Get components
source = input(close, title = "Smoothring Source", group = "Smoothing")
smrng1_input= input.int(13, "Smring1", 1, 100 , 1 , group = "Smoothing")
smrng1_sens = input.float(defval = 8,title = "sens",minval = 0.1, maxval = 20 ,
step = 0.01 , group = "Smoothing")
smrng2_input= input.int(200, "Smring2", 1, 500 , 1 , group = "Smoothing")
smrng1 = smoothrng(source, smrng1_input, smrng1_sens)
smrng2 = smoothrng(source, smrng2_input, sensitivity)
smrng = (smrng1 + smrng2) / 2
filt = rngfilt(source, smrng)
up = 0.0, up := filt > filt[1] ? nz(up[1]) + 1 : filt < filt[1] ? 0 :
nz(up[1])
dn = 0.0, dn := filt < filt[1] ? nz(dn[1]) + 1 : filt > filt[1] ? 0 :
nz(dn[1])
bullCond = bool(na), bullCond := source > filt and source > source[1] and up > 0
or source > filt and source < source[1] and up > 0
bearCond = bool(na), bearCond := source < filt and source < source[1] and dn > 0
or source < filt and source > source[1] and dn > 0
lastCond = 0, lastCond := bullCond ? 1 : bearCond ? -1 : lastCond[1]
bull = bullCond and lastCond[1] == -1
bear = bearCond and lastCond[1] == 1
smrng3 = smoothrng(source, smrng2_input, sensitivity2)
smrngstrong = (smrng1 + smrng3) / 2
filt2 = rngfilt(source, smrngstrong)
up2 = 0.0, up2 := filt2 > filt2[1] ? nz(up2[1]) + 1 : filt2 < filt2[1] ? 0 :
nz(up2[1])
dn2 = 0.0, dn2 := filt2 < filt2[1] ? nz(dn2[1]) + 1 : filt2 > filt2[1] ? 0 :
nz(dn2[1])
strongbullCond = bool(na), strongbullCond := source > filt2 and source > source[1]
and up2 > 0 or source > filt2 and source < source[1] and up2 > 0
strongbearCond = bool(na), strongbearCond := source < filt2 and source < source[1]
and dn2 > 0 or source < filt2 and source > source[1] and dn2 > 0
lastCond2 = 0, lastCond2 := strongbullCond ? 1 : strongbearCond ? -1 :
lastCond2[1]
strongbull = strongbullCond and lastCond2[1] == -1
strongbear = strongbearCond and lastCond2[1] == 1
countBull = ta.barssince(bull)
countBear = ta.barssince(bear)
countStrongBull = ta.barssince(strongbull)
countStrongBear = ta.barssince(strongbear)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
rsi = ta.rsi(close, 28)
rsiOb = rsi > 78 and rsi > ta.ema(rsi, 10)
rsiOs = rsi < 27 and rsi < ta.ema(rsi, 10)
dHigh = securityNoRep(syminfo.tickerid, "D", high [1])
dLow = securityNoRep(syminfo.tickerid, "D", low [1])
dClose = securityNoRep(syminfo.tickerid, "D", close[1])
ema = ta.ema(close, 144)
emaBull = close > ema
equal_tf(res) => str.tonumber(res) == f_chartTfInMinutes() and not
timeframe.isseconds
higher_tf(res) => str.tonumber(res) > f_chartTfInMinutes() or timeframe.isseconds
too_small_tf(res) => (timeframe.isweekly and res=="1") or (timeframe.ismonthly and
str.tonumber(res) < 10)
securityNoRep1(sym, res, src) =>
bool bull_ = na
bull_ := equal_tf(res) ? src : bull_
bull_ := higher_tf(res) ? request.security(sym, res, src, barmerge.gaps_off,
barmerge.lookahead_on) : bull_
bull_array = request.security_lower_tf(syminfo.tickerid, higher_tf(res) ?
str.tostring(f_chartTfInMinutes()) + (timeframe.isseconds ? "S" : "") :
too_small_tf(res) ? (timeframe.isweekly ? "3" : "10") : res, src)
if array.size(bull_array) > 1 and not equal_tf(res) and not higher_tf(res)
bull_ := array.pop(bull_array)
array.clear(bull_array)
bull_
TF1Bull = securityNoRep1(syminfo.tickerid, "1" , emaBull)
TF3Bull = securityNoRep1(syminfo.tickerid, "3" , emaBull)
TF5Bull = securityNoRep1(syminfo.tickerid, "5" , emaBull)
TF15Bull = securityNoRep1(syminfo.tickerid, "15" , emaBull)
TF30Bull = securityNoRep1(syminfo.tickerid, "30" , emaBull)
TF60Bull = securityNoRep1(syminfo.tickerid, "60" , emaBull)
TF120Bull = securityNoRep1(syminfo.tickerid, "120" , emaBull)
TF240Bull = securityNoRep1(syminfo.tickerid, "240" , emaBull)
TF480Bull = securityNoRep1(syminfo.tickerid, "480" , emaBull)
TFDBull = securityNoRep1(syminfo.tickerid, "1440", emaBull)
[wt1, wt2] = wavetrend(close, 5, 10)
[wtDivBear1, wtDivBull1] = f_findDivs(wt2, 15, -40)
[wtDivBear2, wtDivBull2] = f_findDivs(wt2, 45, -65)
wtDivBull = wtDivBull1 or wtDivBull2
wtDivBear = wtDivBear1 or wtDivBear2
// Colors
white = #00c2fd, white30 = color.new(white, 100)
blue = #fd00fd, blue30 = color.new(blue, 100)
whiteish = #ffffff, whiteish30 = color.new(whiteish , 100)
// Plot
off = percWidth(300, offsetSignal)
barcolor(up > dn ? white : blue)
plotshape(showBuySell and bull ? low - off : na, "Buy Label" , shape.labelup ,
location.absolute, color(#028a14), 0, "Buy" , color.white, size=size.tiny)
plotshape(showBuySell and bear ? high + off : na, "Sell Label", shape.labeldown,
location.absolute, color(#8b010d), 0, "Sell", color.white, size=size.tiny)
plotshape(showStrongBuySell and strongbull ? low - off : na, "Strong Buy Label" ,
shape.labelup , location.absolute, color(#028a14), 0, "Strong" , color.white,
size=size.tiny)
plotshape(showStrongBuySell and strongbear ? high + off : na, "Strong Sell Label",
shape.labeldown, location.absolute, color(#8b010d), 0, "Strong", color.white,
size=size.tiny)
plotshape(ta.crossover(wt1, wt2) and wt2 <= -53, "Don't Sell/Bottom" ,
shape.xcross, location.belowbar, color(#fd0015), size=size.tiny)
plotshape(ta.crossunder(wt1, wt2) and wt2 >= 53, "Don't Buy/Top", shape.xcross,
location.abovebar, color(#00ff22), size=size.tiny)
plotshape(wtDivBull, "Weak Buy ", shape.circle , location.belowbar,
color(#00ff22), size=size.auto)
plotshape(wtDivBear, "Weak Sell", shape.circle, location.abovebar, color(#fd0015),
size=size.auto)
plotshape(showReversal and rsiOs, "Reversal Buy" , shape.diamond,
location.belowbar, color(#00ff22), size=size.tiny)
plotshape(showReversal and rsiOb, "Reversal Sell", shape.diamond,
location.abovebar, color(#fd0015), size=size.tiny)
srcStop = close
atrBand = srcStop * (percentStop / 100)
atrBand2 = srcStop * (percentTake / 100)
atrBand3 = srcStop * (percentTake2 / 100)
atrBand4 = srcStop * (percentTake3 / 100)
atrBand5 = srcStop * (percentTake4 / 100)
atrBand6 = srcStop * (percentTake5 / 100)
atrStop = trigger ? srcStop - atrBand : srcStop + atrBand
atrTake = trigger ? srcStop - atrBand2 : srcStop + atrBand2
atrTake2 = trigger ? srcStop - atrBand3 : srcStop + atrBand3
atrTake3 = trigger ? srcStop - atrBand4 : srcStop + atrBand4
atrTake4 = trigger ? srcStop - atrBand5 : srcStop + atrBand5
atrTake5 = trigger ? srcStop - atrBand6 : srcStop + atrBand6
lastTrade(src) => ta.valuewhen(bull or bear, src, 0)
entry_y = lastTrade(srcStop)
stop_y = lastTrade(atrStop)
tp1_y = (entry_y - lastTrade(atrTake)) + entry_y
tp2_y = (entry_y - lastTrade(atrTake2)) + entry_y
tp3_y = (entry_y - lastTrade(atrTake3)) + entry_y
tp4_y = (entry_y - lastTrade(atrTake4)) + entry_y
tp5_y = (entry_y - lastTrade(atrTake5)) + entry_y
// Labels
labelTpSl(y, txt, color) =>
label labelTpSl = percentStop and enableE != 0 ? label.new(bar_index + 1, y,
txt, xloc.bar_index, yloc.price, color, label.style_label_left, color.white,
size.normal) : na
label.delete(labelTpSl[1])
labelTpSl(entry_y, "Entry: " + str.tostring(math.round_to_mintick(entry_y)), color
= Entry)
labelTpSl(stop_y , "StopLoss: " + str.tostring(math.round_to_mintick(stop_y)),
color = Stop)
labelTpSl(tp1_y, "Take Profit 1: " + str.tostring(math.round_to_mintick(tp1_y)),
color = Tp1)
labelTpSl(tp2_y, "Take Profit 2: " + str.tostring(math.round_to_mintick(tp2_y)),
color = Tp1)
labelTpSl(tp3_y, "Take Profit 3: " + str.tostring(math.round_to_mintick(tp3_y)),
color = Tp1)
labelTpSl(tp4_y, "Take Profit 4: " + str.tostring(math.round_to_mintick(tp4_y)),
color = Tp1)
labelTpSl(tp5_y, "Take Profit 5: " + str.tostring(math.round_to_mintick(tp5_y)),
color = Tp1)
lineTpSl(y, color) =>
line lineTpSl = percentStop and enableE != 0 ? line.new(bar_index - (trigger ?
countBull : countBear) + 4, y, bar_index + 1, y, xloc.bar_index, extend.none,
color, line.style_solid) : na
line.delete(lineTpSl[1])
lineTpSl(entry_y, color = Entry)
lineTpSl(stop_y, color = Stop)
lineTpSl(tp1_y, color = Tp1)
lineTpSl(tp2_y, color = Tp1)
lineTpSl(tp3_y, color = Tp1)
lineTpSl(tp4_y, color = Tp1)
lineTpSl(tp5_y, color = Tp1)
//Strong
srcStrongStop = close
atrBand7 = srcStrongStop * (percentStrongStop / 100)
atrBand8 = srcStrongStop * (percentStrongTake / 100)
atrBand9 = srcStrongStop * (percentStrongTake2 / 100)
atrBand10 = srcStrongStop * (percentStrongTake3 / 100)
atrBand11 = srcStrongStop * (percentStrongTake4 / 100)
atrBand12 = srcStrongStop * (percentStrongTake5 / 100)
atrStop2 = trigger ? srcStrongStop - atrBand7 : srcStrongStop + atrBand7
atrTake6 = trigger ? srcStrongStop - atrBand8 : srcStrongStop + atrBand8
atrTake7 = trigger ? srcStrongStop - atrBand9 : srcStrongStop + atrBand9
atrTake8 = trigger ? srcStrongStop - atrBand10 : srcStrongStop + atrBand10
atrTake9 = trigger ? srcStrongStop - atrBand11 : srcStrongStop + atrBand11
atrTake10 = trigger ? srcStrongStop - atrBand12 : srcStrongStop + atrBand12
lastTrade2(src) => ta.valuewhen(strongbull or strongbear, src, 0)
entry2_y = lastTrade2(srcStrongStop)
stop2_y = lastTrade2(atrStop2)
tp21_y = (entry2_y - lastTrade2(atrTake6)) + entry2_y
tp22_y = (entry2_y - lastTrade2(atrTake7)) + entry2_y
tp23_y = (entry2_y - lastTrade2(atrTake8)) + entry2_y
tp24_y = (entry2_y - lastTrade2(atrTake9)) + entry2_y
tp25_y = (entry2_y - lastTrade2(atrTake10)) + entry2_y
// Labels
labelTpSl2(y, txt, color) =>
label labelTpSl2 = percentStrongStop and enableE != 0 ? label.new(bar_index +
1, y, txt, xloc.bar_index, yloc.price, color, label.style_label_left, color.white,
size.normal) : na
label.delete(labelTpSl2[1])
//labelTpSl2(entry2_y, "Entry: " + str.tostring(math.round_to_mintick(entry2_y)),
color = Entry)
//labelTpSl2(stop2_y , "StopLoss: " + str.tostring(math.round_to_mintick(stop2_y)),
color = Stop)
//labelTpSl2(tp21_y, "Take Profit 1: " +
str.tostring(math.round_to_mintick(tp21_y)), color = Tp1)
//labelTpSl2(tp22_y, "Take Profit 2: " +
str.tostring(math.round_to_mintick(tp22_y)), color = Tp1)
//labelTpSl2(tp23_y, "Take Profit 3: " +
str.tostring(math.round_to_mintick(tp23_y)), color = Tp1)
//labelTpSl2(tp24_y, "Take Profit 4: " +
str.tostring(math.round_to_mintick(tp24_y)), color = Tp1)
//labelTpSl2(tp25_y, "Take Profit 5: " +
str.tostring(math.round_to_mintick(tp25_y)), color = Tp1)
lineTpSl2(y, color) =>
line lineTpSl2 = percentStrongStop and enableE != 0 ? line.new(bar_index -
(trigger ? countStrongBull : countStrongBear) + 4, y, bar_index + 1, y,
xloc.bar_index, extend.none, color, line.style_solid) : na
line.delete(lineTpSl2[1])
//lineTpSl2(entry2_y, color = Entry)
//lineTpSl2(stop2_y, color = Stop)
//lineTpSl2(tp21_y, color = Tp1)
//lineTpSl2(tp22_y, color = Tp1)
//lineTpSl2(tp23_y, color = Tp1)
//lineTpSl2(tp24_y, color = Tp1)
//lineTpSl2(tp25_y, color = Tp1)
float ob = na
array.unshift(ob_top, top)
array.unshift(ob_btm, btm)
array.unshift(ob_avg, avg)
array.unshift(ob_left, time[length])
ob := ob_val
array.remove(ob_top, idx)
array.remove(ob_btm, idx)
array.remove(ob_avg, idx)
array.remove(ob_left, idx)
mitigated
array.unshift(ob_lvl, line.new(na,na,na,na
, xloc = xloc.bar_time
, extend = extend.right
, color = lvl_css
, style = get_line_style(line_style)
, width = line_width))
//Global elements
var os = 0
var target_bull = 0.
var target_bear = 0.
n = bar_index
upper = ta.highest(length)
lower = ta.lowest(length)
if mitigation == 'Close'
target_bull := ta.lowest(close, length)
target_bear := ta.highest(close, length)
else
target_bull := lower
target_bear := upper
[bear_top
, bear_btm
, bear_avg
, bear_left
, bear_ob] = get_coordinates(phv and os == 0, high[length], hl2[length],
high[length])
mitigated_bear = remove_mitigated(bear_top
, bear_btm
, bear_left
, bear_avg
, target_bear
, false)
// Get components
rb = 10
prd = 284
ChannelW = 10
label_loc = 55
style1 = lineStyle1 == "Solid" ? line.style_solid : lineStyle1 == "Dotted" ?
line.style_dotted : line.style_dashed
ph = ta.pivothigh(rb, rb)
pl = ta.pivotlow (rb, rb)
sr_levels = array.new_float(21, na)
prdhighest = ta.highest(prd)
prdlowest = ta.lowest(prd)
cwidth = percWidth(prd, ChannelW)
zonePerc = percWidth(300, zoneWidth)
aas = array.new_bool(41, true)
u1 = 0.0, u1 := nz(u1[1])
d1 = 0.0, d1 := nz(d1[1])
highestph = 0.0, highestph := highestph[1]
lowestpl = 0.0, lowestpl := lowestpl[1]
var sr_levs = array.new_float(21, na)
label hlabel = na, label.delete(hlabel[1])
label llabel = na, label.delete(llabel[1])
var sr_lines = array.new_line(21, na)
var sr_linesH = array.new_line(21, na)
var sr_linesL = array.new_line(21, na)
var sr_linesF = array.new_linefill(21, na)
var sr_labels = array.new_label(21, na)
if ph or pl
for x = 0 to array.size(sr_levels) - 1
array.set(sr_levels, x, na)
highestph := prdlowest
lowestpl := prdhighest
countpp = 0
for x = 0 to prd
if na(close[x])
break
if not na(ph[x]) or not na(pl[x])
highestph := math.max(highestph, nz(ph[x], prdlowest), nz(pl[x],
prdlowest))
lowestpl := math.min(lowestpl, nz(ph[x], prdhighest), nz(pl[x],
prdhighest))
countpp += 1
if countpp > 40
break
if array.get(aas, countpp)
upl = (ph[x] ? high[x + rb] : low[x + rb]) + cwidth
dnl = (ph[x] ? high[x + rb] : low[x + rb]) - cwidth
u1 := countpp == 1 ? upl : u1
d1 := countpp == 1 ? dnl : d1
tmp = array.new_bool(41, true)
cnt = 0
tpoint = 0
for xx = 0 to prd
if na(close[xx])
break
if not na(ph[xx]) or not na(pl[xx])
chg = false
cnt += 1
if cnt > 40
break
if array.get(aas, cnt)
if not na(ph[xx])
if high[xx + rb] <= upl and high[xx + rb] >= dnl
tpoint += 1
chg := true
if not na(pl[xx])
if low[xx + rb] <= upl and low[xx + rb] >= dnl
tpoint += 1
chg := true
if chg and cnt < 41
array.set(tmp, cnt, false)
if tpoint >= strengthSR
for g = 0 to 40 by 1
if not array.get(tmp, g)
array.set(aas, g, false)
if ph[x] and countpp < 21
array.set(sr_levels, countpp, high[x + rb])
if pl[x] and countpp < 21
array.set(sr_levels, countpp, low[x + rb])
// Plot
var line highest_ = na, line.delete(highest_)
var line lowest_ = na, line.delete(lowest_)
var line highest_fill1 = na, line.delete(highest_fill1)
var line highest_fill2 = na, line.delete(highest_fill2)
var line lowest_fill1 = na, line.delete(lowest_fill1)
var line lowest_fill2 = na, line.delete(lowest_fill2)
hi_col = close >= highestph ? colorSup : colorRes
lo_col = close >= lowestpl ? colorSup : colorRes
if enableSR
highest_ := line.new(bar_index - 311, highestph, bar_index, highestph,
xloc.bar_index, expandSR ? extend.both : extend.right, hi_col, style1, lineWidth1)
lowest_ := line.new(bar_index - 311, lowestpl , bar_index, lowestpl ,
xloc.bar_index, expandSR ? extend.both : extend.right, lo_col, style1, lineWidth1)
if useHLZones
highest_fill1 := line.new(bar_index - 311, highestph + zonePerc, bar_index,
highestph + zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
highest_fill2 := line.new(bar_index - 311, highestph - zonePerc, bar_index,
highestph - zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
lowest_fill1 := line.new(bar_index - 311, lowestpl + zonePerc , bar_index,
lowestpl + zonePerc , xloc.bar_index, expandSR ? extend.both : extend.right, na)
lowest_fill2 := line.new(bar_index - 311, lowestpl - zonePerc , bar_index,
lowestpl - zonePerc , xloc.bar_index, expandSR ? extend.both : extend.right, na)
linefill.new(highest_fill1, highest_fill2, color.new(hi_col, 90))
linefill.new(lowest_fill1 , lowest_fill2 , color.new(lo_col, 90))
if ph or pl
for x = 0 to array.size(sr_lines) - 1
array.set(sr_levs, x, array.get(sr_levels, x))
for x = 0 to array.size(sr_lines) - 1
line.delete(array.get(sr_lines, x))
line.delete(array.get(sr_linesH, x))
line.delete(array.get(sr_linesL, x))
linefill.delete(array.get(sr_linesF, x))
if array.get(sr_levs, x) and enableSR
line_col = close >= array.get(sr_levs, x) ? colorSup : colorRes
array.set(sr_lines, x, line.new(bar_index - 355, array.get(sr_levs, x),
bar_index, array.get(sr_levs, x), xloc.bar_index, expandSR ? extend.both :
extend.right, line_col, style1, lineWidth1))
if useZones
array.set(sr_linesH, x, line.new(bar_index - 355, array.get(sr_levs, x)
+ zonePerc, bar_index, array.get(sr_levs, x) + zonePerc, xloc.bar_index, expandSR ?
extend.both : extend.right, na))
array.set(sr_linesL, x, line.new(bar_index - 355, array.get(sr_levs, x)
- zonePerc, bar_index, array.get(sr_levs, x) - zonePerc, xloc.bar_index, expandSR ?
extend.both : extend.right, na))
array.set(sr_linesF, x, linefill.new(array.get(sr_linesH, x),
array.get(sr_linesL, x), color.new(line_col, 90)))
for x = 0 to array.size(sr_labels) - 1
label.delete(array.get(sr_labels, x))
if array.get(sr_levs, x) and enableSR
lab_loc = close >= array.get(sr_levs, x) ? label.style_label_up :
label.style_label_down
lab_col = close >= array.get(sr_levs, x) ? colorSup : colorRes
// Dashboard
var dashboard_loc = locationDashboard == "Top Right" ? position.top_right :
locationDashboard == "Middle Right" ? position.middle_right : locationDashboard ==
"Bottom Right" ? position.bottom_right : locationDashboard == "Top Center" ?
position.top_center : locationDashboard == "Middle Center" ? position.middle_center
: locationDashboard == "Bottom Center" ? position.bottom_center : locationDashboard
== "Top Left" ? position.top_left : locationDashboard == "Middle Left" ?
position.middle_left : position.bottom_left
var dashboard_size = sizeDashboard == "Large" ? size.large : sizeDashboard ==
"Normal" ? size.normal : sizeDashboard == "Small" ? size.small : size.tiny
var dashboard = showDashboard ? table.new(dashboard_loc, 2, 15, tableBgColor,
#000000, 2, tableBgColor, 1) : na
dashboard_cell(column, row, txt, signal=false) => table.cell(dashboard, column,
row, txt, 0, 0, signal ? #000000 : tableTextColor, text_size=dashboard_size)
dashboard_cell_bg(column, row, col) => table.cell_set_bgcolor(dashboard, column,
row, col)
if barstate.islast and showDashboard
dashboard_cell(0, 0 , "Crypto_Wolf_Traders_V6")
dashboard_cell(0, 1 , "Current Position")
dashboard_cell(0, 2 , "Current Trend")
dashboard_cell(0, 3 , "Volume")
dashboard_cell(0, 4 , "Timeframe")
dashboard_cell(0, 5 , "1 min:")
dashboard_cell(0, 6 , "3 min:")
dashboard_cell(0, 7 , "5 min:")
dashboard_cell(0, 8 , "15 min:")
dashboard_cell(0, 9 , "30 min:")
dashboard_cell(0, 10, "1 H:")
dashboard_cell(0, 11, "2 H:")
dashboard_cell(0, 12, "4 H:")
dashboard_cell(0, 13, "8 H:")
dashboard_cell(0, 14, "Daily:")
dashboard_cell(1, 0 , "")
dashboard_cell(1, 1 , trigger ? "Buy" : "Sell", true), dashboard_cell_bg(1, 1,
trigger ? #058809 : #8f0712)
dashboard_cell(1, 2 , emaBull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 2, emaBull ? #047c08 : #8d040f)
dashboard_cell(1, 3 , str.tostring(volume))
dashboard_cell(1, 4 , "Trends")
dashboard_cell(1, 5 , TF1Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 5 , TF1Bull ? #008104 : #85040e)
dashboard_cell(1, 6 , TF3Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 6 , TF3Bull ? #028106 : #8b0510)
dashboard_cell(1, 7 , TF5Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 7 , TF5Bull ? #027c06 : #8d040f)
dashboard_cell(1, 8 , TF15Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 8 , TF15Bull ? #018005 : #80040e)
dashboard_cell(1, 9 , TF30Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 9 , TF30Bull ? #028806 : #85020d)
dashboard_cell(1, 10, TF60Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 10, TF60Bull ? #028006 : #86030e)
dashboard_cell(1, 11, TF120Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 11, TF120Bull ? #038107 : #81030e)
dashboard_cell(1, 12, TF240Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 12, TF240Bull ? #028307 : #74020b)
dashboard_cell(1, 13, TF480Bull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 13, TF480Bull ? #048008 : #81030d)
dashboard_cell(1, 14, TFDBull ? "Bullish" : "Bearish", true),
dashboard_cell_bg(1, 14, TFDBull ? #047c08 : #85020d)
// Previos Day H/L/C
lStyle = lineStyle == "Solid" ? line.style_solid : lineStyle == "Dotted" ?
line.style_dotted : line.style_dashed
dHighLine = showPdHlc ? line.new(bar_index, dHigh, bar_index + 1, dHigh ,
xloc.bar_index, extend.both, lineColor, lStyle, lineWidth) : na,
line.delete(dHighLine[1])
dLowLine = showPdHlc ? line.new(bar_index, dLow , bar_index + 1, dLow ,
xloc.bar_index, extend.both, lineColor, lStyle, lineWidth) : na,
line.delete(dLowLine[1])
dCloseLine = showPdHlc ? line.new(bar_index, dClose, bar_index + 1, dClose,
xloc.bar_index, extend.both, lineColor, lStyle, lineWidth) : na,
line.delete(dCloseLine[1])
////////////////////////////////////////////////////////////////////////////////
//------------------CRYPTO-WOLF-TRADERS-NEURAL-
NETRORK------------------------------------//
////////////////////////////////////////////////////////////////////////////////
price = plot(close, title='Close Line', color=color.new(color.blue, 0),
display=display.none)
////////////////////////////////////////////////////////////////////////////////
//TREND INDICATORS▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
//Trend EMA
tttradetrend = 'Only place BUY or SELL orders with the direction of the Trend EMA.'
tradetrendoption = input.bool(false, title='Only Tade with Trend', group = "NEURAL
NETWORK", tooltip=tttradetrend)
len111 = input.int(defval=200, minval=0, maxval=2000, title='Trend EMA Length')
src111 = close
out111 = ta.ema(src111, len111)
ma111 = plot(out111, title='EMA 200', linewidth=5, color=color.new(color.blue, 0),
offset=0)
mabuy = out111 > out111[1]
masell = out111 < out111[1]
//5 EMAs////////////////////////////////////////////////////////////////////////
len1 = 9
src1 = close
out1 = ta.ema(src1, len1)
ema1color = out1 > out1[1] ? #00bcd4 : #e91e63
ema1 = plot(out1, title='EMA 9', linewidth=3, color=color.new(ema1color, 50),
offset=0, display=display.none)
fill(price, ema1, title='EMA 9 Fill', color=color.new(ema1color, 90),
editable=true)
len2 = 21
src2 = close
out2 = ta.ema(src2, len2)
ema2color = out2 > out2[1] ? #00bcd4 : #e91e63
ema2 = plot(out2, title='EMA 21', linewidth=3, color=color.new(ema2color, 50),
offset=0, display=display.none)
fill(price, ema2, title='EMA 21 Fill', color=color.new(ema2color, 90),
editable=true)
len3 = 55
src3 = close
out3 = ta.ema(src3, len3)
ema3color = out3 > out3[1] ? #00bcd4 : #e91e63
ema3 = plot(out3, title='EMA 55', linewidth=3, color=color.new(ema3color, 50),
offset=0, display=display.none)
fill(price, ema3, title='EMA 55 Fill', color=color.new(ema3color, 90),
editable=true)
len4 = 100
src4 = close
out4 = ta.ema(src4, len4)
ema4color = out4 > out4[1] ? #00bcd4 : #e91e63
ema4 = plot(out4, title='EMA 100', linewidth=3, color=color.new(ema4color, 50),
offset=0, display=display.none)
fill(price, ema4, title='EMA 100 Fill', color=color.new(ema4color, 90),
editable=true)
len5 = 200
src5 = close
out5 = ta.ema(src5, len5)
ema5color = out5 > out5[1] ? #00bcd4 : #e91e63
ema5 = plot(out5, title='EMA 200', linewidth=3, color=color.new(ema5color, 50),
offset=0, display=display.none)
fill(price, ema5, title='EMA 200 Fill', color=color.new(ema5color, 90),
editable=true)
//Supertrend////////////////////////////////////////////////////////////////////
atrPeriod = 10
factor = 3
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
bodyMiddle = plot((open + close) / 2, display=display.none, title='Body Middle
Line')
uptrend = direction < 0 and direction[1] > 0[1] ? supertrend : na
downtrend = direction > 0 and direction[1] < 0[1] ? supertrend : na
//fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
//fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)
//bullishsupertrend = supertrend < close and supertrend[1] > close
//plotshape(uptrend, style=shape.labelup, color=color.green,
location=location.belowbar, size=size.large)
//HMA///////////////////////////////////////////////////////////////////////////
len6 = 100
src6 = close
hma = ta.wma(2 * ta.wma(src6, len6 / 2) - ta.wma(src6, len6),
math.floor(math.sqrt(len6)))
hmacolor = close > hma ? #00e1ff : #fd0256
plot(hma, title='HMA Line', color=color.new(hmacolor, 25), linewidth=5)
//Parabolic SAR/////////////////////////////////////////////////////////////////
start = 0.02
increment = 0.01
maximum = 0.2
psar = ta.sar(start, increment, maximum)
//plot(psar, "ParabolicSAR", style=plot.style_circles, color=#ffffff)
//END▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
////////////////////////////////////////////////////////////////////////////////
//MOMENTUM INCIDATORS▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
//RSI Divergence////////////////////////////////////////////////////////////////
len11 = 14
src11 = close
lbR11 = 2
lbL11 = 6
rangeUpper11 = 60
rangeLower11 = 5
plotBull11 = true
plotHiddenBull11 = false
plotBear11 = true
plotHiddenBear11 = false
bearColor11 = color.red
bullColor11 = color.green
hiddenBullColor11 = color.new(color.green, 80)
hiddenBearColor11 = color.new(color.red, 80)
textColor11 = color.white
noneColor11 = color.new(color.white, 100)
osc11 = ta.rsi(src11, len11)
//MACD Divergence///////////////////////////////////////////////////////////////
fast_length12 = 12
slow_length12 = 26
src12 = close
signal_length12 = 9
sma_source12 = 'EMA'
sma_signal12 = 'EMA'
//Plot colors
col_macd12 = #2962FF
col_signal12 = #FF6D00
col_grow_above12 = #26A69A
col_fall_above12 = #B2DFDB
col_grow_below12 = #FFCDD2
col_fall_below12 = #FF5252
//Calculating
fast_ma12 = sma_source12 == 'SMA' ? ta.sma(src12, fast_length12) : ta.ema(src12,
fast_length12)
slow_ma12 = sma_source12 == 'SMA' ? ta.sma(src12, slow_length12) : ta.ema(src12,
slow_length12)
macd = fast_ma12 - slow_ma12
signal = sma_signal12 == 'SMA' ? ta.sma(macd, signal_length12) : ta.ema(macd,
signal_length12)
hist = macd - signal
//plot(hist, title="Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1]
< hist ? col_grow_above12 : col_fall_above12) : (hist[1] < hist ?
col_grow_below12 : col_fall_below12)))
//plot(macd, title="MACD", color=col_macd12)
//plot(signal, title="Signal", color=col_signal12)
donttouchzero12 = true
lbR12 = 2
lbL12 = 6
rangeUpper12 = 60
rangeLower12 = 5
plotBull12 = true
plotHiddenBull12 = false
plotBear12 = true
plotHiddenBear12 = false
bearColor12 = color.red
bullColor12 = color.green
hiddenBullColor12 = color.new(color.green, 80)
hiddenBearColor12 = color.new(color.red, 80)
textColor12 = color.white
noneColor12 = color.new(color.white, 100)
osc12 = macd
bullCond12 = plotBull12 and priceLL12 and oscHL12 and plFound12 and blowzero12
//plot(plFound12 ? osc12[lbR12] : na, offset=-lbR12, title="Regular Bullish",
linewidth=2, color=(bullCond12 ? bullColor12 : noneColor12))
//plotshape(bullCond12 ? osc12[lbR12] : na, offset=-lbR12, title="Regular Bullish
Label", text=" Bull ", style=shape.labelup, location=location.absolute,
color=bullColor12, textcolor=textColor12)
bearCond12 = plotBear12 and priceHH12 and oscLH12 and phFound12 and bearzero12
//plot(phFound12 ? osc12[lbR12] : na, offset=-lbR12, title="Regular Bearish",
linewidth=2, color=(bearCond12 ? bearColor12 : noneColor12))
//plotshape(bearCond12 ? osc12[lbR12] : na, offset=-lbR12, title="Regular Bearish
Label", text=" Bear ", style=shape.labeldown, location=location.absolute,
color=bearColor12, textcolor=textColor12)
//Divergence
lbR13 = 2
lbL13 = 6
rangeUpper13 = 60
rangeLower13 = 5
plotBull13 = true
plotHiddenBull13 = false
plotBear13 = true
plotHiddenBear13 = false
bearColor13 = color.red
bullColor13 = color.green
hiddenBullColor13 = color.green
hiddenBearColor13 = color.red
textColor13 = color.white
noneColor13 = color.new(color.white, 100)
_inRange13(cond) =>
bars13 = ta.barssince(cond == true)
rangeLower13 <= bars13 and bars13 <= rangeUpper13
//Stochastic Divergence/////////////////////////////////////////////////////////
periodK14 = 14
smoothK14 = 3
periodD14 = 3
k14 = ta.sma(ta.stoch(close, high, low, periodK14), smoothK14)
d14 = ta.sma(k14, periodD14)
//Divergence
lbR14 = 2
lbL14 = 6
rangeUpper14 = 60
rangeLower14 = 5
plotBull14 = true
plotHiddenBull14 = false
plotBear14 = true
plotHiddenBear14 = false
bearColor14 = color.red
bullColor14 = color.green
hiddenBullColor14 = color.green
hiddenBearColor14 = color.red
textColor14 = color.white
noneColor14 = color.new(color.white, 100)
osc14 = k14
_inRange14(cond) =>
bars14 = ta.barssince(cond == true)
rangeLower14 <= bars14 and bars14 <= rangeUpper14
//Regular Bullish
//Hidden Bullish
//Regular Bearish
//Hidden Bearish
//END▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
////////////////////////////////////////////////////////////////////////////////
//VOLATILITY INDICATORS▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
//Divergence
lbR15 = 2
lbL15 = 6
rangeUpper15 = 60
rangeLower15 = 5
plotBull15 = true
plotHiddenBull15 = false
plotBear15 = true
plotHiddenBear15 = false
bearColor15 = color.red
bullColor15 = color.green
hiddenBullColor15 = color.green
hiddenBearColor15 = color.red
textColor15 = color.white
noneColor15 = color.new(color.white, 100)
d15 = rvi
osc15 = d15
_inRange15(cond) =>
bars15 = ta.barssince(cond == true)
rangeLower15 <= bars15 and bars15 <= rangeUpper15
//Regular Bullish
//Hidden Bullish
//Regular Bearish
//Hidden Bearish
length17 = 9
src17 = close
hma17 = ta.wma(2 * ta.wma(src17, length17 / 2) - ta.wma(src17, length17),
math.floor(math.sqrt(length17)))
buy1 = hma17 > level1 and hma17[1] < level1[1] and close > close[2]
buy2 = hma17 > level2 and hma17[1] < level2[1] and close > close[2]
buy3 = hma17 > level3 and hma17[1] < level3[1] and close > close[2]
buy4 = hma17 > level4 and hma17[1] < level4[1] and close > close[2]
buy5 = hma17 > level5 and hma17[1] < level5[1] and close > close[2]
buy6 = hma17 > level6 and hma17[1] < level6[1] and close > close[2]
buy7 = hma17 > level7 and hma17[1] < level7[1] and close > close[2]
buy8 = hma17 > level8 and hma17[1] < level8[1] and close > close[2]
sell1 = hma17 < level1 and hma17[1] > level1[1] and close < close[2]
sell2 = hma17 < level2 and hma17[1] > level2[1] and close < close[2]
sell3 = hma17 < level3 and hma17[1] > level3[1] and close < close[2]
sell4 = hma17 < level4 and hma17[1] > level4[1] and close < close[2]
sell5 = hma17 < level5 and hma17[1] > level5[1] and close < close[2]
sell6 = hma17 < level6 and hma17[1] > level6[1] and close < close[2]
sell7 = hma17 < level7 and hma17[1] > level7[1] and close < close[2]
sell8 = hma17 < level8 and hma17[1] > level8[1] and close < close[2]
//END▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
////////////////////////////////////////////////////////////////////////////////
//VOLUME INDICATORS▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
//OBV Divergence////////////////////////////////////////////////////////////////
len18 = 20
src18 = close
lbR18 = 2
lbL18 = 6
rangeUpper18 = 60
rangeLower18 = 5
plotBull18 = true
plotHiddenBull18 = false
plotBear18 = true
plotHiddenBear18 = false
bearColor18 = color.red
bullColor18 = color.green
hiddenBullColor18 = color.green
hiddenBearColor18 = color.new(color.red, 80)
textColor18 = color.white
noneColor18 = color.new(color.white, 100)
csrc = ta.change(src18)
obv1(src18) =>
ta.cum(ta.change(src18) > 0 ? volume : csrc < 0 ? -volume : 0 * volume)
_inRange(cond) =>
bars = ta.barssince(cond == true)
rangeLower18 <= bars and bars <= rangeUpper18
//VWAP//////////////////////////////////////////////////////////////////////////
computeVWAP(src20, isNewPeriod, stDevMultiplier) =>
var float sumSrcVol = na
var float sumVol = na
var float sumSrcSrcVol = na
hideonDWM = false
var anchor = 'Session'
src20 = hlc3
offset20 = 0
showBands = true
stdevMult = 1.0
timeChange(period) =>
ta.change(time(period))
tcD = timeChange('D')
tcW = timeChange('W')
tcM = timeChange('M')
tc3M = timeChange('3M')
tc12M = timeChange('12M')
float vwapValue = na
float std = na
float upperBandValue = na
float lowerBandValue = na
//Candle Patterns///////////////////////////////////////////////////////////////
//Bullish Engulfing
C_DownTrend = true
C_UpTrend = true
var trendRule1 = 'SMA50'
var trendRule2 = 'SMA50, SMA200'
var trendRule = trendRule1
if trendRule == trendRule1
priceAvg = ta.sma(close, 50)
C_DownTrend := close < priceAvg
C_UpTrend := close > priceAvg
C_UpTrend
if trendRule == trendRule2
sma200 = ta.sma(close, 200)
sma50 = ta.sma(close, 50)
C_DownTrend := close < sma50 and sma50 < sma200
C_UpTrend := close > sma50 and sma50 > sma200
C_UpTrend
C_Len = 14 // ema depth for bodyAvg
C_ShadowPercent = 5.0 // size of shadows
C_ShadowEqualsPercent = 100.0
C_DojiBodyPercent = 5.0
C_Factor = 2.0 // shows the number of times the shadow dominates the candlestick
body
label_color_bullish = color.blue
C_EngulfingBullishNumberOfCandles = 2
C_EngulfingBullish = C_DownTrend and C_WhiteBody and C_LongBody and C_BlackBody[1]
and C_SmallBody[1] and close >= open[1] and open <= close[1] and (close > open[1]
or open < close[1])
if C_EngulfingBullish
var ttBullishEngulfing = 'Engulfing\nAt the end of a given downward trend,
there will most likely be a reversal pattern. To distinguish the first day, this
candlestick pattern uses a small body, followed by a day where the candle body
fully overtakes the body from the day before, and closes in the trend’s opposite
direction. Although similar to the outside reversal chart pattern, it is not
essential for this pattern to completely overtake the range (high to low), rather
only the open and the close.'
ttBullishEngulfing
//label.new(bar_index, patternLabelPosLow, text="BE",
style=label.style_label_up, color = label_color_bullish, textcolor=color.white,
tooltip = ttBullishEngulfing)
//bgcolor(highest(C_EngulfingBullish?1:0, C_EngulfingBullishNumberOfCandles)!=0 ?
color.blue : na, offset=-(C_EngulfingBullishNumberOfCandles-1))
//Bearish Engulfing
label_color_bearish = color.red
C_EngulfingBearishNumberOfCandles = 2
C_EngulfingBearish = C_UpTrend and C_BlackBody and C_LongBody and C_WhiteBody[1]
and C_SmallBody[1] and close <= open[1] and open >= close[1] and (close < open[1]
or open > close[1])
if C_EngulfingBearish
var ttBearishEngulfing = 'Engulfing\nAt the end of a given uptrend, a reversal
pattern will most likely appear. During the first day, this candlestick pattern
uses a small body. It is then followed by a day where the candle body fully
overtakes the body from the day before it and closes in the trend’s opposite
direction. Although similar to the outside reversal chart pattern, it is not
essential for this pattern to fully overtake the range (high to low), rather only
the open and the close.'
ttBearishEngulfing
//label.new(bar_index, patternLabelPosHigh, text="BE",
style=label.style_label_down, color = label_color_bearish, textcolor=color.white,
tooltip = ttBearishEngulfing)
//bgcolor(highest(C_EngulfingBearish?1:0, C_EngulfingBearishNumberOfCandles)!=0 ?
color.red : na, offset=-(C_EngulfingBearishNumberOfCandles-1))
//END▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
////////////////////////////////////////////////////////////////////////////////
//SIGNAL SCORES▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
//Position Options
//longpositions = input(title='Long Positions', defval=true)
//shortpositions = input(title='Short Positions', defval=true)
//Score Requirements
//stronglongscore = input.int(defval=10, minval=0, maxval=1000, title='Required
Strong LONG Score')
//strongshortscore = input.int(defval=10, minval=0, maxval=1000, title='Required
Strong SHORT Score')
//weaklongscore = input.int(defval=8, minval=0, maxval=1000, title='Required Weak
LONG Score')
//weakshortscore = input.int(defval=8, minval=0, maxval=1000, title='Required Weak
SHORT Score')
//END▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
////////////////////////////////////////////////////////////////////////////////
//STOP LOSS WARNINGS▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
////////////////////////////////////////////////////////////////////////////
//END▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
////////////////////////////////////////////////////////////////////////////////
// Alerts
// to automate put this in trendinview message:
{{strategy.order.alert_message}}
i_alert_txt_entry_long = input.text_area(defval = "", title = "Long Entry Message",
group = "Alerts")
i_alert_txt_exit_long = input.text_area(defval = "", title = "Long Exit Message",
group = "Alerts")
i_alert_txt_entry_short = input.text_area(defval = "", title = "Short Entry
Message", group = "Alerts")
i_alert_txt_exit_short = input.text_area(defval = "", title = "Short Exit Message",
group = "Alerts")
i_alert_txt_TP_long = input.text_area(defval = "", title = "Long TP Message", group
= "Alerts")
i_alert_txt_TP_short = input.text_area(defval = "", title = "Short TP Message",
group = "Alerts")
i_alert_txt_SL_long = input.text_area(defval = "", title = "Long SL Message", group
= "Alerts")
i_alert_txt_SL_short = input.text_area(defval = "", title = "Short SL Message",
group = "Alerts")
if bear
strategy.close("Long" , alert_message = i_alert_txt_exit_long)
strategy.entry("Short" , strategy.short, alert_message =
i_alert_txt_entry_short)
strategy.exit("Take Profit 1", from_entry = "Short", limit = tp1_y ,
qty_percent = 20)//, alert_message = i_alert_txt_TP_short)
strategy.exit("Take Profit 2", from_entry = "Short", limit = tp2_y ,
qty_percent = 20)//, alert_message = i_alert_txt_TP_short)
strategy.exit("Take Profit 3", from_entry = "Short", limit = tp3_y ,
qty_percent = 20)//, alert_message = i_alert_txt_TP_short)
strategy.exit("Take Profit 4", from_entry = "Short", limit = tp4_y ,
qty_percent = 30)//, alert_message = i_alert_txt_TP_short)
strategy.exit("Take Profit 5", from_entry = "Short", limit = tp5_y ,
qty_percent = 100)//, alert_message = i_alert_txt_TP_short)
strategy.exit("Stop Loss", from_entry = "Short", loss = stop_y)//,
alert_message = i_alert_txt_SL_short)
MASlope = ta.change(MAValue)
MAPercentRankOK = ta.percentrank(math.abs(MASlope), 200) > Percentile
// Define Trend
Uptrend = UseMATrendFilter and UseAroonTrendFilter ? AroonUptrend and MAUptrend :
(AroonUptrend or not UseAroonTrendFilter) and (MAUptrend or not UseMATrendFilter)
Downtrend = UseMATrendFilter and UseAroonTrendFilter ? AroonDowntrend and
MADowntrend : (AroonDowntrend or not UseAroonTrendFilter) and (MADowntrend or not
UseMATrendFilter)