UncleTerry
New member
More specifically, Im trying to code a horizontal line that is auto drawn across the an intraday chart when the price chart crates a candle wick instead of just an arrow at the bottom of the wick. Is it possible to code using horizontal lines instead of arrows? It would look similar to Robert's on researchtrade.com and on the "Fun with thinkscript" thread but instead of peaks and valleys, it would be candle wicks of a specific body type. (I do not own the rights to this picture)
I created a code the draws an arrow when a candle wick is created on the TOS chart. When ever a candle wick is generated on anytime frame, it creates an arrow at the bottom of the candle. I am sorry if my explanation was unclear. The wick tail setting I have would be 1.5 times the body. I wanted to know if there is a line of code that creates a line extension across the chart from the wick candle signal to the right side of the chart to possibly create a future pridiction of possible inflection points.
Below is what I've been using that is the closet to what I was trying to describe.
#Start
input magnitude =30;
# define top and bottom of candle body
def bodytop = max(open, close);
def bodybottom = min(open, close);
# define and plot the most recent valley
def valley = bodybottom <= Lowest(bodybottom[1], magnitude) and bodybottom <= Lowest(bodybottom[-magnitude], magnitude);
def valleyValue = if BarNumber() < magnitude then Double.NaN else if valley then bodybottom else valleyValue[1];
plot valleyline = valleyValue;
valleyline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
valleyline.SetDefaultColor(Color.magenta);
# extend the current valley line to the right edge of the chart
def countt = if IsNaN(valley) and !IsNaN(valley[1]) then 1 else countt[1] + 1;
plot valleyext = if IsNaN(valley) then GetValue(valleyline, countt) else Double.NaN;
valleyext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
valleyext.SetDefaultColor(Color.magenta);
# continue the previous valley as a dashed line, but not all the way to the far right of the screen
def oldvalley = if BarNumber() < magnitude then Double.NaN else if valley then valleyValue[1] else oldvalley[1];
plot oldvalleyline = oldvalley;
oldvalleyline.SetPaintingStrategy(PaintingStrategy.DASHES);
oldvalleyline.SetDefaultColor(Color.magenta);
#End Code
I created a code the draws an arrow when a candle wick is created on the TOS chart. When ever a candle wick is generated on anytime frame, it creates an arrow at the bottom of the candle. I am sorry if my explanation was unclear. The wick tail setting I have would be 1.5 times the body. I wanted to know if there is a line of code that creates a line extension across the chart from the wick candle signal to the right side of the chart to possibly create a future pridiction of possible inflection points.
Below is what I've been using that is the closet to what I was trying to describe.
#Start
input magnitude =30;
# define top and bottom of candle body
def bodytop = max(open, close);
def bodybottom = min(open, close);
# define and plot the most recent valley
def valley = bodybottom <= Lowest(bodybottom[1], magnitude) and bodybottom <= Lowest(bodybottom[-magnitude], magnitude);
def valleyValue = if BarNumber() < magnitude then Double.NaN else if valley then bodybottom else valleyValue[1];
plot valleyline = valleyValue;
valleyline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
valleyline.SetDefaultColor(Color.magenta);
# extend the current valley line to the right edge of the chart
def countt = if IsNaN(valley) and !IsNaN(valley[1]) then 1 else countt[1] + 1;
plot valleyext = if IsNaN(valley) then GetValue(valleyline, countt) else Double.NaN;
valleyext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
valleyext.SetDefaultColor(Color.magenta);
# continue the previous valley as a dashed line, but not all the way to the far right of the screen
def oldvalley = if BarNumber() < magnitude then Double.NaN else if valley then valleyValue[1] else oldvalley[1];
plot oldvalleyline = oldvalley;
oldvalleyline.SetPaintingStrategy(PaintingStrategy.DASHES);
oldvalleyline.SetDefaultColor(Color.magenta);
#End Code