Test photos

(download)

How to Change Candle/Bar Colors on Thinkorswim Charts for Moving Averages

Ema-paintbars

This quick study allows you to alter the color of your candles (or bars) based upon the candle's position vs. the Exponential Moving Average you select. See the screenshot example, which uses the 50 EMA. This study should work for all chart types.

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_EMA_Paintbars then paste the code below into the main window. Then click ok. The study should be on your chart now. 

# Simple ema price bar painting 
# Change the following options as you want
input length = 20;
input price = close;
input displace = 0;

plot ema = ExpAverage(close, length);
plot signal = if(IsNaN(ema), 0, if(close < ema, -1, if(close > ema, 1, 0)));
AssignPriceColor(if signal == 1 then color.dark_GREEN else if signal == -1 then color.red else color.gray);

How to plot gaps on thinkorswim stock charts

Tos_gap_display

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 above.

# 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);

Free Enterprise

Click here to download:
freeenterprise.pdf (2.95 MB)
(download)