Turtle Trend Trading System [racer8]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © racer8
//@version=4
strategy("Turtle System", overlay=true)

n = input(55,"Entry Length")
e = input(20,"Exit Length")

HI = highest(n)
LO = lowest(n)
hi = highest(e)
lo = lowest(e)

if close>HI[1]
    strategy.entry("Buy", strategy.long)

if close<LO[1]
    strategy.entry("Sell", strategy.short)
    
if low<lo[1]
    strategy.close("Buy")

if high>hi[1]
    strategy.close("Sell")

plot(HI,color=color.lime)
plot(LO,color=color.red)
plot(hi,color=color.blue)
plot(lo,color=color.maroon)
