turtle trading for Amibroker (AFL)
Copy & Paste Friendly
//taken from http://web.me.com/araneus1/spiderstradingweb/Smallcorner/Entries/2006/8/31_The_Turtle_Corner.html
Capital = 100000;
pctFluctation = 1;
Buy = H > Ref(HHV(H, 20), -1);
Sell = L < Ref(LLV(L, 10), -1);
N = ATR(20);
ApplyStop(stopTypeLoss, stopModePoint, 2* N, 0);
numshrs = Capital * pctFluctation / (100 * N);
SetPositionSize(numshrs ,spsShares);