cooltoyz: The Turtle Surfer

This strategy applies the old tested turtle trading strategy, defining a channel and riding the trend, but
It has some twists tough, to make it adapt on the fly to changes in market conditions.

Since all parameters can be adjusted from the inputs, the strat can (and needs) to be fine tuned for the current values of an asset. for example, for gold values, it works good for years. for btc , it breaks for dates with values under 1500$. that's because 1% of 800 is not the same as 1% of 2400$..... Yeah, data fitting, i know all that....
Some of the parameters work well only for low volatility markets, others are designed exactly to capture volatility . So the parameters must be tested, turned on-off to see how well they do. The default values ARE NOT a generic good for all, most surely.

The Turtle Surfer moves slowly, but it's prepared to rabbit jump in/out if some moon/doom event shows up without invitation :)

If you want to play with the strat, start with all checkboxes off, then turn on/off each one and see the results for the asset you want.

I have had good results in xau , btc and eth
Protected script
This script is published closed-source and you may use it freely. You can favorite it to use it on a chart. You cannot view or modify its source code.
Want to use this script on a chart?


I like this indicator a lot. Any thought about adding shorts?
+1 Reply
can i get access to use this indicator please
Hi, enxorizzo, How to backtest a given period?
also what are the points below the chart ?

Hi, the points are just visual helpers to match the orders from each setting. so you can know if a buy order (for example) was fired by breakouty on the trand line, or a volume breakout.

the build up thing is already built in, in the input fields you can define how much pyramid level you want, and set up the other details.

for the risk stop loss management, there's aleady a setting. but in smaller caps, or shitcoins, sometimes the volatility is so big, that using it just keeps the turtle closing at loss all the time. sometimes, you just have to go with the wild swings. no pain, no gain :)
RaphaM rocketspotter
@rocketspotter, thanks for your quick reply.
The pyramiding is not exactly the turtle way : it adds multiple orders on the same day of the first signal.
The turtle idea is to add a position each time the trend goes in the right direction for 1 ATR
Also, the stop loss is for the initial order, but it should move each time you add a position in the trend

do you think it's possible to add that in pine ?

don't get what you mean. with the stop loss setting on, when it hits, it always closes for the full amount used with me, and goes to zero position until the next trigger. the command is strategy.close_all() i think , and that's what it does :)

maybe you found a bug or weird edge case, if you can put here a snapshot of a closing that is not full i'll look into it
i remembered what you mean, it's how pine works, so it's not a bug it's a feature :P

i tried to counter that shitty effect using an imput called "candle % time to trade", to avoid the strat doing trades too early in the candle. also disabling the "recalculate on every tick" helps avoid that affect.

but that thing only happens on live candles when strat is running real-time. a simple workaround is to let the candle finish, then reload the tab. the strat recalculates the moves and multiple entries go poof!

i tried to make a "detector" for this in an earlier strat version, but the code was so ugly and hacky, that going for the reload option is much easier :)
Hello, Your script is very well done !! Congratulations and thank you

Do you think that it would be possible to build up positions with strategy.order() ?
I found this link that refers to this technique :
It would use the ATR as a reference in order to be as close as possible to the turtle technique.

Also, it would be nice to ass the stop loss indicator (still with the ATR)

The money management is the most important aspect of this strategy and it would be nice to be able to have it directly with the signals..
What do you think ?
Aaaannnd, it's time for the turtle 101, lesson 2 :)

The surfer is basically a trend follower, adjusted by different lower/upper bands. depending on the market, each band can have a very different size.
examples, for BTC, it tends to trend up, then have a major correction, down hard and fast. if the lower band is too wide, the surfer lets the price drop a lot before deciding to close the position. so, i like to use the lower band about 1/2 to 2/3rds of the size of the upper band. but for gold, the pushes and retraces are much more regular, so i keep the up/down bands around the same size.

then, there are flags that cause "emergency" positions, wether getting in or out. these flags each have a checkbox so you can activate it at will:

- Big Move: if a candle is bigger than the limit, the surfer takes the opposite direction of the flag. Example, btc runs up more than a defined limit of 150$. the turtle makes a fast sell as soon as the limit is touched

- Flat limit: if the channel (attention, not a single candle) is thinner than the limit, the surfer hibernates, does not trade. only exception is a check for stop loss limit, if that flag is used.

- Max loss % / Channel close active : maximum loss percentage allowed before position is closed. dead duck, this one.

- Group setting from "Candle minutes" to "vol switch" : flag to take a position based on the candle volume, even if the channel border is not touched. good to catch breakouts on dead markets, or whale dumps at the top ;)
this one is tricky to use, it's basically a whole indicator i built called Vdelta, to check abnormal volumes in real time. for the inquiring mind, a full explanation is here:

now, all these indicators can go crazy on bigger timeframes, so there's a trick, the "candle time % to live trade". A 4h TF for example, can have big wicks that would trigger the surfer into bad positions, specially for the "real time" flags. so, you might want to have the surfer be cool and wait for the candle to finish. all these indicators described above will only trigger after the candle has run for X% of completion time. example, with a value of 0.5, on a 4h chart, the turtle starts surfing after 4h x 0.5 = 2h

so, to wrap this up: lots of configuration, that allow the turtle to run on different markets, from the highly volatile, to the sleepy chart waiting for the breakout. different market, different conditions. for the advanced user, it's called "data fitting". yeah, it's ugly, and usually is looked down upon, because it's a trick used by scammers to sell useless strats/bots. but, getting a multi layered strategy that fits all, is like looking for the philosopher stone ;)
this configs optimization for each market, should be seen not as a trick to get fake monstrous results, but as a sort of training the bot for this specific market.

now, lesson over, time to play! :D

Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out