Modify line length based on certain candle?

0

05vprice

New member
Hello everyone!

I am sure this is going to be very simple for someone, but I am stuck haha. Take a look at the image below. I am trying to only allow that magenta line to go to the right 3 candles. I will also share the code I am using to draw the line too. I'd appreciate any help. I have came across many other posts that have lines plotted, but I was unable to get any snippets to work with my plot :(

input showRetraceLine = Yes;
input extendRetraceLine = Yes;

def upper50line = if meetsCriteriaUp and showRetraceLine then high[1] - retraceAmt else If(extendRetraceLine, upper50line[1], Double.NaN);

plot DrawUpper50 = upper50line;
DrawUpper50.SetDefaultColor(Color.CYAN);
DrawUpper50.SetPaintingStrategy(PaintingStrategy.DASHES);
 
Last edited by a moderator:
BenTen

BenTen

Administrative
Staff
VIP
Your code appears to be incomplete. Based on our private conversation, it looks like you need help with a premium indicator you purchased somewhere else. Not sure if someone on here will be able to help with your request. I would recommend reaching out to the developer and ask for help.
 
0

05vprice

New member
Developer doesn’t respond and I posted the entire portion of the code that involves the plotting of the line. Just thought someone might have an idea of how to add to this or change how the line is drawn to be limited.
 
horserider

horserider

Well-known member
VIP
How can this plot when some of it is not defined? Did you even get this to plot in T0S?

def upper50line = if meetsCriteriaUp and showRetraceLine then high[1] - retraceAmt else If(extendRetraceLine, upper50line[1], Double.NaN);
 
0

05vprice

New member
MeetscriteriaUp and retraceAmt are just conditions doesn’t need to be anything complicated. I didn’t think those really mattered in terms of plotting the actual line. I’m by far not an expert or very experienced with this. I can post more of the code. I didn’t know what all was needed for you guys to help. It does plot just as it did in the image I attached.
 
horserider

horserider

Well-known member
VIP
Ok, tried it. Does not plot. At least the code you provided. Throws errors as shown below. Your ToS must work different than mine. o_O

Expected double
No such variable: meetsCriteriaUp at 4:22
No such variable: retraceAmt at 4:73
No such variable: meetsCriteriaUp at 4:22
No such variable: retraceAmt at 4:73
 
0

05vprice

New member
I have meetsCriteriaUp and retraceAmt defined in my code I just didn’t post those snippets above. We could just remove meetsCriteriaUp though.

The idea is to draw a line 50% up from the low of that large red candle as a retracement line.
 
Last edited:
0

05vprice

New member
Got it figured out. Now my issue is trying to get the signal to wait until the large bar actually closes..
 

Similar threads

Top