0% found this document useful (0 votes)
360 views3 pages

Blue Signal Premium by Leo

Uploaded by

Paulo Gaspar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
360 views3 pages

Blue Signal Premium by Leo

Uploaded by

Paulo Gaspar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//@version=5

indicator("Blue Signal Premium by leo", overlay=true)

// Parámetros de entrada
keyValue = input(3, title="Key Value. 'This changes the sensitivity'")
atrPeriod = input(14, title="Value Signals Period")
useHeikinAshi = input(true, title="Activate Signals 90%")
plotSignals = input(true, title="Show Buy/Sell Signals")

// INPUT
src = input(close, title='Source')
modeSwitch = input.string('Hma', title='Hull Variation', options=['Hma', 'Thma',
'Ehma'])
length = input(55, title='Length (180-200 for floating S/R, 55 for swing entry)')
lengthMult = input(1.0, title='Length multiplier (Used to view higher timeframes
with straight band)')
useHtf = input(true, title='Show Hull MA from X timeframe? (Good for scalping)')
htf = input.timeframe('1D', title='Higher Timeframe')
switchColor = input(true, 'Color Hull according to trend?')
candleCol = input(false, title='Color candles based on Hull\'s Trend?')
visualSwitch = input(true, title='Show as a Band?')
thicknesSwitch = input(1, title='Line Thickness')
transpSwitch = input.int(40, title='Band Transparency', step=5)

// Estilo de línea para TP


lineStyle = input.string("Dotted", title="Line Style", options=["Solid", "Dashed",
"Dotted"])

// FUNCIONES
HMA(_src, _length) =>
ta.wma(2 * ta.wma(_src, _length / 2) - ta.wma(_src, _length),
math.round(math.sqrt(_length)))

EHMA(_src, _length) =>


ta.ema(2 * ta.ema(_src, _length / 2) - ta.ema(_src, _length),
math.round(math.sqrt(_length)))

THMA(_src, _length) =>


ta.wma(ta.wma(_src, _length / 3) * 3 - ta.wma(_src, _length / 2) - ta.wma(_src,
_length), _length)

Mode(modeSwitch, src, len) =>


modeSwitch == 'Hma' ? HMA(src, len) : modeSwitch == 'Ehma' ? EHMA(src, len) :
modeSwitch == 'Thma' ? THMA(src, len / 2) : na

_hull = Mode(modeSwitch, src, int(length * lengthMult))


HULL = useHtf ? request.security(syminfo.ticker, htf, _hull) : _hull
MHULL = HULL[0]
SHULL = HULL[2]

hullColor = switchColor ? HULL > HULL[2] ? color.rgb(0, 255, 0, 100) :


color.rgb(255, 0, 0, 100) : color.rgb(255, 153, 0, 100)

// Plot
Fi1 = plot(MHULL, title='MHULL', color=hullColor, linewidth=thicknesSwitch,
transp=50)
Fi2 = plot(visualSwitch ? SHULL : na, title='SHULL', color=hullColor,
linewidth=thicknesSwitch, transp=50)
fill(Fi1, Fi2, title='Band Filler', color=hullColor, transp=transpSwitch)
// Bar color
barcolor(color=candleCol ? switchColor ? hullColor : na : na)

// ATR y Stop Loss


atrValue = ta.atr(atrPeriod)
lossMultiplier = keyValue * atrValue
source = useHeikinAshi ? request.security(syminfo.tickerid, "D", close,
lookahead=barmerge.lookahead_on) : close

var float trailingStop = na


trailingStop := source > nz(trailingStop[1], 0) and source[1] > nz(trailingStop[1],
0) ? (source - lossMultiplier) :
source < nz(trailingStop[1], 0) and source[1] <
nz(trailingStop[1], 0) ? (source + lossMultiplier) :
source > nz(trailingStop[1], 0) ? (source - lossMultiplier) :
(source + lossMultiplier)

var int position = na


position := source[1] < nz(trailingStop[1], 0) and source > nz(trailingStop[1],
0) ? 1 :
source[1] > nz(trailingStop[1], 0) and source < nz(trailingStop[1], 0)
? -1 :
nz(position[1], 0)

plotColor = position == -1 ? #ff525200 : position == 1 ? #4caf4f00 : #2195f300

// Condiciones de compra y venta


crossAboveEMA = ta.crossover(source, trailingStop)
crossBelowEMA = ta.crossover(trailingStop, source)

buyCondition = source > trailingStop and crossAboveEMA


sellCondition = source < trailingStop and crossBelowEMA

// Calcular TP1, TP2 y TP3


tp1Distance = 0.009 // 0.9%
tp2Distance = 0.018 // 1.8%
tp3Distance = 0.036 // 3.6%

var float tp1Level = na


var float tp2Level = na
var float tp3Level = na

if (buyCondition)
tp1Level := close * (1 + tp1Distance)
tp2Level := close * (1 + tp2Distance)
tp3Level := close * (1 + tp3Distance)
if (sellCondition)
tp1Level := close * (1 - tp1Distance)
tp2Level := close * (1 - tp2Distance)
tp3Level := close * (1 - tp3Distance)

// Plot de señales de compra/venta


plotshape(series=buyCondition, title="Buy Signal", location=location.belowbar,
color=color.blue, style=shape.labelup, text="◭BUY◭", textcolor=color.white)
plotshape(series=sellCondition, title="Sell Signal", location=location.abovebar,
color=color.blue, style=shape.labeldown, text="⧩SELL⧩", textcolor=color.white)

// Define el estilo de línea basado en el parámetro de entrada


lineStyleValue = switch lineStyle
"Dashed" => plot.style_linebr
"Dotted" => plot.style_circles
"Solid" => plot.style_line
=> plot.style_line

// Plot de TP1, TP2 y TP3


plot(tp1Level, title="TP1", color=#2195f3b4, linewidth=thicknesSwitch,
style=lineStyleValue)
plot(tp2Level, title="TP2", color=#2195f3b1, linewidth=thicknesSwitch,
style=lineStyleValue)
plot(tp3Level, title="TP3", color=#2195f3b4, linewidth=thicknesSwitch,
style=lineStyleValue)

// Etiquetas para TP1, TP2, TP3


if (buyCondition or sellCondition)
label.new(bar_index, tp1Level, text="TP1\n" + str.tostring(tp1Level,
format.mintick), color=#2195f3b3, textcolor=color.white, size=size.small,
style=label.style_label_down)
label.new(bar_index, tp2Level, text="TP2\n" + str.tostring(tp2Level,
format.mintick), color=#2195f3b1, textcolor=color.white, size=size.small,
style=label.style_label_down)
label.new(bar_index, tp3Level, text="TP3\n" + str.tostring(tp3Level,
format.mintick), color=#2195f3b4, textcolor=color.white, size=size.small,
style=label.style_label_down)

// Alertas para señales de compra/venta y TP1, TP2, TP3


alertcondition(buyCondition, title="Buy Alert", message="Buy signal generated")
alertcondition(sellCondition, title="Sell Alert", message="Sell signal generated")
alertcondition(not na(tp1Level), title="TP1 Alert", message="TP1 level reached")
alertcondition(not na(tp2Level), title="TP2 Alert", message="TP2 level reached")
alertcondition(not na(tp3Level), title="TP3 Alert", message="TP3 level reached")

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy