20 11 Seurce Code ShortString = Shortstring + PatterrStrings trú; 1 LengString oy “Then Begin Vales = fest henbate, fine, nh « Pricebelta, LoStrig; Hightort «test setabjiegalie, 2, 2;
Trang 120 11 Seurce Code
ShortString = Shortstring + PatterrStrings
trú;
1 LengString oy “Then Begin Vales = fest henbate, fine, nh « Pricebelta, LoStrig);
Hightort «test setabjiegalie, 2, 2;
TW ectuckcraundfolor = 1 The ‘est Setcalorvalve, Toot Yellow)
ast ‘ext SctCoor(Vaves, Tool Slack); 1 Alert or Stren(lengsteieg) >> 2 Then
RhenkCiơg 2 + Legstriglr
keds
1 Shortstrieg ©“ Then Sepin Valuer = To hew(ste, Tey Low PriceDelta, ShorStrire)s
1 cettacereadtoler 3 Then “eet Setcolo(vaved, Tel Yello)
ase “tent SetColorValoe, Tel Black);
lostet > Text SetShlclikei, 2, 0; WP Alertnsbied or Strtn(Snorestring) >> 2 Then
TH hen: 2 ShortStrieg)s
trở
fd
‘Acme Market Stategy
Sates
‘Table U3, Acre Market Strtegy
‘Signa Name Long Entry | Longésat | Short Eotrs | Short Eat
114 Soteoe Cole
‘Acme Market System gai
‘cee Harket 5ystee: Lodk for cơrbinations cf nu]ttpTe market patter
wm (vy
‘Rows Trdes, or TRIN (T) ull Bear Consensus (8) Short Sales Ratio (S)
vik PUtycaN Ratio New Highs New Lows
aN Market Vane Bullish Consensus DataB: Public / Specialist Short Sales Ratio sovssssanessaaeenctetenennnanessccorsoesgternantinnsennesteresestees)
(Position Parascters}
Equity (s00000), Riskrodel(3), RiskPercent(3.0), BIELATRQ.0), EntyFacLor(6,3), DrawTangets(Tive};
Variables: Móc
Patesnsteing", tonestring Shorty,
Trang 2250 1 8ansesds
= high « đơtayacter * A
SketStp © En -(eneyroctor * AT
1 DataConpression < 2 Then ‘Comentary(This indicator must be applied to a daily bar ” +
‘interval er longer.”)
se Begin Pattersstrieg =“
ing
AYR = Volatslity(Length); Prdecbelta = ATR / 45
If Close of Dataz > 0 Then Begin Potterrstrang ~ "V”;
hen - cong inded(Clee sự Dan, legt)y
If Hightow > 3 Thêm tring ~ LongString + PatternString 7
Else TẾ Mgh su = 2 The, ‘Shortstring = Shortstring + Patternstring;
End;
1 Close of ng 2, Ten Bein fottertring =P";
Highton = Achoight oulndex(Close of Osts3, Length): TẾ Nghe c1 Thơ tô hi stigv Pttengting
ise TY Highton + 2 Then Shortsiing’= shorttring + Patexestrings
fed
1 Close Patterrstrang = “1”; of Datas > 0 Then Begin
Nhgh on - Acnehigh o.trdes(Close of Data4, Legfh); TẾ Rightow =? Ther
letgsteing - Lengstring Potterstring
Else TF Righlow = 1 Then ‘ShortString = shortString + PattemString; :
End;
1 Che of nas >The Bein
Nghe = oauhoante(cne (of vatas, Length); i hagitae =
Long - long + ntenstrig
chee TẾ BghÌm = 2 De ‘ShoxtString - sertstring + PattemString; ú
feds
1 Close of bata6 > 0 Then Begin Patteestring "7
If Highton = 4 Then LongString = Longstring + Patternstring se’ Highloe ‘ShortString = Shortstring + PatternStxing; = 2 Then
1 Close of Data > 0 Then Begin
CAN iirde(deee
one Jntrdex(Close of Datar, Length);
a higitae <2 Then Lerastring + rattomStri: ey fase TF tags <a = Shortstring = Shorstrieg + Patternstrig;
tnd;
IF Close of bataB > O Then Begin HighLow = AcneiighLowindex(Close of Oat36, Length); Patternstring = °S";
TF Hightow «1 Then tegstring- Longstring + PatterString ase tights hen ‘ShortString = ShortString + Pattemnstring;
nd;
{calculate shares based on risk model) N= AcneGetShares( Equity, RisWodel, RiskPexcent, RiskATR)s (ultiple Pattern Buy Signal
oe era oes Paes
2 cee, my, 09 aka 8
(ultiple Pattern Sell signal) [If StrLen(ShortString) >= MininunPatterns Then Begin {Draw Entry Targets on the Chart) If Dravrangets Then Conditiont = fcnoEntryTargets(°W", 0, 0, ShortStep, 0);
‘Se11("Acne SE Market”) N shares Next Bar on ShortStop Stops End
Trang 3262
AemeN Strategy
‘ae
‘Table 1.14, Acme N Seatexy
11 Sousve Code
Seed Name Lore Erry | Long Est | Short Every | Short But
‘cme N System
Sina!
(resvevernososanencesssnnntenssssoeccegnunansnnastesenesn ten: se
sae
1
PCR Parameters) ecco,
euler),
KH nung ob,
{filler raseters)
Fulterson(Tive),
FiIterlergth(34),
Hinimmerice(20),
initmeA0X38),
Minisuntv(0-5), (Position Paraneters}
Equity (100000), iskrodel(3),
ay stp (0.0)
Ratio te fied Nene fae otters vu,
Shortstop(0.0),
Aa = vedas (aitegth),
fa merge (lose mere
{Set Entry ond Exit stops}
BuyStop = High + (Ertryfactor * ATR
‘ShortStop = Low ~ (EntzyFactor * ATR (hone W Setup
Condition.» Aeaearrntonge(Wengtht, 1) and
‘enekarrontange(uergty 0), Cateiont = ton > Tow{a} and High ¢ High{a] and Le{S] > o2] and
co SN larodtvgelMirgt2, Hos nena o ceding = feelciebg ens 0 Conditions = Acratangtato(kationgihi, RtioLengtha) <= Maehangetatio: Keno = Coors or Condit or Conditions os Condon or conte ions
{Run trade filters)
1 Filterson Then Trader =e > runice aed (Faltertergth) >= RininustOX apd
‘enaVolatality(FiiterLength) >= Kinsey;
1, forge cc fargefercert * AE and TradeFiiter Then Begin (calculate shares based on risk model}
N= AceeGetShares(Equity, Rishtodel, RiskPercent, RiskATR);
{arrow Ranged
TradeFilter = true; If Filters00 Then Tradefilter = PedianPrice > MA;
If TradeFilter ond Senet acePown(RetraceBars) and Twa bi en en
Trang 4ai H1 ansssts
fuy( “hone LE Wr) N shares Next Bar at PuyStop Stops
TradefiIter = True; If Filterson Then
"TeadeFilter = NedtanPrice < My
TẾ TradeEllter and
“Aenefetracelp(fetraccBars) and
‘TeadeFilter Then Begin {ôn truy, Tiệp on the Chart}
IF OrowTargets Then Conditions ~ AenentzyTargets("®", 0, 0, ShortStop, 0);
S€I1CAcse SE N°) W Shares Next Bax at Shortstop Stop:
end;
nd
‘Acme NR
—
LỆ"9994EA439139Eeex9xkgtetsrtgkErrrtarttnsaotnnertettse
eae MR: Display the narrowest range bar in, bars
AMM: CESENDL te ctaarossstasamicesscannenansanevcc)
ns:
TNsegedo;
TẾ koclarro.foogeargelentth, 0) Then Begin PlntraintarthĂVh Lạp Eácie My
AlertC ke MT:
fed Else begin hori a
horton
fs
28
Acme NRK
—¬
nh 0686614044e011.0n0015010 l1140 ccgAmk.ee
Inputs: Ty ưng), angeFactar(0.65);
Variables: ‘ATR(O.0);
IR = Volatility Eongetergt); Tf Range <= RangeFactor "ATR Then
to “ke Khen Cao ạt ket),
tả Ee Ngon, heron);
tr ferme NRO ‘itor L9 eteeetseereketrredderrosmdrorrerrrereerisoree Meets Olspay earn range bats in 200 eee ee
Tuệ: Epeleth6);
E eelarxsesrerExrgdlereth, 2) mở Amoasrlvos(fvpa gi C2 Thee Begin lotfainser ugh toe "hce Ma}, ler’ ("Rene N2 Aezt”)
tne Else Begin tert
—
nd
Trang 5266 11 Seurce Code
‘AemePStrategy
rater
‘The Acme P System is a self-contained system with its own ext strategy, thus,
does notuse the Acme Trade Manager
“Table HAS Acme P Statexy
Sspnal Name | Long Bry | tong Et | Shor Bury | Short Eur |
AsmPSem| rr | V “ “
‘Acme P Systern
Xem
‘ene P Syston: Pairs Trading
Requizenents
Detaa: Stock 1 Intraday,
(ated: Steck 1 Oatly @ tad: Stock 2 Daily (hidden)
tame ot,
Wace om
E6 nhi
Length(39),
{Position Sizing Paraneters}
Equity(1900000},
RfolelQ),
RiskPercent(2.0),
RRATRG.0),
Ms sancs
2a Volatilityconstant(o.0523),
Uppereand(o.0), Lowertand(0.0), Spread(0.0)
HF Date © Datel} Then Begin Ni dentetSares(uity, Rsbodl, RiskPercert, RsKATR)
of bata;
Hi = Aenevolatility(Lergth) of ata3;
Wi? = AenaVel2t1110/(Legth) oF Dataa;
GW ~ correlation(Pricet, Price2, Length);
Veustilityeand = velatalstyconstant ¥ (4 + Hz) # (4 - CỤ;
Uppertare = StandareDeviations * VolatilstyBand; LowerBerd = StandareDeviations * (-VolatilityBand), fd:
Spread = (Close of Datat 7 Pricet) ~ (Close of Dataz / Price2);,
TF Spread crosses above towertand Then Buy("Aone P LE") N Stores This Bar oo Close;
TF Spread crosses above 0 Then Battorg(“Aene P 1X +”) This Bar on Close Ese TF Spread <= StordardDeviations * Lonerfand Then ‘Exituong( "Aone P LX =") This Bar on Close;
1 Spreng crosses below tpprtand Thee SUiCAGHe #3) Astros his far on Closes
1 Spread crosses below 0 Then Budtshort("Aone P SX +") This far on Close Else If Spread >~ StardardOeviations * Exitstert(7Acme PSX =") This BaF on Then {tog Trades for Spreadsheet Export)
Condition = Acnelogtrades(Logirades, LogFile, “P");
AuweRStratogy ưng
‘Table 1116 Acne R Strategy
‘Signal Nome Long Bix | Long EM | Sen — Bến | Short se
Trang 6
268 11 Source Code
done syste: Look For
‘h Paroneters}
fectagltegin( a,
leFactor(3.0),
ectangletatio(®.3), {Filter Paraneters
Filterson(Tive),
FilterLength(18),
MinisusAtE (2-0), {Position Parancters}
Equity(s00000),
Riskredel(3),
RiskFercent(.0),
iskATR(2.0)
EntryFactor(0.25),
Drowfargets(Tive);
Variables: No),
AIR(O.0),
‘rRLength(20),
TẾ ha đe Buystop(0.0),
Shortstep(0.0),
(variables)
ToRectangle(False),
Rectangleligh(0.0),
Rectarglelon(0.0);,
[ATR = NolatilSty(/TRLength);
ct ng dat «Lên Rectangle figh ~ Highest (High, Rectangletength);
— + (xtafactor* AN5
E— - (erator * A;
If Falters0n then TradeFiTter = ATR >» MinkeumsTR;
Af TradeFiIter Then Begin
( shaves h shade T, esktwacent, KASHAN: A woe
{Dekernine vhether or rot we are in 2 rectangle}
{Shectrge'sscntectanstin(tectangleergty Rctargfangs,
TẾ IHRectayle Then Begin {Orme Ely Torgets"on the chort}
Pate ee Cordier hoedntryTmgets(TV, BayStop 0, ea, sys fuy(heae LER) N Sates Nextar oh Bystop' {Oran entry Targets on the Curt} Sty lim CConditiona = AcnefntryTargets(R", 0, 0, Shortstop, 0); Then
“Sel1CBeme SE R°) W Shares Next Bax 69 ShortStop St nd;
(rrteseravesasessanssoce wevevecsanunseteanneesonsoennnenentt
‘ee nite hey Me ath a
"ERs tower init),
Uppertinit (2.3);
Iota (Lovertinit, “Lover Linst");
Plota(Uppertinit, “Upper Linit”)
Tf Date © Curremtbate Then Plota(AcneRongefatio(Lengtha, Length2), “hoe RR)s
Trang 7210 1 Scarce Code
rau: Recianglelength(),
RangeLengthtt2),
Rangefactor(l.0),
Rangetatiolinit(3)5
‘erectargleih(.0), Fectarglelon(@.0),”
Uppertane(-1),
toverLine(-1)}
Rectangleligh = highest(tigh, Rectangle
NA Ha nettle
IF nenetectangular(Rectangletongth, RangeLergth, RangeFactor,
ine Âu Re fetmglel=gt4]
Tìne|fectanglelength.1), te 7
exele), helo), ect ee
TF GetBackGroundColor = Black Then
at 92 dpedte, elie)
Tt Setcolor(Uppertine, Black);
git SStetpetlne, 2;
Tie[Rectanglelength-1], Rectarglelow,
Đate[o), Tire[o), RectangleLe); 1 LowerLine >= 6 Then Begin
If GetBackGrourdColor = Black Then ‘TL SetColor(LonerLine, Yellow)
chế “TL Setcolor(LowesLine, Black);
1 setSize(Lowertine, 1);
nd
Data2: Stock 2 Int Data: Stock 1 Daily ¢ Dates: Stack 2 Daily (hidden)
Pricea(Close of Dat3), Fricea(Close of Dataa), Staraardeviations(2.3, length(30);
Variabies: wae,
has),
St ToseesGo), 0.0), RDHU em oan),
tt Urata
‘Spread(o.0);
If Date co Date[1] Then Begin Wit = Acneolatility(Lergth) of Datag;
2 = AcneVolatility(Lergth) of Data4;
GW - correlation(Pricet, Price2, Length); Vàsgl1itytmd — VelatTHiceeiam (tin + 2) * (1 ~ Cs Uppertand = Stardardeviatlone * VoTati12tyBand> cegltettod = Stanoraneiation * CAnlalllybr)y
st (ef mi) (res
ea
Plota(o, *2ero")
CÔNG
Trang 8on 11 Source Code
Syste"),
{hesition taragenent Paraeters)
Exieractor(0.25),
Stepbars(t),
Tà treo,
Profitrector(0-3),
Hateors(s),
Drowtargets(teve), ade
đo tEne 6m ba)
Variables: 'ATR(0.0),
‘aTRLength(20),
‘aTRFactor(0.0), PreFitBars(0),
5eHStrp(0.0),
SelTargeta(0-0),
‘ell Target2(0.0), Coverstop(0.0
ATE = Volatility(ATRLength);
‘AlRFactor = ProfitFactor * ATR; ProfitBars = IntPortion(Holdats/2) © 1;
Setisop< Last (lon, Stpfors) = (etactr * AIR;
BxdtLong(“Aene Li") Hert step Stop;
1 ProfatTarget Then Begin Sellargeta = High, + ATRFactor;
ExdtLong "Acne Lis") CurrentContracts/2 Shares Next ar at SellTargeta Limit;
SelITarget2 = HighlProfitBars) + (2 * ATEfactor);
ExitLongc Acne Lies") ConrentContracts/2 Shares Next Bạt at
Sellfarget2 Linit},
End
Tf BarsSincetntey >= HoldBars — 1 then ritheng("Aeer 130) Meal Bar on Open,
le Sup) «(UAL anton * ANE):
114 Seusce Code
Exitshort ("ne 54") Next Bar at Coverstep ‘If ProfitTarget T tan lun: Stops overTrgett = Low ATRFctars Elsner ene 9£”) CurentCotzacts/2 Shares het Ba at overargst Ui
Guerlangeta ~ Loe Profittars] ~ (2 + arRfactor)s Eclshort(Aene S02) Carentcnktacts/2 Shares Next Ba at
If BarsSincetntry > HaldBars - 1 Then ExitShort “Acne Sx") Next Bar on Open;
WfBStanr=or
Tf DrawTargets Then ome ee, Sa ay 2
inp eetgBpteem tre
{Log Trades for Spresdeheet Deort) Conditions = BeneLogivades(Uoghrades, LogFile, SystestD);
{reetessanerssssanersssoonen Aone Triangle: Plot Length(20)
strengthQj, taclsteSlope(o.5), orissPiVets(G)7 Varlables: FoudhighPivot(False), FoundLewivot False),
Trang 9
Naas,
‘Si, «'suinghighBax(N, gh, Strength, Lergth)s Tf Sia © = Then Begin
Nai
FoundtighPlvet = False;
Nile FeundhighPivot ~ False ard N ce RadzueFivots Begin Sega Hh, street, Leet);
Hf sia oot and high{ St) Haigh SHE sghPivot ~ THe;
“SsdngLexBar(, Low, Strength, Length);
If sla ot Then Begin wey
FoundlevPivot = False;
ie ouahoivat = alse ad Wc Minas pin SL2 = SeinglonBan(W, Lov, Strength, Length);
HF siz ea ond Loos} > Lenfst2] Then FoundLowivot = T2ue}
neweay
end
End
1 rent and Forno Th en Mi ~ TLSlopetany (gh, Sa, St);
TC TP = 1Slopetasy Clow Sử, 3405,
Projectiigh = TUaotasy (gh, SH, S42, 0);
Frojecttos 1WolctasyCiow 3, 3,
Aaaluihslre) Pavia
hàn ton = Pest Then Bexar De nh Hoxinalope ard
từ - TU enOate( ta], Timea], Highs},
Date, "tine, iets
Tem hếc@ebelSU), tine( Sta], ent,
tate, nes end
ted
a
114 Sun
TRO), Towa) sne(-25, lextstrdng(°")5
Ate Volatihity(Lockbocktars);
TS rildettntledlideae, sươh, tryưa<e0;
TF Ter oo then tee Date obsr), Tame ota, km Hef), tow, Alerstry 1 traPunfsibckaus) > Mine (Lostbackas) Ten «shen Tape Sti”
Cates = Asalin(Ln = verge(lose, engl) <
RangeFactor * ATR = »)
the TẾ BA hs(lolbadesrs) minh ÄưoiietHgi ` maogefie, MnyA) = D80 LostbacBars) Ten Fengetactor
1 Conder men AienGtre = Mertstring « © ke ” « Nntste(SLength, ©) + tar Moving Averages
Tf AlertEnabled Tiến etdtring; or Conditiont Then ie
‘Acme Triple Top, Teter
{revesesannoncesennsesos
hte 40), Tình
Trang 10276 11 Source Code
RengeFactor(0.),
TA gtkƠO);
Variables:
hy
‘iar Aemriletr(Lrlbxlêns, Stength, Rangefater;
If Trear © -1 Then begi True Th Menatel OL, ale eh,
Date[TTBax), Tane( TBar}, High);
‘lortString’> “Bene Triple Toy"; If DeTPlus(LookbsckBars) > DlMinus(LookbockBars) Then,
(Conditions = AbsValue(tow = Avexage(CTese, MALergt!)) <= RangeFactor * ATR
Else TF DMTPlus(LockhackBars) < DAIMinus(LookbackBars) Then Coreitiona = Absvalve(High ~ Average(Close, MiLength)) <
actor * ATR;
“TẾ Cenlrtierl Then lertString = AlertString + “ Near "+
ustostr(WaLength, 0) + Bar Moving Average”;
If Alertérabled oF Condition: Then ‘Alert(Alertstring);
Ena;
‘Acme V High Zone,
—¬
TY nh 2mm: TH the te v hgh Zone fi l
ss
_ LatilityFactor(0.9), Length(20);
variables: ‘ghzone(0.0);
spire = tea velataityractr, enh)
We thighzore > 0.0 and Wigh >= Wighzore Then ft lơ S Mạ đe);
Hee
‘Acme V Low Zone
Tan
pm
Aene V
XỔ nhhy«etes,
“Thu =mee
Variables: ‘VLowzone(0.0);
owone = heneMLow(Volatilityfactor, Length)
TF Veawone > 0.0 and Low <= VLowZone Then ene Vow Zane: Indicate en the V Low
Plotpaintfar(high, ow, “V Low Zone");
Aemev Sretegy sesesy
‘Table11.17 Acme V Strategy
is Me
‘Signal Name Long Entre | Long | Stort Buy | Short Exit
‘Acme V Syste r
‘Acre V System
‘eae V Systen: Anticipate 3 Inputs: {W Faronters)
Ân Ho are), Reprcsoferst), taigerecior(.6): Here rer) T000)
stumacteny
fae V syste Botton based on Linear
3