Saturday, January 31, 2009

Lines and Colors and Clouds Oh My! - Thinkorswim Thinkscript

I have been playing around with the "AddCloud" functionality within the Thinkscript API and came up with a variation on the GMMA strategy I call GMMA_Cloud, combined with what I call the ChrisStoplight system. This system is effectively 3 indicators built into one, the RSI up top, the DMI in the middle, and the StochasticMomentumIndex down below. Rather than focusing on the lines that make up the indicators, I've decided it's more important to keep track of the relationship between them.

The concept here is I believe that our brains are designed to deal more with spacial / color relation than trying to distinctly interpret lines all saying different things. My goal is to be able to glance at my chart and immediately get a feel for the movement of the security (in my case, forex pair). When all colors agree, odds are statistics are in your favor and it is reasonable to enter in agreement with the color.

The GMMA_Cloud consists of two clouds, the difference between the 3 and 15 ema is one cloud, and the difference between the 30 and 60 ema is the other.

I don't have a distinct strategy built up for this setup, as there are a lot of places for trader discretion that every trader will handle differently. The main idea is to use the GMMA clouds, combined with the RSI and DMI to determine trend and use the Stochastics to determine pinpointed entries. I'm leaning toward exits being targeted at daily pivot point levels unless the trend breaks sooner.

#Name:             GMMA_CLOUD
#Programmed By: Chris Ball (chris.m.ball@gmail.com) on 1/31/09
#Posted At: http://chartingwithchris.blogspot.com
#Description: This is a cloud representation of the Guppy Multiple Moving Average system using only the exterior EMA's for the two groups.

declare upper;

input price = close;
input displace = 0;

def length3ema = 3;
def length15ema = 15;
def length30ema = 30;
def length60ema = 60;

plot avgexp3 = ExpAverage(data = price[-displace], length = length3ema);
avgexp3.SetDefaultColor(Color.Gray);
plot avgexp15 = ExpAverage(data = price[-displace], length = length15ema);
avgexp15.SetDefaultColor(Color.Gray);

AddCloud(avgexp3, avgexp15);

plot avgexp30 = ExpAverage(data = price[-displace], length = length30ema);
avgexp30.SetDefaultColor(Color.Gray);
plot avgexp60 = ExpAverage(data = price[-displace], length = length60ema);
avgexp60.SetDefaultColor(Color.Gray);

AddCloud(avgexp30, avgexp60);


#Name:             ChrisStoplight
#Programmed By: Chris Ball (chris.m.ball@gmail.com) on 1/31/09
#Posted At: http://chartingwithchris.blogspot.com
#Description: This indicator is truly a representation of 3 indicators (RSI, DMI and the StochasticsMomentumIndex).

declare lower;

plot rsi1 = if RSIWilder(length = 14)."RSI" >= 50 then 10 else 9;
plot rsi2 = if RSIWilder(length = 14)."RSI" < 50 then 10 else 9;

AddCloud(rsi1, rsi2);

plot dmi1 = if DMI(length = 14)."DI+" >= DMI(length = 14)."DI-" then 8 else 7;
plot dmi2 = if DMI(length = 14)."DI+" < DMI(length = 14)."DI-" then 8 else 7;

AddCloud(dmi1, dmi2);

plot sto1 = if StochasticMomentumIndex()."SMI" >= StochasticMomentumIndex()."AvgSMI" then 6 else 5;
plot sto2 = if StochasticMomentumIndex()."SMI" < StochasticMomentumIndex()."AvgSMI" then 6 else 5;

AddCloud(sto1, sto2);

rsi1.setDefaultColor(Color.Gray);
rsi2.setDefaultColor(Color.Gray);
dmi1.setDefaultColor(Color.Gray);
dmi2.setDefaultColor(Color.Gray);
sto1.setDefaultColor(Color.Gray);
sto2.setDefaultColor(Color.Gray);




