Release Note:
Legendary trade system which proved that great traders can be made, not born.
Turtle Trade Experiment made 80% annual return for 4 years and made 150 million $
Turtle Trade trend following system is a complete opposite to the "buy low and sell high" approach.
This trend following system was taught to a group of average and normal individuals, and almost everyone turned into a profitable trader.
They used the basis logic of well known DONCHIAN CHANNELS which developed by Richard Donchian .
The main rule is "Trade an 20-day breakout and take profits when an 10-day high or low is breached ". Examples:
Buy a 20-day breakout and close the trade when price action reaches a 10-day low.
Go short a 20-day breakout and close the trade when price action reaches a 10-day high.
In this indicator,
The red line is the trading line which indicates the trend direction:
Price bars over the trend line indicates uptrend
Price bars under the trend line means downtrend
The dotted blue line is the exit line.
Original system is:
Go long when the price High is equal to or above previous 20 day Highest price.
Go short when the price Low is equal to or below previous 20 day Lowest price.
Exit long positions when the price touches the exit line
Exit short positions when the price touches the exit line
Recommended initial stop-loss is ATR * 2 from the opening price.
Default system parameters were 20,10 and 55,20.
Original Turtle Rules:
To trade exactly like the turtles did, you need to set up two indicators representing the main and the failsafe system.
Set up the main indicator with EntryPeriod = 20 and ExitPeriod = 10 (A.k.a S1) (My comments: Good for Swing - Long timeframe)
Set up the failsafe indicator with EntryPeriod = 55 and ExitPeriod = 20 using a different color. (A.k.a S2) (My comment: Good for intraday - Short timeframe)
The entry strategy using S1 is as follows
Buy 20-day breakouts using S1 only if last signaled trade was a loss.
Sell 20-day breakouts using S1 only if last signaled trade was a loss.
If last signaled trade by S1 was a win, you shouldn't trade -Irregardless of the direction or if you traded last signal it or not-
The entry strategy using S2 is as follows:
Buy 55-day breakouts only if you ignored last S1 signal and the market is rallying without you
Sell 55-day breakouts only if you ignored last S1 signal and the market is pluging without you
You can Highlight the chart with provided trade signals:
Green cloud color when Long
Red cloud color when Short
No cloud color when flat
Update - Added Entry/Exit price option and some other visuals
CSS:
#//@version=4
#//author: @kivancozbilgic
#https://www.tradingview.com/script/pB5nv16J/
#study(title="Turtle Trade Channels Indicator", shorttitle="TuTCI"
# Converted and modifiedTrueRange by Sam4COK@Samer800 - 08/2022
# Update visuals and added entry/exit price - Sam4COK@Samer800 - 09/2024
input timeframe = AggregationPeriod.MIN;
input EntryLength = 20; # "Entry Length"
input ExitLength = 10; # "Exit Length"
input ShowLines = yes; # "Show Lines?"
input showSignals = {Default "Entry & Exit", "Entry Only", "Exit Only", "Don't Show"};
input showPriceWithSignals = yes;
input SignalOnPrice = no; # "Show Entry/Exit Signals on Price?"
input ShowCloud = yes; # "Highlighter On/Off ?"
def na = Double.NaN;
def current = GetAggregationPeriod();
def tf = Max(current, timeframe);
def both = showSignals==showSignals."Entry & Exit";
def entry = showSignals==showSignals."Entry Only" or both;
def exit = showSignals==showSignals."Exit Only" or both;
#barssince(Condition) =>
script barssince {
input Condition = no;
def barssince = if Condition then 0 else if(isNaN(barssince[1]), 0, barssince[1]) + 1;
plot return = barssince;
}
def up = Highest(high(period = tf), EntryLength);
def dn = Lowest(low(Period = tf), EntryLength);
def sup = Highest(high(period = tf), ExitLength);
def sdn = Lowest(low(Period = tf), ExitLength);
def barHi = barssince(high(period = tf) >= up[1]);
def barLo = barssince(low(Period = tf) <= dn[1]);
def cond = barHi <= barLo;
def K1 = if barHi <= barLo then dn else up;
def K2 = If barHi <= barLo then sdn else sup;
def K3 = If close(period = tf) > K1 then dn else na;
def K4 = If close(period = tf) < K1 then up else na;
#-- Signals
def buySignal = (high(period = tf) == up[1]) or (high(period = tf) crosses above up[1]);
def sellSignal = (low(Period = tf) == dn[1]) or (dn[1] crosses above low(Period = tf));
def buyExit = (low(Period = tf) == sdn[1]) or (sdn[1] crosses above low(Period = tf));
def sellExit = (high(period = tf) == sup[1]) or (high(period = tf) crosses above sup[1]);
def O1 = barssince(buySignal);
def O2 = barssince(sellSignal);
def O3 = barssince(buyExit);
def O4 = barssince(sellExit);
def colUp = (Min(Min(O1, O2), O3) == O1);
def colDn = (Min(Min(O1, O2), O4) == O2);
#-- Plots
#-- PONTS
plot ShortEntry = if ShowLines and sellSignal and O4 < O2[1] then up else na;
ShortEntry.SetPaintingStrategy(PaintingStrategy.POINTS);
ShortEntry.SetDefaultColor(Color.MAGENTA);
ShortEntry.SetLineWeight(2);
plot LongEntry = if ShowLines and buySignal and O3 < O1[1] then dn else na;
LongEntry.SetPaintingStrategy(PaintingStrategy.POINTS);
LongEntry.SetDefaultColor(Color.CYAN);
LongEntry.SetLineWeight(2);
plot ShortExit = if ShowLines and sellExit and O2 < O4[1] then dn else na;
ShortExit.SetPaintingStrategy(PaintingStrategy.POINTS);
ShortExit.SetDefaultColor(Color.DARK_RED);
ShortExit.SetLineWeight(2);
plot LongExit = if ShowLines and buyExit and O1 < O3[1] then up else na;
LongExit.SetPaintingStrategy(PaintingStrategy.POINTS);
LongExit.SetDefaultColor(Color.DARK_GREEN);
LongExit.SetLineWeight(2);
#-- Lines
plot TrendLine = if ShowLines and (cond == cond[-1]) then K1 else na;
plot TrendLine1 = if ShowLines and (cond == cond[1]) then K1 else na;
plot ExitLine = if ShowLines and (cond == cond[-1]) then K2 else na;
plot ExitLine1 = if ShowLines and (cond == cond[1]) then K2 else na;
TrendLine.AssignValueColor(if cond then Color.CYAN else Color.MAGENTA);
TrendLine1.AssignValueColor(if cond then Color.CYAN else Color.MAGENTA);
TrendLine1.SetLineWeight(2);
ExitLine.AssignValueColor(if colUp then Color.DARK_GREEN else
if colDn then Color.DARK_RED else Color.GRAY);
ExitLine1.AssignValueColor(if colUp then Color.DARK_GREEN else
if colDn then Color.DARK_RED else Color.GRAY);
plot upper = if ShowLines then up else na;
plot lower = if ShowLines then dn else na;
upper.AssignValueColor(if colUp then Color.DARK_GREEN else
if colDn then Color.DARK_RED else Color.GRAY);
lower.AssignValueColor(if colUp then Color.DARK_GREEN else
if colDn then Color.DARK_RED else Color.GRAY);
#### Bubbles
def SignalUp = if (SignalOnPrice or !ShowLines) then high else up;
def SignalDn = if (SignalOnPrice or !ShowLines) then low else dn;
def ExitLong = if exit and buyExit and SignalUp and O1 < O3[1] then up else na;
def ExitShort = if exit and sellExit and SignalDn and O2 < O4[1] then dn else na;
def Long = if entry and buySignal and SignalDn and O3 < O1[1] then dn else na;
def Short = if entry and sellSignal and SignalUp and O4 < O2[1] then up else na;
AddChartBubble(ExitLong, SignalUp, (if showPriceWithSignals then "Exit L" else "E") +
(if showPriceWithSignals then "\n" + AsDollars(close) else ""),
Color.DARK_GREEN, yes);
AddChartBubble(ExitShort, SignalDn, (if showPriceWithSignals then "Exit S" else "E") +
(if showPriceWithSignals then "\n" + AsDollars(close) else ""),
Color.DARK_RED, no);
AddChartBubble(Long, SignalDn, (if showPriceWithSignals then "Long" else "L") +
(if showPriceWithSignals then "\n" + AsDollars(open[-1]) else ""),
Color.CYAN, no);
AddChartBubble(Short, SignalUp,(if showPriceWithSignals then "Short" else "S") +
(if showPriceWithSignals then "\n" + AsDollars(open[-1]) else ""),
Color.MAGENTA, yes);
#### Cloud
def color1 = ShowCloud and (colUp or colUp[-1]);
def color2 = ShowCloud and (colDn or colDn[-1]);
AddCloud(if color1 then up else na, K2, Color.DARK_GREEN);
AddCloud(if color2 then K2 else na, dn, Color.DARK_RED);
#### END
I added to the below more setting to remove/add lines and signals with option to use the indicator in different timeframe.
CSS:
#//@version=4
#//author: @kivancozbilgic
#https://www.tradingview.com/script/pB5nv16J/
#study(title="Turtle Trade Channels Indicator", shorttitle="TuTCI"
# Converted and modifiedTrueRange by Sam4COK@Samer800 - 08/2022
input EntryLength = 20; # "Entry Length"
input ExitLength = 10; # "Exit Length"
input ShowLines = yes; # "Show Lines?"
input showSignals = yes; # "Show Entry/Exit Signals ?"
input SignalOnPrice = no; # "Show Entry/Exit Signals on Price?"
input ShowCloud = yes; # "Highlighter On/Off ?"
input UseChartTime = yes; # "Use Chart timeframe or Aggregation?"
input aggregation = AggregationPeriod.DAY;
def na = Double.NaN;
#barssince(Condition) =>
script barssince {
input Condition = 0;
def barssince = if Condition then 1 else barssince[1] + 1;
plot return = barssince;
}
#//MTF
def TFLow;
def TFHigh;
def TFClose;
if UseChartTime
then {
TFLow = low;
TFHigh = high;
TFClose = close;
} else {
TFLow = low(period = aggregation);
TFHigh = high(period = aggregation);
TFClose = close(period = aggregation);
}
def up = Highest(TFHigh, EntryLength);
def down = Lowest(TFLow, EntryLength);
def sup = Highest(TFHigh, ExitLength);
def sdown = Lowest(TFLow, ExitLength);
def K1 = if barssince(TFHigh >= up[1]) <= barssince(TFLow <= down[1]) then down else up;
def K2 = If(barssince(TFHigh >= up[1]) <= barssince(TFLow <= down[1]), sdown, sup);
def K3 = If(TFClose > K1, down, na);
def K4 = If(TFClose < K1, up, na);
plot TrendLine = K1;
TrendLine.SetDefaultColor(CreateColor(255, 82, 82));
TrendLine.SetLineWeight(2);
TrendLine.SetHiding(!ShowLines);
plot ExitLine = K2;
ExitLine.SetStyle(Curve.POINTS);
ExitLine.SetDefaultColor(CreateColor(0, 148, 255));
ExitLine.SetHiding(!ShowLines);
def lower = Lowest(TFLow, EntryLength);
def upper = Highest(TFHigh, EntryLength);
plot u = upper;
plot l = lower;
u.SetDefaultColor(CreateColor(0, 148, 255));
u.SetHiding(!ShowLines);
l.SetDefaultColor(CreateColor(0, 148, 255));
l.SetHiding(!ShowLines);
def buySignal = TFHigh == upper[1] or TFHigh crosses above upper[1];
def sellSignal = TFLow == lower[1] or lower[1] crosses above TFLow;
def buyExit = TFLow == sdown[1] or sdown[1] crosses above TFLow;
def sellExit = TFHigh == sup[1] or TFHigh crosses above sup[1];
def O1 = barssince(buySignal);
def O2 = barssince(sellSignal);
def O3 = barssince(buyExit);
def O4 = barssince(sellExit);
def E1 = barssince(buySignal[1]);
def E2 = barssince(sellSignal[1]);
def E3 = barssince(buyExit[1]);
def E4 = barssince(sellExit[1]);
plot LongExit = if buyExit and O1 < O3[1] then up else na;
LongExit.SetPaintingStrategy(PaintingStrategy.POINTS);
LongExit.SetDefaultColor(CreateColor(0, 148, 255));
LongExit.SetLineWeight(3);
LongExit.SetHiding(!ShowLines);
plot ShortExit = if sellExit and O2 < O4[1] then down else na;
ShortExit.SetPaintingStrategy(PaintingStrategy.POINTS);
ShortExit.SetDefaultColor(CreateColor(0, 148, 255));
ShortExit.SetLineWeight(3);
ShortExit.SetHiding(!ShowLines);
plot LongEntry = if buySignal and O3 < O1[1] then down else na;
LongEntry.SetPaintingStrategy(PaintingStrategy.POINTS);
LongEntry.SetDefaultColor(Color.GREEN);
LongEntry.SetLineWeight(3);
LongEntry.SetHiding(!ShowLines);
plot ShortEntry = if sellSignal and O4 < O2[1] then up else na;
ShortEntry.SetPaintingStrategy(PaintingStrategy.POINTS);
ShortEntry.SetDefaultColor(CreateColor(255, 82, 82));
ShortEntry.SetLineWeight(3);
ShortEntry.SetHiding(!ShowLines);
#### Bubbles
def SignalUp = if showSignals then if SignalOnPrice then high else up else na;
def SignalDn = if showSignals then if SignalOnPrice then low else down else na;
def ExitLong = if buyExit and SignalUp and O1 < O3[1] then up else na;
AddChartBubble(ExitLong, SignalUp, "Exit Long", CreateColor(0, 148, 255), yes);
def ExitShort = if sellExit and SignalDn and O2 < O4[1] then down else na;
AddChartBubble(ExitShort, SignalDn, "Exit Short", CreateColor(0, 148, 255), no);
def Long = if buySignal and SignalDn and O3 < O1[1] then down else na;
AddChartBubble(Long, SignalDn, "Long Entry", Color.GREEN, no);
def Short = if sellSignal and SignalUp and O4 < O2[1] then up else na;
AddChartBubble(Short, SignalUp, "Short Entry", Color.RED, yes);
#### Cloud
def color1 = if ShowCloud and (Min(Min(O1, O2), O3) == O1) then 1 else na;
def color2 = if ShowCloud and (Min(Min(O1, O2), O4) == O2) then 1 else na;
AddCloud(if color1 then u else na, ExitLine, Color.DARK_GREEN);
AddCloud(if color2 then ExitLine else na, l, Color.DARK_RED);
##### END
Last edited: