{***************************************************************************
Description : Turtle System #1
:
: Rules Implemented:
: -----------------
: Standard Donchian Entry/Exit Channels
: Contingency Risk Stop at 2N (2*ATR)
: Skip Rule after profitable trade
: Failsafe Entry exception to skip rule
: Turtle Position Sizing
:
: Rules Not Implemented:
: ---------------------
: Adding Multiple Units (scaling)
: Cascading 1/2N stop management
: Limiting units within a market complex
: Limiting units based on market correlation
: Limiting units based on direction (long/short)
: Requiring 1/2N portfolio profit before scaling (Strength Filter)
:
: NOTE: Portfolio rules are beyond the native
: capabilities of TradeStation platform
:
: Implementation is dual-use
: and can easily be modified
: to run as TradeStation indicator
: to assist and enable research
:
Provided By : Kevin Sven Berg
: [Spam Link]
: January 23, 2004
: Copyright (c) 2004, Kevin Sven Berg
Reference : [Spam Link]
: With special thank you to Curtis Faith
****************************************************************************}
Input: Echannel(20), { Entry Channel Length }
Xchannel(10), { Exit Channel Length }
FailSafe(50), { Failsafe Channel Length }
PcntEquity(0.01), { Fixed Fraction of Account Equity }
MaxCon(1000), { Maximum Number of Contracts that can be Traded }
Acctsize(1000000); { Starting Account Size }
Var: LE(0), { Long Entry Stop }
LX(0), { Long Exit Stop }
LEF(0), { Long Entry Failsafe Stop }
SE(0), { Short Entry Stop }
SX(0), { Short Exit Stop }
SEF(0), { Short Entry Failsafe Stop }
LX2N(0), { Turtle 2N Long Stop }
SX2N(0), { Turtle 2N Short Stop }
CON(0), { Number of Contracts }
ATR(0), { Average TrueRange }
ATRbars(20), { Length of ATR }
Bias(0), { Tracking Position: Bias > 0 = LONG, Bias < 0 = Short }
EPrice(0), { Entry Price }
XPrice(0), { Exit Price }
OE(0), { Open Equity }
PL(0), { Profit/Loss for Single Lot }
UseFailsafe(true); { Skip Next Trade -> Switch to Failsafe }
{---------------------------------------------------------------------------
Entry and Exit Channels
(a) System #1 Entry channel length is Echannel
(b) System #1 Exit channel length is Xchannel
(c) Failsafe entry channel length is FailSafe
Always take highest or lowest channel counting from prior bar
since we don't have knowledge of today's high
when placing the stop order
Channel entry is 1 tick beyond channel
---------------------------------------------------------------------------}
{ Entry }
LE = Highest(High,Echannel)[1] + 1 point;
SE = Lowest(Low,Echannel)[1] - 1 point;
LEF = Highest(High,FailSafe)[1] + 1 point;
SEF = Lowest(Low,FailSafe)[1] - 1 point;
{ Exit }
LX = Lowest(Low,Xchannel)[1] - 1 point;
SX = Highest(High,Xchannel)[1] + 1 point;
{---------------------------------------------------------------------------
Turtle Money Management
Calculate Turtle N = ATR
Calculate number of contracts in one unit
Cap maximum number of contracts per user parameter
Setup to trade 1-unit
---------------------------------------------------------------------------}
ATR = Average(TrueRange,ATRbars);
{CON =(PcntEquity*(Acctsize + NetProfit))/(ATR*BigPointValue);}
CON = 1;
CON = MinList(CON, MaxCon);