Money Move
Money Move
//@version=5
indicator('Money Moves [Premium Algo V2]', overlay=true)
///////////////////////////////////////////////////////////////////////////////////
///////
//Main Algo Settings
colors = input.string(title='Color Scheme', defval='DARK', options=['DARK',
'LIGHT'], group="Color Scheme")
bullcolor = colors == 'DARK' ? #00DBFF : color.rgb(0, 255, 8)
bearcolor = colors == 'DARK' ? #E91E63 : color.rgb(255, 0, 0)
Show_Signals = input.bool(true, title="Show Signal", tooltip="Show Long & Short
Signals", group="Signal's Settings")
var int length = input(title='Period', defval=1, group="Signal's Settings")
var float mult = input.float(title='TBSensitivity', step=0.1, defval=10,
group="Signal's Settings")
var float SFilter = input.float(title='Signal Filter', step=0.1, defval=1.0,
group="Signal's Settings")
if t_type == "Default"
length := length
mult := mult
SFilter := SFilter
if t_type == "Scalping"
length := 10
mult := 10
SFilter := 0.5
if t_type == "Intraday"
length := 2
mult := 15
SFilter := 0.5
if t_type == "Swing"
length := 10
mult := 5
SFilter := 1.2
// Color Scheme
//Trend Cloud / Theme
ma2On = input.bool(true, title="Vortex Cloud", group="Cloud")
TBSENSIII = input.int(2, title="Vortex Cloud Sensitivity", group="Cloud")
plotRibsw = input(title='Show Trend Ribbon', defval=true, inline="RIBBON",
group="Chart Features")
xfixtf = input(title='MTF', defval=false, inline="RIBBON", group="Chart Features")
labelSwitch = input(title='Table', defval=false, inline="RIBBON", group="Chart
Features")
plotRibbonPos = input.string(title='Ribbon Position', options=['Top', 'Bottom'],
defval='Bottom', group="Chart Features")
xtf = input.timeframe(title='Select MTF Ribbon', defval='D', group="Chart
Features")
//SMC
color CLEAR = color.rgb(0, 0, 0, 100)
showSMC = input.bool(true, 'Show Smart Money Concepts', tooltip='Show Market
Structure', group='Market Structure')
showSwing = input.bool(false, 'Show Swing Points', tooltip='Show or hide HH, LH,
HL, LL', group="Market Structure")
swingSize = input.int(10, 'Swing Length', tooltip='The number of left and right
bars checked when searching for a swing point. Higher value = less swing points
plotted and lower value = more swing points plotted.', group="Market Structure")
bosConfType = input.string('Candle Close', 'BOS/CHoCH Confirmation', ['Candle
Close', 'Wicks'], tooltip='Choose whether candle close/wick above previous swing
point counts as a BOS/CHoCH.', group="Market Structure")
choch = true
bosStyle = input.string('Solid', 'Line Style', ['Solid', 'Dashed', 'Dotted'],
group="Market Structure")
bosWidth = input.int(1, 'Width', minval=1, group="Market Structure")
Show_PR = input.bool(true, title="Show Top/Bottom", tooltip="Show's Top/Bottem -
'Don't Buy' = Green/Blue Cross | 'Don't Sell' = Red/Pink Cross ", group="Top /
Bottom")
TBSensi = input.int(5, title="Top/Bottom Sensitivity", tooltip="The Greater The
Value The Stronger The Top/Bottom", group="Top / Bottom")
// algo
atr = mult * ta.atr(length)
longStop = hl2 - atr * SFilter
longStopPrev = nz(longStop[1], longStop)
longStop := close[1] > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = hl2 + atr * SFilter
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := close[1] < shortStopPrev ? math.min(shortStop, shortStopPrev) :
shortStop
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and close > shortStopPrev ? 1 : dir == 1 and close <
longStopPrev ? -1 : dir
longColor = color.blue
shortColor = color.blue
// Conditions 1
longCond = bool(na)
shortCond = bool(na)
longCond := ta.crossover(close[1], shortStopPrev)
shortCond := ta.crossunder(close[1], longStopPrev)
// Conditions 2
longCond2 = bool(na)
shortCond2 = bool(na)
longCond2 := ta.crossover(close[1], shortStopPrev)
shortCond2 := ta.crossunder(close[1], longStopPrev)
// Conditions 3
longCond3 = bool(na)
shortCond3 = bool(na)
longCond3 := ta.crossover(close[1], shortStopPrev)
shortCond3 := ta.crossunder(close[1], longStopPrev)
// Count your long short conditions for more control with Pyramiding
sectionLongs = 0
sectionLongs := nz(sectionLongs[1])
sectionShorts = 0
sectionShorts := nz(sectionShorts[1])
if longCond
sectionLongs += 1
sectionShorts := 0
if shortCond
sectionLongs := 0
sectionShorts += 1
// Count your long short conditions for more control with Pyramiding 2
sectionLongs2 = 0
sectionLongs2 := nz(sectionLongs2[1])
sectionShorts2 = 0
sectionShorts2 := nz(sectionShorts2[1])
if longCond2
sectionLongs2 += 1
sectionShorts2 := 0
if shortCond2
sectionLongs2 := 0
sectionShorts2 += 1
// Count your long short conditions for more control with Pyramiding 3
sectionLongs3 = 0
sectionLongs3 := nz(sectionLongs3[1])
sectionShorts3 = 0
sectionShorts3 := nz(sectionShorts3[1])
if longCond3
sectionLongs3 += 1
sectionShorts3 := 0
if shortCond3
sectionLongs3 := 0
sectionShorts3 += 1
// Pyramiding
pyrl = 1
// Pyramiding 2
pyr2 = 1
// Pyramiding 3
pyr3 = 1
// These check to see your signal and cross references it against the pyramiding
settings above
longCondition = longCond and sectionLongs <= pyrl
shortCondition = shortCond and sectionShorts <= pyrl
// These check to see your signal and cross references it against the pyramiding
settings above 2
longCondition2 = longCond2 and sectionLongs2 <= pyr2
shortCondition2 = shortCond2 and sectionShorts2 <= pyr2
// These check to see your signal and cross references it against the pyramiding
settings above 3
longCondition3 = longCond3 and sectionLongs3 <= pyr3
shortCondition3 = shortCond3 and sectionShorts3 <= pyr3
// Money Management
Show_SL_TP = input.bool(false, title="Show TP/SL Points", group="AUTO RISK
MANAGEMENT v1", tooltip="Show Take Profit | Stop Loss Points")
isTPl = input(true, 'TP - 1', group="AUTO RISK MANAGEMENT v1", inline="ARM")
isTPs = isTPl
tp = input(0.25, 'Take Profit % - 1')
long_tp = isTPl and Show_SL_TP and ta.crossover(high, (1 + tp / 100) *
last_open_longCondition) and longCondition == 0 and in_longCondition == 1
short_tp = isTPs and Show_SL_TP and ta.crossunder(low, (1 - tp / 100) *
last_open_shortCondition) and shortCondition == 0 and in_shortCondition == 1
// TP 2
isTP2 = input(true, 'TP - 2', group="AUTO RISK MANAGEMENT v1", inline="ARM")
isTPs2 = isTP2
tp2 = input(0.75, 'Take Profit % - 2')
long_tp2 = isTP2 and Show_SL_TP and ta.crossover(high, (1 + tp2 / 100) *
last_open_longCondition2) and longCondition2 == 0 and in_longCondition2 == 1
short_tp2 = isTPs2 and Show_SL_TP and ta.crossunder(low, (1 - tp2 / 100) *
last_open_shortCondition2) and shortCondition2 == 0 and in_shortCondition2 == 1
// TP 3
isTP3 = input(true, 'TP - 3', group="AUTO RISK MANAGEMENT v1", inline="ARM")
isTPs3 = isTP3
tp3 = input.float(1.0, 'Take Profit % - 3')
long_tp3 = isTP3 and Show_SL_TP and ta.crossover(high, (1 + tp3 / 100) *
last_open_longCondition) and longCondition == 0 and in_longCondition == 1
short_tp3 = isTPs3 and Show_SL_TP and ta.crossunder(low, (1 - tp3 / 100) *
last_open_shortCondition) and shortCondition == 0 and in_shortCondition == 1
// BreakEven
isSLl = input(false, 'Breakeven', group="AUTO RISK MANAGEMENT v1", inline="ARM2")
isSLs = isSLl
sl = 0.0
sl := input.float(0.4, 'Break Even %')
long_sl = isSLl and Show_SL_TP and ta.crossunder(low, (1 - sl / 100) *
last_open_longCondition) and longCondition == 0 and in_longCondition == 1
short_sl = isSLs and Show_SL_TP and ta.crossover(high, (1 + sl / 100) *
last_open_shortCondition) and shortCondition == 0 and in_shortCondition == 1
// Stop Loss 2
isSLl2 = input(false, 'Stop Loss', group="AUTO RISK MANAGEMENT v1", inline="ARM2")
isSLs2 = isSLl2
sl2 = 0.0
sl2 := input.float(0.4, 'Stop Loss %')
long_sl2 = isSLl2 and Show_SL_TP and ta.crossunder(low, (1 - sl2 / 100) *
last_open_longCondition2) and longCondition2 == 0 and in_longCondition2 == 1
short_sl2 = isSLs2 and Show_SL_TP and ta.crossover(high, (1 + sl2 / 100) *
last_open_shortCondition2) and shortCondition2 == 0 and in_shortCondition2 == 1
//Signals
bton(b) =>
b ? 1 : 0
//Stoploss 1 plotchar
plotchar(long_sl and last_longCondition > nz(last_long_close[1]) and isSLl,
char='✅', text='BE LONG', title='Break Even Long', size=size.tiny,
location=location.abovebar, color=color.new(color.green, 0))
plotchar(short_sl and last_shortCondition > nz(last_short_close[1]) and isSLl,
char='✅', text='BE SHORT', title='Break Even Short', size=size.tiny,
location=location.belowbar, color=color.new(#fd4d4d, 0))
//Stoploss 2 plotchar
plotchar(long_sl2 and last_longCondition2 > nz(last_long_close2[1]), char='⛔',
text='SL LONG', title='Stop Loss Long', size=size.tiny, location=location.abovebar,
color=color.new(color.red, 0))
plotchar(short_sl2 and last_shortCondition2 > nz(last_short_close2[1]), char='⛔',
text='SL SHORT', title='Stop Loss Short', size=size.tiny,
location=location.belowbar, color=color.new(color.red, 0))
trigger = bull ? 1 : 0
countBull = ta.barssince(bull)
countBear = ta.barssince(bear)
atrBand = ta.atr(atrLen) * atrRisk
atrStop = trigger == 1 ? low - atrBand : high + atrBand
stop_y = lastTrade(atrStop)
stop = levels ? label.new(time, close, "SL " + str.tostring(stop_y, decimals),
xloc.bar_time, yloc.price, bearcolor, label.style_label_left, color.white,
size.normal) : na
label.set_x(stop, label.get_x(stop) + math.round(ta.change(time) * lvlDistance))
label.set_y(stop, stop_y)
label.delete(stop[1])
// SMC v2
// Functions
lineStyle(x) =>
switch x
'Solid' => line.style_solid
'Dashed' => line.style_dashed
'Dotted' => line.style_dotted
// Calculations
//Finding high and low pivots
pivHi = ta.pivothigh(high, swingSize, swingSize)
pivLo = ta.pivotlow(low, swingSize, swingSize)
//Variable to track the previous swing type, used later on to draw 0.5 Retracement
Levels (HH = 2, LH = 1, HL = -1, LL = -2)
var int prevSwing = 0
if not na(pivHi)
if pivHi >= prevHigh
hh := true
prevSwing := 2
else
lh := true
prevSwing := 1
prevHigh := pivHi
highActive := true
prevHighIndex := bar_index - swingSize
if not na(pivLo)
if pivLo >= prevLow
hl := true
prevSwing := -1
else
ll := true
prevSwing := -2
prevLow := pivLo
lowActive := true
prevLowIndex := bar_index - swingSize
// Visual Output
//Swing level labels
if hh and showSwing
label.new(bar_index - swingSize, pivHi, 'HH', color=CLEAR,
style=label.style_label_down, textcolor=chart.fg_color)
if lh and showSwing
label.new(bar_index - swingSize, pivHi, 'LH', color=CLEAR,
style=label.style_label_down, textcolor=chart.fg_color)
if hl and showSwing
label.new(bar_index - swingSize, pivLo, 'HL', color=CLEAR,
style=label.style_label_up, textcolor=chart.fg_color)
if ll and showSwing
label.new(bar_index - swingSize, pivLo, 'LL', color=CLEAR,
style=label.style_label_up, textcolor=chart.fg_color)
// Trend Cloud
length2 = 10 * (TBSENSIII / 2)
source2 = close
aboveColor2 = color.rgb(70, 219, 255, 100)
belowColor2 = color.rgb(233, 30, 99, 100)
ma3On = true
length3 = 40 * (TBSENSIII / 2)
source3 = close
aboveColor3 = color.rgb(70, 219, 255, 100)
belowColor3 = color.rgb(233, 30, 99, 100)
// Trap Detector
// Functions
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]
// Get components
[wt1, wt2] = wavetrend(close, 5 * TBSensi, 10 * TBSensi)
[wtDivBear1, wtDivBull1] = f_findDivs(wt2, 15, -40)
[wtDivBear2, wtDivBull2] = f_findDivs(wt2, 45, -65)
wtDivBull = wtDivBull1 or wtDivBull2
wtDivBear = wtDivBear1 or wtDivBear2
plotshape(ta.crossover(wt1, wt2) and Show_PR and wt2 <= -53, "Don't Sell/Bottom",
shape.xcross, location.belowbar, color(bullcolor), size=size.tiny)
plotshape(ta.crossunder(wt1, wt2) and Show_PR and wt2 >= 53, "Don't Buy/Top",
shape.xcross, location.abovebar, color(bearcolor), size=size.tiny)
// Init Variables
pos = 0
trailing_sl = 0.0
// Calculate SL
trailing_sl := short_signal ? high + sl_val : long_signal ? low - sl_val :
nz(pos[1]) == 1 ? math.max(low - sl_val, nz(trailing_sl[1])) : nz(pos[1]) == -1 ?
math.min(high + sl_val, nz(trailing_sl[1])) : nz(trailing_sl[1])
// Position var
pos := long_signal ? 1 : short_signal ? -1 : nz(pos[1])
// PLOTINGS //
plot(ShowTrailingSl ? trailing_sl : na, title="Trailing StopLoss", linewidth=2,
color=pos == 1 ? bullcolor : bearcolor)
//Alerts
alertcondition(dir == 1 and dir[1] == -1 ? longStop : na, title='BUY',
message='Pair : {{ticker}} | Type: Long ✅ | TimeFrame : {{interval}} | Entry Price
- {{close}} |||||||||||||||||||| StopLoss - {{plot("SL")}} ||||||||||||||||| TP1
Price - {{plot("TP1")}} |||||||||||||||| TP2 Price - {{plot("TP2")}}
|||||||||||||||| TP3 Price - {{plot("TP3")}} |||||||||||||||| ' )
alertcondition(dir == -1 and dir[1] == 1 ? shortStop : na, title='SELL',
message='Pair : {{ticker}} | Type: Short ✅ | TimeFrame : {{interval}} | Entry Price
- {{close}} |||||||||||||||||||| StopLoss - {{plot("SL")}} ||||||||||||||||| TP1
Price - {{plot("TP1")}} |||||||||||||||| TP2 Price - {{plot("TP2")}}
|||||||||||||||| TP3 Price - {{plot("TP3")}} |||||||||||||||| ')
// Alerts //
alertcondition(short_signal or long_signal, 'Trailing SL', 'Trailing SL')
trc(number) =>
factor = math.pow(10, dec)
int(number * factor) / factor
trc_(number) =>
factor = math.pow(10, 0)
int(number * factor) / factor
xsrc = close
xprd1 = 12
xsrc2 = close
xprd2 = 26
xsmooth = 1
xPrice = ta.ema(xsrc, xsmooth)
FastMA = xfixtf ? ta.ema(request.security(syminfo.tickerid, xtf, ta.ema(xsrc,
xprd1)), xsmooth) : ta.ema(xPrice, xprd1)
xPrice2 = ta.ema(xsrc2, xsmooth)
SlowMA = xfixtf ? ta.ema(request.security(syminfo.tickerid, xtf, ta.ema(xsrc2,
xprd2)), xsmooth) : ta.ema(xPrice2, xprd2)
// Label
labelstyle = close > SlowMA ? label.style_label_down : label.style_label_up
labelyloc = close > SlowMA ? yloc.abovebar : yloc.belowbar
labeltcolor = buy ? color.black : sell ? color.white : close > close[1] ? bullcolor
: bearcolor
labelbgcolor = buy ? bullcolor : sell ? bearcolor : color.silver
labeltext = buy ? 'Long on next bar\n' : sell ? 'Short on next bar\n' : ' '
trendText = bullTribbonish ? 'Bullish' : Tribbonish ? 'Bearish' : 'Sideways'