TradingView
UnknownUnicorn100591
17 Sep 2014 pukul 00.05

Candlestick Math 

Plug Power, Inc.NASDAQ

Huraian

This is an updated version of my previous post, with the option to specify which symbol you want it to show up on.

This is a script I made to do what is called candlestick math (if you're not sure, Google it). It will take the first open, the last close, and the highest high and lowest low from a range of candlesticks, and plot it on top of the chart.

Unfortunately, there is no way to make it so you can move it with your mouse, and the bar numbering is not the same as the regular drawing tools, so to figure out what the line number is, create a new script with the text:
study("Plot N")
plot(n)

This will create another chart that will show you the bar numbers that correspond to the script's bar numbers. From there, figure out where you want to start the candlestick math, and enter that number in the "Start" field in the inputs for this script.
Komen
rdecker7878
Ok.. I was able to get the separate script to count the candles. So I have the starting candle number now.. I got the error to go away on the Math script.. Now I am trying to figure out how to get it to actually plot on my chart
rdecker7878
I would give anything in the world to be able to use this script. I was able to get the separate script to count the bars. But every time I try to use this I get the error telling me I cannot have a negative integer. This is like the key to my puzzle here lol Any help would be greatly appreciated!!
Phynx
Hi there, sorry I don't know anything about pine script but when running this script it says "index is a negative". I really would like this script if I could get it working. I have already have the plot script to enter this value but just have trouble with this negative index. Any help appreciated.
Liza_84
copy the script and delete "-" in lines 12, 13, 14
it shoud be:
"12 c = isIn ? (na(c[1]) ? fixnan(close[round(len)]) : c[1]) : na
13 h = isIn ? (na(h[1]) ? highest(fixnan(high[round(len)]),len+1) : h[1]) : na
14 l = isIn ? (na(l[1]) ? lowest(fixnan(low[round(len)]),len+1) : l[1]) : na
Liza_84
sorry (don't know how to correct the sent message), the right lines are:
12 c = isIn ? (na(c[1]) ? fixnan(close[round(len)]) : c[1]) : na
13 h = isIn ? (na(h[1]) ? highest(fixnan(high[round(len)]),len+1) : h[1]) : na
14 l = isIn ? (na(l[1]) ? lowest(fixnan(low[round(len)]),len+1) : l[1]) : na
Liza_84
again wrong post! delete "-" before word "len".
Lebih