As can be seen in the above picture, there are usually several trading opportunities, depending on the time frame you're analyzing. I've been focusing on the 30 and 15 minute time frames. The idea is to trade when all colors are in agreement and get out when 1 or 2 start to go against your position. Due to the vast amount of trader discretion involved, I'd say my system is something to toy with and use as a starting base for creating your own strict rules. Without rules and money management, there's no way to consistently make money! Hopefully this will spark some inspiration with my fellow swimmers.

Cheers,
Chris

Sunday, November 30, 2008

Most recent charting setup - Thinkorswim

I've been juggling with a variety of trading strategies and as of late, I've settled on a unique combination of indicators that I am looking to test out over the next week or so. Here's a quick top-level view of the main trading concepts integrated into my setup:

1. Elder Impulse System
2. Person Pivot Point System
3. Guppy Multiple Moving Average System
4. Elder Triple Screen System



You'll notice that I managed to create what appears to be a sly modification to PersonsPivots and have integrated the impulse system into the daily pivot line so that I have the most robust way of displaying the information. You'll also notice that I'm using a slight variation of the usual slow stochastics. I find the stochastics momentum index to be slightly less prone to whipshaws but it appears to deliver similar results otherwise.

Friday, November 21, 2008

Bollinger Band BBSqueeze - Thinkorswim Thinkscript

Through some testing I was performing over the last week, I wrote my own variation of the popular concept of bollinger band squeezes. This one is pretty unique:

1. It is based off of the SMA-based bollinger bands (can be changed to EMA if preferred).
2. It has a configurable period length for the bollinger bands.
3. This configurable period length is also used in calculating the average squeeze value of the bands, which are then halved to determine the squeeze threshold.

Essentially, anything below the threshold line as I call it, and it becomes colored indicating a squeeze of the bands. Red as it tightens, green as it widens. Once the band widens enough for the colored bars to turn back to dark gray, you essentially have a breakout on your hands. Please refer to the sample screen shot of this indicator down below.

#Name:             BBSqueeze
#Programmed By: Chris Ball (chris.m.ball@gmail.com) on 11/21/08
#Posted At: http://chartingwithchris.blogspot.com
#Description: This is a bollinger band squeeze indicator with a dynamically generated threshold used to determine whether a squeeze is tight or not. Please refer to my blog for further details.

declare lower;

input length = 18;

plot squeeze = BollingerBandsSMA(length=18)."UpperBand" - BollingerBandsSMA(length=18)."LowerBand";

def thresh = (sum(squeeze, length*5) / (length*5))*0.50;

squeeze.setPaintingStrategy(paintingstrategy.histogram);
squeeze.assignValueColor(if squeeze <= thresh and squeeze <= squeeze[1] then Color.Red else if squeeze <= thresh and squeeze > squeeze[1] then Color.Green else Color.Dark_Gray);

plot squeezeThreshold = thresh;
squeezeThreshold.setDefaultColor(Color.Yellow);


Thursday, November 6, 2008

Gator Histogram - Thinkorswim Thinkscript

For those of you familiar with the books by Bill Williams, he references what he calls the "gator histogram", based off of the alligator indicator. During my readings of his Chaos Theory book, I felt compelled to code this indicator just to get a better feel for it. I'm sure there are others out there who would like to make use of it as well, so here it is!

#Name:             GatorHistogram
#Programmed By: Chris Ball (chris.m.ball@gmail.com) on 11/6/08
#Posted At: http://chartingwithchris.blogspot.com
#Description: The gator histogram is based off of the alligator indicator, both of which are referenced in numerous books by Bill Williams.

def Jaw = Average(close[8], 13);
def Teeth= Average(close[5], 8);
def Lip= Average(close[3], 5);

plot upperHist = AbsValue(Teeth - Jaw);
upperHist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
upperHist.AssignValueColor(if upperHist > upperHist[1] then Color.Green else Color.Red);

plot lowerHist = -1 * AbsValue(Lip - Teeth);
lowerHist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
lowerHist.AssignValueColor(if lowerHist > lowerHist[1] then Color.Red else Color.Green);

plot zero = 0;
zero.SetDefaultColor(Color.Red);


Sunday, November 2, 2008

Elder Impulse System - Thinkorswim Thinkscript

I've had a few emails since my post yesterday asking about the Elder Impulse System and if I could provide some code for that. Since I just so happened to have already written that before, you bet!

#Name:             ElderImpulse
#Programmed By: Chris Ball (chris.m.ball@gmail.com) on 11/2/08
#Posted At: http://chartingwithchris.blogspot.com
#Description: This study can be adopted for display in many formats, however by default, it will display itself as a dot below each candle for the day. Think of this system as telling you what you "may" do, rather than what you "must" do. Alexander Elder created this system as a means of filtration rather than recommendation.

input length = 13;

def EMA = MovAvgExponential(length=length)."AvgExp";
def MACDHist = MACDHistogram()."Diff";

def impulseSignal = if (EMA < EMA[1] and MACDHist < MACDHist[1])
then 0
else if (EMA > EMA[1] and MACDHist > MACDHist[1])
then 1
else -1;

plot signal = low*0.95;
signal.assignValueColor(if impulseSignal == 1 then Color.Green else if impulseSignal == 0 then Color.Red else Color.Blue);
signal.setpaintingstrategy(paintingstrategy.points);
signal.setLineWeight(3);
signal.hideBubble();




Have fun!

Saturday, November 1, 2008

Current Charting Setup - Thinkorswim TOS Charts


I've had a number of emails over the last couple days from visitors asking me what my current charting setup looks like, so I figured I'd show a sneak peek.

Having read through "Trading for a living" and "Come into my trading room" by Alexander Elder, I must admit that there are certain aspects of his trading style that will probably always be a part of my setup moving forward and are evident in my layout.

You'll notice a couple odd things about my layout:
1. I have a 6m weekly candle-trend chart in the upper left gadgets area. The only thing added to this chart is my custom BallAutoEnvImpulse study. Essentially it is a mash up of a few different trading band concepts, integrated with the Elder Impulse system. I tend to treat this as Elder does with the weekly view, as part of the Triple Screen trading system. I look to make sure I'm never violating the weekly impulse. Other than for that purpose, I don't wish to dedicate more screen space to the weekly view which is why it's off in the corner.

2. The primary left chart is your basic 3m daily candle-trend chart, mixed with a more reader-friendly MACD and ADXR indicator.

3. The primary right chart is your basic 3m daily Heikin Ashi candle chart, mixed with your standard slow stochastics and Chaikin oscillator.

While I'm currently seeing how I feel about the Chaikin oscillator, I find that it is very similar to the Force Index that Elder pushes in his books. Either one serves essentially the same purpose.

I hope that you've found this informative insightful and if you have any questions, tough! Just kidding, you're encouraged to leave a comment on this blog, that way others can benefit from the same question/answers. You're also welcome to send me an email however I tend to get a lot sometimes so I don't always manage to get back to each and every one. Until next time...Chris.

Sunday, October 26, 2008

Elder Thermometer - Thinkorswim Thinkscript

I put together another one of Alexander Elder's indicators over the last week or so that essentially mimics his description of the thermometer indicator. Rather than regurgitating his words on interpretation, google has plenty of references. Now onto the good stuff:

#Name:             Elder Thermometer
#Programmed By: Chris Ball (chris.m.ball@gmail.com) on 10/26/08
#Posted At: http://chartingwithchris.blogspot.com
#Description: This is a thermometer system, as described by Alexander Elder, that depicts tranquil versus volatile times for entry and exit of positions.

declare lower;
input length = 13;

def highVal = AbsValue(high - high[1]);
def lowVal = AbsValue(low - low[1]);
def plotVal = if (highVal > lowVal) then highVal else lowVal;

plot therm = plotVal;
therm.setPaintingStrategy(paintingstrategy.histogram);

plot emaLine = MovAvgExponential(length=length, price=plotVal);
emaLine.setDefaultColor(Color.White);

therm.assignValueColor( if therm < emaLine
then Color.Cyan
else if therm > emaLine
and therm < emaLine*3
then Color.Yellow
else Color.Red
);