What's New

Period VWAP

After a bit of a self-imposed breather from thinkScripting I’m back with an essential (but missing from TOS) tool for everyone. This study is a period-specific VWAP (Volume Weighted Average Price). In other words, the user can select the start date for the VWAP and then plot from that date forward. It essentially represents the average price that the market participants are committed at. I think the chart speaks for itself. Raise a glass for all the Veterans today.

# TS_PERIOD_VWAP
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 19 OCT 2011

# Daily Charts and up only

input startDateYyyyMmDd = 20090309;
def beyondStartDate = if getYyyyMmDd()>= startDateYyyyMmDd then 1 else 0;

plot VWAP = TotalSum(if beyondStartDate then (((high+low+close)/3)*volume) else 0)/TotalSum(if beyondStartDate then volume else 0);

VWAP.SetDefaultColor(color.orange);
VWAP.SetStyle(curve.SHORT_DASH);
VWAP.SetLineWeight(2);
Posted in Indicator | 3 Comments

Turtle Trading System: Update

Thanks to some fantastic input from some of the Pro Members, I’ve made some changes under the hood of the Turtle Trading System. The updates drive the theoretical results closer to reality with the incorporation of slippage/commissions, improved gap handling, and realistic trade execution prices. As usual, the update is available in the Forum for the lifetime members.
Cheers,
-Eric

Turtle Trading System Update

Posted in Update | Tagged , , , | 10 Comments

Turtle Trading System

Turtle Trading System


I have been working on a thinkScript implementation of the Turtle Trading System for some time now. Unfortunately, my current remodeling project has resulted in a temporary halt to all thinkScript development. Nevertheless, the system is sufficiently complete in its present state for me to release it to the Pro Members of the site to whom I am eternally grateful for support. The following is a very brief synopsis of the two indicators I have developed. Update published to the forum – 17 July.

! ! ! IMPORTANT ! ! !
It goes without saying, but I’m going to say it up front here with emphasis: – You should not trade this system unless you fully understand its rules. – You must do your own due diligence. Just because a system shows a historical profit on your chart does not mean it will continue to do so in the future. – The entries and exits here are ideal. No account for slippage or trade costs has been included.

Ever since reading Curtis Faith’s Way of the Turtle I have been focused on development of mechanical trading systems. Devoid of one of the primary reasons for trading failure – human emotion – the Turtle Trading System has become somewhat legendary as a result of the success achieved by a small group of non-traders taught the system and given $1M accounts to trade. I won’t spoil the whole story as Faith’s book is an enjoyable read and highly recommended.

The basic Turtle Rules, which can be found easily with a web search, are deceptively simple. Breakouts of 20 period highs and lows constitute trade initiation signals (System 1) and exits are defined as a breach of the opposing 10 period high/low. There are specific rules for position size and stops based on volatility and account size. I have encapsulated the rules into these two indicators. (Both System 1 and System 2 rules are selectable with the additional option of alternating trades in System 1)

When flat, the Turtle Trading System indicator will show the required levels for a breakout/breakdown. Once in a trade, the indicators show the stop, exit, and initiation price levels throughout the life of the trade. All the trade information is tracked to provide a somewhat comprehensive list of statistics – I say somewhat as this is the part of the indicators I will be enhancing with further statistical measures of performance.

Turtle Trader - Flat

The upper indicator shows the breakout channels as well as stops and targets. (Long trades – cyan, Short trades – orange, Volatility Prohibited Trades – magenta, Exits/Stopped – white) The lower indicator displays the equity curve for the system as traded against the current chart. Both indicators have a status bar which is configurable in one of three modes to display the current position and some vital statistics, the position sizing information, or the historical/detailed trade statistics. There are examples of each of the three modes in the various screen shots below.

Detail View

Full Statistics - Lower Panel

Volatility Halt - Magenta Zone

Posted in Indicator | Tagged , , , | 53 Comments

Net Lines

Pro member Brian asked for an implementation of the Net-Lines indicator as described by Christopher Carolan, author of The Spiral Calendar. The indicator draws the net line after three consecutive up bars or three consecutive down bars (I’ve created two methodologies in this case: one for consecutive up/down closes; one for consecutive up/down close-open). The line is drawn at the low/high of the first bar in the three bar series and times out after the designated number of bars, five being the default. A penetration of the net line is a buy/sell signal.

Net-Lines

Posted in Indicator | Tagged , , , | 14 Comments

Bollinger Bands with Embedded Fibonacci Lines

Reader Mike asked for an implementation of an indicator available for another platform that will plot the standard Bollinger Bands with an embedded set of Fibonacci ratio lines. It was a pretty basic mash together of the standard Bollinger Band code with some new code for the ratios. Pictured at the bottom of the /CL chart is the Tape Momentum indicator.

Bollinger Bands with Fibonacci Ratio Lines

# TS_BollingerBandFibs
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 25 May 2011

input price = hl2;
input displace = 0;
input length = 233;
input fib1 = 0.382;
input fib2 = 0.618;
input fib3 = 0.764;

def sDev = stdev(data = price[-displace], length = length);

plot MidLine = Average(data = price[-displace], length = length);
plot LowerBand = MidLine -3.0 * sDev;
plot UpperBand = MidLine + 3.0 * sDev;
plot UpperFibLine1 = (UpperBand-Midline)*fib1+Midline;
plot UpperFibLine2 = (UpperBand-Midline)*fib2+Midline;
plot UpperFibLine3 = (UpperBand-Midline)*fib3+Midline;
plot LowerFibLine1 = (LowerBand-Midline)*fib1+Midline;
plot LowerFibLine2 = (LowerBand-Midline)*fib2+Midline;
plot LowerFibLine3 = (LowerBand-Midline)*fib3+Midline;

LowerBand.setDefaultColor(color.blue);
MidLine.setDefaultColor(color.gray);
UpperBand.setDefaultColor(color.blue);

LowerBand.setLineWeight(2);
MidLine.setLineWeight(2);
UpperBand.setLineWeight(2);

UpperFibLine1.setDefaultColor(color.gray);
UpperFibLine2.setDefaultColor(color.gray);
UpperFibLine3.setDefaultColor(color.gray);
LowerFibLine1.setDefaultColor(color.gray);
LowerFibLine2.setDefaultColor(color.gray);
LowerFibLine3.setDefaultColor(color.gray);

UpperFibLine1.setStyle(curve.SHORT_DASH);
UpperFibLine2.setStyle(curve.SHORT_DASH);
UpperFibLine3.setStyle(curve.SHORT_DASH);
LowerFibLine1.setStyle(curve.SHORT_DASH);
LowerFibLine2.setStyle(curve.SHORT_DASH);
LowerFibLine3.setStyle(curve.SHORT_DASH);
Posted in Indicator | Tagged , , , | 3 Comments