This is a simple script to visually indicate gaps on a stock chart on thinkorswim. It does not display correctly for 24 hour products or tick charts.
To add it to a chart, select and copy the script below. Then on a thinkorswim chart, right click on a chart, choose Studies then Edit Studies. Then in the lower left hand corner, choose New Study. Give the study a name, like My_Gap then paste the code below into the main window. Then click ok. The study should be on your chart now. See the example.
# My_Gap # Don't expect this to work on tick charts # It doesn't work correctly on 24 hour products (futures, fx) # Consider it a quick hack to visually look at gaps on stock charts
input start = 930; input price= open;
rec my_close = if(secondsTillTime(start) == 0, close[1], my_close[1]); plot my_prior_close = if(my_close == 0, double.nan, my_close); my_prior_close.SetDefaultColor(color.red); rec my_open = if(secondstilltime(start)== 0, price, my_open[1]); plot my_current_open= if(my_open==0, double.nan, my_open); my_current_open.SetDefaultColor(color.dark_green);
How to plot gaps on thinkorswim stock charts
This is a simple script to visually indicate gaps on a stock chart on thinkorswim. It does not display correctly for 24 hour products or tick charts.
To add it to a chart, select and copy the script below. Then on a thinkorswim chart, right click on a chart, choose Studies then Edit Studies. Then in the lower left hand corner, choose New Study. Give the study a name, like My_Gap then paste the code below into the main window. Then click ok. The study should be on your chart now. See the example. # My_Gap# Don't expect this to work on tick charts
# It doesn't work correctly on 24 hour products (futures, fx)
# Consider it a quick hack to visually look at gaps on stock charts input start = 930;
input price= open; rec my_close = if(secondsTillTime(start) == 0, close[1], my_close[1]);
plot my_prior_close = if(my_close == 0, double.nan, my_close);
my_prior_close.SetDefaultColor(color.red);
rec my_open = if(secondstilltime(start)== 0, price, my_open[1]);
plot my_current_open= if(my_open==0, double.nan, my_open);
my_current_open.SetDefaultColor(color.dark_green);
Posted via email from danrobbins’s posterous