here you go, i fixed a few things.
i added bubbles to display variable values. i thought seeing how to do this will help you debug code in the future.
go to edit studies and click on the gear to the right of the study name and change
show_test_bubbles = yes to no to turn them off. or edit the code. it's at the end.
the bubble color is determined by the volume_signal variable.
==================================
looking at the code in post #11
you have the same variable , no , used twice, in 2 different plots. variables can only be used once.
no is a reserved word, can't use it as a variable.
https://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/no
https://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words
i changed the 2 no variables to , no1 and no2
this line has an extra (, before high
def green_height = if close[1] > open[1] then (high[1] + low[1] else green_height[1];
no color specified for arrows. i added green for up arrors. i don't see any down arrows, so i made them white, to make sure i see them if they are plotted.
i added a size of 4 for the arrows, (can be 1-5), to make sure i see them, when they show up.
what
@mashume said, volume_signal will never be equal to -1
def volume_signal = if VOLUME > VOLUME[1] then 1 else double.nan;
so your no plots will never be true and won't plot
Plot NO1 = if red_body > green_height and close < open and volume_signal == -1 then high else double.nan;
i changed the last part, from double.nan to be else -1
def volume_signal = if VOLUME > VOLUME[1] then 1 else -1;
=========================
down arrows show up now.
i didn't follow the code logic to determine what it is doing.
Ruby:
# PriceVolumez_01
# Help with a Price/Volume Study
# https://usethinkscript.com/threads/help-with-a-price-volume-study.2759/#post-69050
# post #11
# QUIKTDR1
declare upper;
input arrow_size = 4;
def red_height = if close[1] < open[1] then (high[1] - low[1])
else red_height[1];
def green_body = if close > open then close - open else 0;
def green_height = if close[1] > open[1] then high[1] + low[1] else green_height[1];
def red_body = if close < open then close + open else 0;
#def volume_signal = if VOLUME > VOLUME[1] then 1 else double.nan;
# change last part to be else -1
def volume_signal = if VOLUME > VOLUME[1] then 1 else -1;
plot GO = if green_body > red_height and close > open and volume_signal == 1 then low else double.nan;
GO.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
go.setdefaultcolor(color.green);
go.setlineweight(arrow_size);
Plot NO1 = if red_body > green_height and close < open and volume_signal == -1 then high else double.nan;
NO1.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
no1.setdefaultcolor(color.white);
no1.setlineweight(arrow_size);
plot NO2 = if green_body < red_height and close < open and volume_signal ==-1 then high else double.nan;
NO2.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
no1.setdefaultcolor(color.white);
no2.setlineweight(arrow_size);
input show_test_bubbles = yes;
addchartbubble(show_test_bubbles, low * 0.997 , "G " + green_body + "\n" + "R " + red_height + "\n" + "V " + volume_signal , if volume_signal == 1 then color.green else if volume_signal == -1 then color.red else color.gray, no);
#