0% found this document useful (0 votes)
100 views

Tps Rellenos

The document contains code for adding technical analysis indicators and signals to a trading chart. It includes logic for drawing entry, stop loss and take profit levels, along with alerts and color fill between the levels.

Uploaded by

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

Tps Rellenos

The document contains code for adding technical analysis indicators and signals to a trading chart. It includes logic for drawing entry, stop loss and take profit levels, along with alerts and color fill between the levels.

Uploaded by

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

filllvlLines = input.

int(80, "Opacidad posiciones", minval=1,


maxval=98,group="Risk Management" , inline="levels2")
filllvlLineson = input.bool(true, "Rellno del trade", inline="levels2",group="Risk
Management")

lastTrade(close) => ta.valuewhen(bull or bear , close, 0)

entry = levels ? label.new(time, close, "📌 ENTRY 📌" + str.tostring(lastTrade(close),


decimals), xloc.bar_time, yloc.price, #00e2ff, label.style_label_left, color.rgb(0, 0, 0),
size.normal) : na
label.set_x(entry, label.get_x(entry) + math.round(ta.change(time) * lvlDistance))
label.set_y(entry, lastTrade(close))
label.delete(entry[1])

stop_y = lastTrade(atrStop)

stop = levels ? label.new(time, close, "SL 🕋 " + str.tostring(stop_y, decimals),


xloc.bar_time, yloc.price, red2, label.style_label_left, color.rgb(0, 0, 0), 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])

tp1Rl_y = (lastTrade(close)-lastTrade(atrStop))*1 + lastTrade(close)

tp1Rl = levels ? label.new(time, close, "🥇 TP1 " + str.tostring(tp1Rl_y, decimals),


xloc.bar_time, yloc.price, green2, label.style_label_left, color.rgb(0, 0, 0), size.normal
) : na
label.set_x(tp1Rl, label.get_x(tp1Rl) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp1Rl, tp1Rl_y)
label.delete(tp1Rl[1])

tp2RL_y = (lastTrade(close)-lastTrade(atrStop))*2 + lastTrade(close)


tp2RL = levels ? label.new(time, close, "🥈 TP2 " + str.tostring(tp2RL_y, decimals),
xloc.bar_time, yloc.price, green2, label.style_label_left, color.rgb(0, 0, 0),
size.normal) : na
label.set_x(tp2RL, label.get_x(tp2RL) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp2RL, tp2RL_y)
label.delete(tp2RL[1])

tp3RL_y = (lastTrade(close)-lastTrade(atrStop))*3 + lastTrade(close)

tp3RL = levels ? label.new(time, close, "🥉 TP3 " + str.tostring(tp3RL_y, decimals),


xloc.bar_time, yloc.price, green2, label.style_label_left, color.rgb(0, 0, 0),
size.normal) : na
label.set_x(tp3RL, label.get_x(tp3RL) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp3RL, tp3RL_y)
label.delete(tp3RL[1])

style = linesStyle == "SOLID" ? line.style_solid : linesStyle == "DASHED" ?


line.style_dashed : line.style_dotted
lineEntry = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), lastTrade(close), bar_index + lvlDistance, lastTrade(close),
xloc.bar_index, extend.none, #00e2ff, style, 1) : na, line.delete(lineEntry[1])

lineStop = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :


countBear), stop_y, bar_index + lvlDistance, stop_y, xloc.bar_index, extend.none,
#fe0100, style, 1) : na, line.delete(lineStop[1])
lineTp1Rl = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), tp1Rl_y, bar_index + lvlDistance, tp1Rl_y, xloc.bar_index, extend.none,
green2, style, 1) : na, line.delete(lineTp1Rl[1])
lineTp2RL = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), tp2RL_y, bar_index + lvlDistance, tp2RL_y, xloc.bar_index,
extend.none, green2, style, 1) : na, line.delete(lineTp2RL[1])
lineTp3RL = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), tp3RL_y, bar_index + lvlDistance, tp3RL_y, xloc.bar_index,
extend.none, green2, style, 1) : na, line.delete(lineTp3RL[1])
alertcondition(bull, title='Buy Signal', message = "BUY")
alertcondition(bear, title='sell Signal', message = "BUY")

// Module - Signals FILLING by @comgunner


//-----------------------------------------
//*********************************************************
//* Module *
//* FILLING *
//*********************************************************
// Cálculos

// FILLING
if filllvlLineson
linefill.new(lineStop, lineEntry, color = color.new( #fe00d861, filllvlLines))
linefill.new(lineEntry, lineTp1Rl, color = color.new( #0090fe, filllvlLines))
linefill.new(lineTp1Rl, lineTp2RL, color = color.new(#0090fe, filllvlLines))
linefill.new(lineTp2RL, lineTp3RL, color = color.new(#0090fe, filllvlLines))

You might also like