Skip to main content

ATR/Turtle Trading System for Amibroker (AFL)

kaiji about 16 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 1)
  • Tags:
    trading system, amibroker

This trading system was kindly provided by three_percent at amibroker yahoo groups and credit goes to him

It’ a trend channel finder that computes a tight channel by way of ATR. The lower the ATR, the tighter the channel. It checks for a trend that keeps on going up. Notice the half the ATR period checks. Also, it gets out if the ATR gets too big or it makes 25% for the trade. I’m just trying to find ways to improve the performance percentage wise.

Indicator / Formula

Copy & Paste Friendly
// ATR/Turtle Script by Andrew Senft
//
// Backtester Options
SetOption("AllowSameBarExit", False);
SetOption("MaxOpenPositions", 4);
PositionSize =  - 25;

// Optimization numbers
ATRPeriod = Optimize("ATRPeriod", 15, 10, 50, 5);
BuyThreshold = Optimize("BuyThreshold", .3, .1, .50, .05);
BuySlope = Optimize("BuySlope", 1.08, 1.05, 1.10, .01);
SellThreshold = Optimize("SellThreshold", .15, .1, .50, .05);
ProfitPercent = Optimize("ProfitPercent", 25, 25, 35, 5);

// Buy/Sell signals and prices
Buy = Ref(ATR(ATRPeriod),  - 1) < BuyThreshold AND 
	Ref(Close,  - 1) > Ref(Close,  - 1 * ATRPeriod / 2) AND 
	Ref(Close,  - 1 * ATRPeriod / 2) > Ref(Close,  - 1 * ATRPeriod) AND 
	Ref(Close,  - 1) / Ref(Close,  - 1 * ATRPeriod) > BuySlope AND 
	Ref(MA(Volume, 20),  - 1) > 3000 AND// 300,000 volume or more
  	Ref(Close,  - 1) >= 2; // stocks over $2BuyPrice = Open;
  
BeginATR = Ref(ValueWhen(Buy, ATR(ATRPeriod), 1),  - 1);
FilterBeginATR = ValueWhen(Buy, ATR(ATRPeriod), 1);
Sell = Ref(ATR(ATRPeriod),  - 1) > BeginATR + SellThreshold;
SellPrice = Open;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

PositionScore = 100-Ref(ATR(ATRPeriod),  - 1);
ApplyStop(stopTypeProfit, stopModePercent, ProfitPercent, True, 0);

5 comments

about 16 years ago

Is this chart supposed to show any graph – or is it only for scan? It generates very few signals in scan.

4. ecki
almost 16 years ago

it’s scanning your data base for buy candidates but gives only very few results. don’t expect daily picks – even with a data base of more than 5.000 stocks it’s not finding a lot of buying opportunities. ATR Turtle picks mostly cheap stocks or penny stocks, so be aware of some trading risks.

Leave Comment

Please login here to leave a comment.