Donchian Channels are almost too easy in EasyLanguage — Highest and Lowest do
all the work. This is also the natural home for a Turtle-style breakout strategy,
given EasyLanguage’s systematic-trading roots. See
the explainer.
What you’ll need
- TradeStation or MultiCharts
- The EasyLanguage / PowerLanguage Editor, new Indicator
The source
{ AlgoGen Donchian Channel — TradeStation / MultiCharts }
inputs:
Length( 20 );
variables:
UpperB( 0 ), LowerB( 0 ), MidB( 0 );
UpperB = Highest( High, Length );
LowerB = Lowest( Low, Length );
MidB = ( UpperB + LowerB ) / 2;
Plot1( UpperB, "Upper" );
Plot2( MidB, "Middle" );
Plot3( LowerB, "Lower" );
Highest/Lowest over Length bars, plus their midpoint — the stepped channel
from the output chart.
A Turtle-style breakout strategy
{ AlgoGen Turtle Donchian — Strategy }
inputs: EntryLen( 20 ), ExitLen( 10 );
{ Compare to the channel EXCLUDING the current bar via [1] }
if Close > Highest( High, EntryLen )[1] then
Buy next bar at market;
if Close < Lowest( Low, ExitLen )[1] then
Sell next bar at market;
{ Symmetric short side }
if Close < Lowest( Low, EntryLen )[1] then
SellShort next bar at market;
if Close > Highest( High, ExitLen )[1] then
BuyToCover next bar at market;
Enter on the 20-bar breakout, exit on the 10-bar opposite breakout — the asymmetric Turtle logic. The Strategy Performance Report reveals trend-following’s real character.
Gotchas
- The
[1]shift for signals.Highest( High, Length )[1]is the channel as of the previous bar; comparingCloseto it is what makes a valid breakout. Without the[1], the current bar’s own high is in the channel and it never fires. - Close vs intrabar. Triggering on
Close >gives fewer, cleaner breaks than an intrabar high touch — choose per your style. - MaxBarsBack ≥ Length. So the rolling extremes have enough history.
Same indicator elsewhere: Python, MQL5, Pine Script, NinjaScript. Then backtest it in AlgoGen.
This post is educational, not financial advice. Indicators describe the past; they don’t predict the future. Backtest anything before you risk real money on it.
Sources and further reading
- What is EasyLanguage? (TradeStation)
