n
) X ) ( X (
) n , k ( at ion Aut oCor r el
n
t
t k t
=
=
8.4 Recomputable vs. non-recomputable data series
Recomput abl e dat a seri es are dat a seri es whose hi st ori cal val ues can be comput ed at a
l at er t i me. Non- recomput abl e dat a seri es can onl y be comput ed i n real - ti me meani ng
t hat i t i s not possi bl e to comput e hi st ori cal val ues from before t he ti me t he dat a seri es
was st art ed. The reason t hat some dat a seri es are non- recomput abl e i s t hat some
i nt ernal model dat a i s onl y bei ng cal cul at ed i n real - ti me wi t hout recording t he hi stori cal
val ues ( t o save memory) . Anot her reason i s that some dat a seri es depend on dat a t hat
may change duri ng model evol uti on al t hough t he hi st ory of t hese changes i s not bei ng
recorded. Changes t o model paramet er s duri ng model evoluti on ( by t he user) ar e an
exampl e of t hi s.
Obvi ousl y, i f you want t o be abl e t o moni t or t he ent i re hi story of a non- recomput abl e
dat a seri es, t he dat a seri es shoul d be added t o a chart from t he st art of model evoluti on.
Not e t hat when a par amet er of a non- recomput abl e dat a seri es i s changed, i t s hi st ory
wi ll not be recal cul at ed and st ill refl ect t he ori ginal paramet er set t ing. Non- recomput abl e
dat a seri es can not have a movi ng average or aut ocorrel at i on indi cat or.
Adding a recomput abl e dat a seri es during model evolut ion or changing i t s paramet er s
requi res ( re)cal cul at i on of t he dat a seri es hi st ory. Thi s may t ake some t i me for some
dat a seri es. ( Re) cal cul at i on and (re) drawi ng of the dat a seri es t her ef ore t akes pl aces as a
background process whil e model evolution continues.
8.5 Memory limitations
Adapt i ve Model er does not st ore an i nfini t e number of hi st ori cal bars ( nei ther in memory
nor on di sk) . For performance reasons t he number of hi st ori cal bars for dat a seri es and
ot her int ernal dat a t hat can be st ored i s li mi t ed t o a maxi mum. The maxi mum number of
bars st ored i s 100,000
39
.
Aft er t he maxi mum number of st ored bars has been exceeded, a model continuous t o
evol ve but t he ol dest bar s will be overwri t t en by new bars so t hat al ways onl y t he l ast
100,000 bars remai n in memory. Chart s t herefore onl y show the l ast 100,000 bars of
dat a seri es.
Rel at ed t o t hi s, some dat a seri es do not ret urn val ues anymore when t hei r cal cul ati on
peri od i s set t o Since model st art or Since Tradi ng Si mul at or st art and t he requi red
model hi st ory i s no l onger compl et el y i n memory. I n t hat case, a t r ail ing cal cul at i on
peri od can be used wi t h t he number of bars set t o maxi mum. Not e t hat t he securi t y pri ce
j ust before model st art and j ust bef ore Tradi ng Syst em st ar t ar e al ways r emember ed so
all the ret urn dat a seri es t hat need j ust t hese can al ways be cal cul at ed.
39
20,000 for t he Eval uat i on Edi ti on.
80
Li kewi se, t he Agent Cumul ati ve Excess Ret urn can not be cal cul at ed when t he bar j ust
before agent creat i on i s no longer in memory. For The Agent Repl acement Fi t ness Excess
Ret urn, t he securi t ys ret urn i s cal cul at ed si nce t he oldest bar in memory i n case t he bar
j ust before agent cr eat i on i s no longer i n memory. ( I n gener al i t i s very rar e t hat an
agent s age exceeds t he maxi mum number of st ored bars).
I n case a model exceeds t he maxi mum number of st ored bars, i t mi ght be useful to save
an ext r a copy of t he model ever y 100,000 bars and i nclude t he begin/ end dat es of t he
peri od covered in t he fil ename, so t hat t he ent i re hi st ory of t he model i s preser ved.
81
9. Exporting data
Dat a seri es can be export ed t o a CSV fi l e ( Comma Separ at ed Values) whi ch can t hen be
i mport ed by ot her appli cat ions for furt her processi ng or research. Dat a can be export ed
manuall y or aut omat i call y ( real - ti me) .
Exporting dat a makes i t possi bl e to int egrat e Adapt i ve Model er i n a wi der set of t radi ng
soft war e t o provi de addi tional functional i t y such as:
- si mul ati ng more compl ex t r ading st rat egi es ( i .e. invol vi ng deri vat i ves)
- aut omat ed t r ading (online order pl acement )
- cal cul at ing ot her t radi ng performance indi cat ors
- et c.
Al t ernat i vel y, dat a can be export ed t o ot her appli cati ons for furt her research of i.e.:
- t he behavi or of t he Agent - based Model
- t he pri ce behavi or of t he Virt ual Market ( presence of st yli zed fact s, et c. )
- t he effect s of t he genet i c operat ors on the populat i on
- et c.
To export dat a, choose Export from t he Tools menu. The Export di alog box wil l
appear.
9.1 Export Settings
9.1.1 Selecting data series to export
The Export di alog box shows a li st of al l t he dat a seri es t hat current l y exi st in Chart s
wi ndows or i n t he Current Val ues wi ndow. The dat a seri es from chart s are at t he t op of
t he l i st and t he dat a seri es from t he Current Values window are at t he bot t om. The dat a
seri es whose val ues ar e t o be export ed can be sel ect ed here by checking t hem. Not e t hat
onl y dat a seri es t hat ar e al ready present in a chart or in t he Current Val ues wi ndow can
be export ed. To export ot her dat a seri es, first add t hem t o a Chart s window or t o t he
Current Val ues wi ndow.
9.1.2 Selecting the export file
I f no export fil ename for t he model has been provi ded yet , an export fil ename will
aut omat i cal l y be suggest ed. I t i s possi bl e to ent er anot her fil ename or browse t o an
exi st i ng fil e t o export t he CSV dat a t o. I f a non-exi st i ng fil ename i s ent er ed, a new
export f il e will be creat ed. I f an exi st ing fi l e i s sel ect ed, export ed dat a wil l be appended
t o t he fil e. I f the export fil e i s goi ng t o be used si mul t aneousl y by anot her appli cat i on,
make sure t hat t he ot her appl i cat i on onl y opens t he fil e as read- only or Adapt i ve
Model er will not be abl e t o wri t e t o t he file.
9.1.3 Export historical values
Hi st ori cal val ues of t he sel ect ed dat a seri es can be export ed by checki ng Export
hi st ori cal val ues and ent eri ng the number of hist ori cal bars t o export . Aft er OK i s
cli cked, t he hi st ori cal values wil l be export ed t o t he export fil e i mmedi at el y. Not e t hat
hi st ori cal val ues can onl y be export ed for t i me dat a seri es exi st i ng in chart s and not for
di st ri bution dat a seri es or for dat a seri es from the Current Values window.
When t he number of hi st ori cal bars t o export i s ( at l east ) one hi gher t han t he number of
bars t hat have been processed so far, t he first dat a row wri t t en t o t he export fi l e i s bar
0 . Thi s i s t he bar j ust bef ore model evoluti on st art ed and can be useful to have avail abl e
82
since i t may cont ai n basel ine informat i on such as t he cl osi ng pri ce of t he securi t y before
model evol ution st ar t ed.
9.1.4 Auto Export
Sel ect Enabl e Aut o Export t o aut omat i call y export t he val ues of the sel ect ed dat a seri es
aft er every new bar has been processed. Thi s i s useful when t he export ed dat a i s going
t o be used by anot her appli cat ion i n real - ti me.
Not e: i f nei ther Auto Export nor Export hi st orical values i s sel ect ed when you cl i ck
OK , not hing wil l be export ed. However, any changes t o t he sel ect i on of dat a seri es will
be remembered (i n t he model s St yl e) whi ch for inst ance may be useful for bat ch
export i ng.
9.2 Other Export issues
9.2.1 Adding data series to the selection
I t i s possi bl e t o add more dat a seri es t o a sel ect i on t hat i s al ready bei ng used wi t hout
needi ng t o creat e a new export fi l e. The val ues of the new dat a seri es wi ll be wri t t en in
ext r a columns t o the ri ght of t he al ready exi st i ng dat a seri es in t he export fil e so t hat
t hese st ay i n the same columns. (I n t hi s case t here will be no headers for t he new dat a
seri es) . Of course i t i s al so possi bl e to speci fy a new export fil e and export t he hi st ori cal
val ues t o have a new export fil e that cont ai ns al l val ues of all t he sel ect ed dat a seri es.
The advant age of t hi s i s t hat t he header row wi ll cont ai n t he names of al l t he dat a seri es
and t hat t he dat a seri es wi ll appear in t he same order in the export f il e as i n t he li st in
t he Export di al og box.
9.2.2 Removing data series from the selection
When dat a seri es ar e bei ng removed from t he export sel ect i on, their values wil l no longer
be wri t t en t o t he export fil e. I nst ead, empt y values will be wri t t en t o t he corresponding
col umn( s) in t he export fil e. Thi s i s done t o preserve t he col umn orderi ng of t he
remai ning dat a seri es. When a removed dat a seri es i s l at er re- added agai n to t he
sel ect i on, i t s values will be pl aced in i t s ol d col umn again in t he export fil e.
Removi ng a dat a seri es from a chart or t he Current Val ues wi ndow whil e i t i s part of t he
export sel ect i on, will have t he same effect as removing t he dat a seri es from t he export
sel ect i on.
9.2.3 Exporting distribution data series
When a di st ri but ion dat a seri es i s sel ect ed for export , onl y t he mean value of t he
popul ation wi ll be export ed. As di st ri bution dat a seri es onl y ret urn dat a for t he current
bar, no hi st ori cal val ues can be export ed.
9.2.4 Styles
Most of t he export set t i ngs of a model are part of t he model s St yl e. Thi s means t hat
t hese export set t ings are aut omat i call y saved wit h a model and t hat t hey can be
separat ed from a model by savi ng t he St yl e and appli ed t o any ot her model . However,
t he export fil ename and t he set t i ng Export hi st ori cal val ues ar e not part of t he St yl e
and will t herefore not be appli ed to ot her models. When a st yl e i s appl i ed t o a model , t he
export f il ename will automat i call y be creat ed by appending _export _n.csv t o t he model
name, where n i s 1 or the small est unused number if ot her export fil es for t he same
model al ready exi st .
83
9.2.5 At what point in the Agent-based Model cycle are values exported?
Exporting al ways t akes pl ace ri ght aft er t he forecast for t he new bar has been cal cul at ed.
Thi s means t hat t he val ues of some dat a seri es al ready correspond t o t he upcomi ng bar
( for whi ch t he securi t ys pri ce i s not avail abl e yet ) whil e ot hers correspond t o t he l ast
compl et el y processed bar ( for whi ch t he securi t ys pri ce has been i mport ed al ready).
However, all val ues are wri t t en t o t he same row whi ch st ar t s wi t h t he bar number of the
l ast compl et el y processed bar. Techni call y, t he dat a seri es whose values correspond t o
t he upcoming bar bel ong in t he next row but for pract i cal reasons t hey ar e al so wri t t en in
t he row of the l ast compl et el y processed bar.
9.2.6 Date and time values in the export file
Besi des t he bar number al so t he dat e and t i me of the bar i s wri t t en t o t he export fi l e.
Thi s i s t he dat e and t i me of t he cl ose of t he bar. Not e t hat some dat a seri es report
anot her dat e and ti me ( i n chart s or t he Current Val ues wi ndow) t han t he cl ose of t he bar.
Thi s i s not vi sibl e in t he export fil e since t he dat e and t i me i s not export ed indi vidual l y for
ever y dat a seri es. The dat e format t hat i s used for exporting dat es depends on t he Dat e
format set t i ng i n the Opt ions di alog box ( from t he Tool s menu) .
84
10. Batch processing and automation
Bat ch processing invol ves t he aut omat ed cr eat i on of mul ti pl e model s at once f or sever al
securi ti es and/ or wi th mult i pl e runs per securi t y. Adapt i ve Model er offers a bat ch
processi ng int erface t o si mpli fy t he process of st art i ng several model s based on one or
more quot e fil es and of assi gni ng a configurati on, st yl e and export set t i ngs t o t hese
model s.
For exampl e, i t i s possi bl e t o speci fy a confi gurat ion fil e and a di rect ory wi t h quot e fi l es.
Adapt i ve Model er will then creat e model s of each quot e fil e ( securi t y) i n t he di rect ory and
use t he model paramet ers from t he confi gurati on fi le. The resul t s ( final values of dat a
seri es) of t he model s can aut omat i call y be export ed t o a si ngl e export fi l e. Bat ch
processi ng can al so be useful for aut omat i ng t he creat i on of a si ngl e model using a
speci fi c configurati on and st yl e and ot her cont rol set t i ngs.
Al ready exi st i ng model s can al so aut omat i cal l y be updat ed (see 10.5 Updat i ng a model ) .
10.1 Creating a batch process
To creat e a bat ch, choose Bat ch from t he Tool s menu. The Bat ch Processi ng
di alog box will appear. Ent er t he rel evant i nformat i on in the di al og box as descri bed
bel ow. ( Before st art i ng t he bat ch, you may want t o save t he Bat ch set t i ngs ( see 10.3)
because t hey ar e not aut omat i call y saved when st art i ng a bat ch) .
10.1.1 Batch name
The bat ch name wil l aut omat i cal l y be creat ed but you can change t hi s t o somet hing more
descri pti ve. The bat ch name will be used as t he bat ch fil e name i f t he bat ch i s saved.
10.1.2 Batch description
Thi s i s an opti onal t ext fi el d t hat can be used for a descri pt ion or not es for a bat ch t hat i s
goi ng t o be saved.
10.1.3 Quote file(s)
Bat ch processes can be based on a si ngl e securi t y or on multi pl e securi t i es. I f mul ti pl e
quot e fi l es are speci fi ed (by ent eri ng a fol der name and/ or by using wil dcards (* , ?) i n
t he Quot e fil e( s) t ext box) t hen for every quot e f il e ( securi t y) t he number of model s as
speci fi ed at Model s per securi t y will be creat ed.
When usi ng mul tipl e securi ti es i t i s recommended t o onl y combi ne securi ti es of t he same
t ype in one bat ch as al l model s i n a bat ch will share t he same confi gurat ion fil e. All
model s wi ll t herefore share t he same par amet er val ues for Market Tr adi ng Hours,
Roundi ng, Broker Commi ssion, Spread, et c. which may be di fferent for different t ypes of
securi ti es.
10.1.4 Number of models per security
I t i s possi bl e t o speci fy t he number of model s t o be creat ed for each securi t y. Thi s makes
i t possi bl e t o i nst ant l y st ar t sever al model s for the same securi t y all using t he same
model confi gurat ion. The onl y di fference bet ween t hese model s i s t he random seed val ue
and t hi s allows for a more compl et e i nvest i gat i on of pot enti al resul t s for a gi ven securi t y
and model configurat ion ( see al so Runni ng mul tipl e model evoluti ons) . Not e t hat when in
t he confi gurat ion t o be used Generat e seed from cl ock i s checked, every model creat ed
i n a bat ch wil l get i t s own seed val ue generat ed from t he cl ock. I f Gener at e seed f rom
clock i s unchecked, t hen t he seed val ue assi gned t o every model i s equal t o t he user
85
speci fi ed seed val ue increased wi t h t he model s run number. Thi s will cause all model s
for a securi t y t o have consecut i ve seed numbers st art i ng from t he speci fi ed seed. Thi s
makes i t possi bl e to reproduce an ent i re bat ch using t he exact same set of random seed
val ues again.
10.1.5 Configuration
Her e you can sel ect a confi gurat ion fil e t hat shoul d be used for all model s t hat will be
creat ed by t he bat ch. I f t hi s i s l eft empt y, t he defaul t confi gurat ion will be used for al l
model s.
10.1.6 Style
Her e you can sel ect a st yl e t hat shoul d be appli ed t o all model s t hat will be creat ed by
t he bat ch. I f t hi s i s l eft empt y, t he defaul t st yl e will be appli ed to all model s.
10.1.7 Run numbers start value
The run numbers will aut omat i call y be appended t o t he model names. I t i s possi bl e t o
speci fy t he st art i ng run number. Thi s makes i t easi er t o add more model s t o an already
exi st i ng seri es of model s wi t h consecut i ve run numbers.
10.1.8 Run models until end of quote file
Sel ect t hi s opti on t o run all model s unti l t he end of t hei r quot e fil e i s reached. When t he
l ast quot e in t he quot e fil e has been processed, t he bat ch run ends. Thi s means t hat -
dependi ng on the bat ch set t i ngs t he model s final dat a may be export ed and t he model
may be paused, saved and/ or closed. I f model s ar e kept open ( or saved) , all model s
conti nue t o exi st and can be used as normal model s aft er t he bat ch run has fi ni shed.
Not e: The Eval uati on Edi tion wi ll run t he bat ch until t he del ayed processi ng of recent
quot es st ar t s and t hen fini sh t he bat ch ( and export final values, et c.) i mmedi at el y
wi thout wai ting for t he remai ning del ayed quot es in t he file t o be processed.
10.1.9 Run models for a given number of bars
Sel ect t hi s opti on t o run all model s for a speci fi ed number of bars. Aft er t hese bar s have
been processed, t he run ends . Thi s means t hat - depending on t he bat ch set t i ngs t he
model s final dat a may be export ed and t he model may be paused, saved and/ or closed.
I f model s are kept open ( or saved) , all model s conti nue t o exi st and can be used as
normal model s aft er t he bat ch run has fini shed. ( Not e t hat i f Pause model s at end of
run i s not sel ect ed, t he model s wi ll continue t o evol ve, even aft er t he end of the bat ch
run) .
10.1.10 Export data at end of run
I t i s possi bl e t o have t he fi nal values of dat a series ( val ues of t he l ast processed bar at
t he end of the run) export ed t o a si ngl e shared export fi l e. Thi s way t he resul t s (i .e.
Forecast Di rect i onal Accuracy) of all model s can easil y be compared. When t hi s f eat ure i s
used, t he sel ect i on of dat a seri es t o be export ed i s t aken from t he St yl es export set t i ngs.
There i s one except i on: if no dat a seri es have been checked for exporti ng in t he St yl es
export set t i ngs, t hen all exi sti ng dat a seri es in the St yl e wi ll be export ed. Thi s eli minat es
t he need t o sel ect dat a seri es for exporti ng in t he St yl es export set t i ngs onl y for t he
purpose of exporti ng fi nal values for a bat ch process. ( Regardl ess of t he bat ch export
set t i ngs, model dat a can al so st i ll be export ed during model evol ution usi ng Aut o Export
i f t hi s i s enabl ed in the St yl e) . Not e t hat t he model s name and t he model s random seed
val ue will al so be export ed t o t he bat ch fil e.
86
10.1.11 Save models at end of run
Check t hi s t o aut omat i call y save model s at t he end of the run. When model s are t o be
saved aut omat i call y, t he pat h t o save t he models can be speci fi ed at Locat i on . The
name of t he model i s aut omat i call y set t o t he quot e fi l e name combi ned wi th t he run
number. I f a model wi th the same name al ready exi st s i n t he sel ect ed pat h, you wil l be
prompt ed t o sel ect a pat h and/ or fil ename.
Not e: When running a bat ch of sever al model s, t he si mul t aneous saving of model s at t he
end of t he run may resul t i n sl ow syst em performance. When dat a i s being export ed at
end of run, i t may not al ways be necessary t o save model s at end of run. I nst ead, a
part i cul ar model could l at er be re- cr eat ed because t he random seed values of all model s
ar e st ored i n t he export fil e.
10.1.12 Pause models at end of run
Check t hi s t o aut omat i call y pause model s at t he end of t he run or l eave t hi s unchecked
t o keep all model s evol vi ng aft er t he end of t he bat ch run.
10.1.13 Close models at end of run
Check t hi s t o aut omat i call y close model s at t he end of t he run. Not e t hat i f Save model s
at end of run i s unchecked and Cl ose model s at end of run i s checked, all model dat a
wi ll be l ost aft er compl et i on of the bat ch (except for any export ed dat a) .
10.2 Starting a batch
Aft er all t he bat ch set t i ngs have been speci fi ed, t he bat ch process can be st art ed by
cli cki ng St art in t he Bat ch Processi ng di al og box. Thi s will l aunch all t he request ed
model s in separat e Adapt i ve Model er inst ances. The model s will appear mini mi zed in the
Windows Task Bar and evol ve in t he background. You can vi ew t he model s as desi red for
i nst ance by usi ng t he window arrangement opt ions t hat appear aft er ri ght - cli cki ng on t he
Adapt i ve Model er i con in t he Wi ndows Task Bar. ( Not e t hat vi ewi ng mul tipl e Adapti ve
Model er inst ances wi t h Chart s, Popul at ion Panels or Performance Panel s vi si bl e during
model evol ution may reduce syst em performance) .
Bat ches can be cr eat ed and st art ed in Adapt i ve Model er wi th or wi t hout a model al ready
running. I n case no model i s running yet and a bat ch i s st art ed t hat cr eat es onl y one
model , t hen t hat model will be l aunched in t he Adapt i ve Model er i nst ance t hat i s al ready
running.
10.3 Saving and opening batch settings
Bat ch process set t i ngs can be saved and reopened for fut ure use by using t he Save
and Open but t ons in t he Bat ch Processing di al og box. Not e t hat st art i ng a bat ch
does not aut omat i call y save t he Bat ch set t ings. I f not saved, bat ch set t i ngs will be l ost
aft er t he bat ch has been st art ed.
10.4 Starting a batch from the command line
Bat ch processing funct ionali t y i s al so accessi bl e t hrough t he command line. See Appendi x
I I for t he command line synt ax of Adapt i ve Model er.
87
10.5 Updating a model
An al ready exi st i ng model can aut omat i call y be updat ed form t he command line. Thi s
means t hat Adapt i ve Model er opens t he model , evol ves i t until t he end of t he quot e fil e,
saves i t and t hen exi t s. Thi s i s useful for aut omat i call y updat ing a model , for inst ance at
t he end of every day, wi t hout having t o keep t he model open all the t i me. I n part i cul ar,
t hi s i s useful when the model i s export ing t radi ng si gnal s or ot her dat a t o a . csv fil e
whi ch i s bei ng processed by ot her appli cat ions.
I f a model i s in paused st at e, t he model will st ill be updat ed. ( The model will t hen be
saved i n paused st at e agai n) . When no new ( unprocessed) quot es have been added t o
t he quot e fil e, updat ing a model has no eff ect . Be aware t hat Adapt i ve Model er
aut omat i cal l y saves t he updat ed model ( wi thout prompting) . Not e t hat Adapt i ve Model er
runs mini mi zed when updat i ng a model and automat i cal l y exi t s when fi ni shed. See
Command line synt ax for how t o use t he Updat e swi t ch on t he command line.
88
Appendices
I . Dat a seri es refer ence
I I . Command line synt ax
I I I . Genet i c programmi ng i n Adapt i ve Model er
89
I. Data series reference
I.1 Security data series
I.1.1 Price
Thi s i s t he securi t ys pri ce as t aken from t he quot e fil e. I t i s possi bl e to show Open, Hi gh,
Low, Close ( OHLC) bar s or j ust Close lines by set t i ng t he paramet er. OHLC bar s will onl y
be drawn when t here i s enough space per bar in t he chart . Thi s depends on t he sel ect ed
Chart peri od and t he chart s wi dth.
I.1.2 Bid and Ask
These are t he Bi d and Ask pri ces from t he quot e fil e. I f Bi d or Ask pri ces ar e not i ncl uded
i n t he quot e fi l e or if they ar e zero, no val ue i s ret urned.
I.1.3 Spread
Thi s i s t he di fference bet ween t he Bi d and Ask pri ce as a per cent age of t he close pri ce. I f
t here i s no Bi d or Ask pri ce or if t he Bi d or Ask pri ce i s zero, no value i s ret urned.
I.1.4 Volume
Thi s i s t he securi t ys t raded vol ume as t aken from t he quot e fil e.
I.1.5 Bar Return
These are dat a seri es for bar- t o- bar ret urns ( close- t o- close or t i ck- t o- t i ck ret urns) and
may be used for quant i t at i ve anal ysi s. For ordinary i nvest ment ( performance) ret urn
seri es, see I .1. 6 Ret urn.
I .1.5 .1 Ret urn
Thi s i s t he bar- t o- bar ret urn. The bar ret urn at bar t where P
t
i s t he closing pri ce of t he
securi t y at bar t i s:
1
1
=
t
t
t
P
P
R
Thi s dat a seri es can be used t o cal cul at e t he aut ocorrel at i on of ret urns by addi ng an
aut ocorrel at ion seri es t o t hi s dat a seri es.
I .1.5 .2 Log Return
Thi s i s t he l ogari t hmi c bar-t o- bar ret urn. The logari t hmi c bar ret urn at bar t where P
t
i s
t he cl osing pri ce of the securi t y at bar t i s:
|
|
.
|
\
|
=
1 t
t
t
P
P
ln R
90
Thi s dat a seri es can be used t o cal cul at e t he aut ocorrel at i on of l og ret urns by addi ng an
aut ocorrel at ion seri es t o t hi s dat a seri es.
I .1.5 .3 Absolute Ret urn
Thi s i s t he absol ut e bar- t o- bar ret urn and i s cal cul at ed by t aki ng t he absol ut e val ue of
t he Ret urn dat a seri es. Not e t hat Absolut e Ret urn i s a measure of vol ati lit y. Thi s dat a
seri es can be used t o cal cul at e t he aut ocorrel ation of vol atili t y by addi ng an
aut ocorrel at ion seri es t o t hi s dat a seri es.
I .1.5 .4 Absolute Log Ret urn
Thi s i s t he absol ut e logari t hmi c bar- t o- bar ret urn and i s cal cul at ed by t aking t he absol ut e
val ue of the Log Ret urn dat a seri es. Not e t hat Absol ut e Log Ret urn i s a measure of
vol at i li t y. Thi s dat a seri es can be used t o cal cul at e t he aut ocorrel at ion of vol atili t y by
addi ng an aut ocorrel at ion seri es t o t hi s dat a series.
I .1.5 .5 Ret urn Dist ribution
The Ret urn Di st ri bution dat a seri es shows a hi st ogram of t he logari t hmi c bar ret urns of
t he securi t ys pri ce duri ng t he speci fi ed cal cul ati on peri od. I n addi ti on t o the regul ar
di st ri bution seri es st at i st i cs ( mean, st dev, medi an, min and max) al so t he kurt osi s i s
shown i n t he dat a overl ay window.
I.1.6 Return
The Ret urn dat a seri es gi ves t he ret urn of t he securi t y over t he speci fi ed cal cul at i on
peri od usi ng t he speci fi ed cal cul ati on met hod.
The cumul at i ve ret urn over a cal cul ati on peri od ( s, e) where s i s t he fi rst bar of the
cal cul at ion period, e i t s l ast bar, and P
t
the cl osing pri ce of t he securi t y at bar t , i s:
1 =
s
e
P
P
R
The compounded ret urn over a cal cul at ion period ( s,e) i s:
1
1
|
|
.
|
\
|
=
Per iods
s
e
P
P
R
where Periods i s t he number of compounding peri ods bet ween s and e.
For compoundi ng peri ods t hat ar e longer t han or equal to 1 week, Periods i s si mpl y
cal cul at ed as ( t
e
- t
s
) / c where c i s t he durati on of the compounding period. For
compoundi ng periods short er t han 1 week, t he amount of market t r adi ng ti me bet ween e
and s, and t he aver age durat i on of t he compoundi ng peri od i n market t r ading ti me
( during t he cal cul at ion peri od) are t aken i nt o account in t he cal cul at ion.
I f Periods i s l ess t han 0.75, t hi s dat a seri es will ret urn no val ue.
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
91
I.1.7 Volatility
There ar e t wo t ypes of vol at ili t y dat a seri es:
- Wei ght ed Vol at i lit y
- Hi st ori cal Vol at ili t y
I .1.7 .1 Weight ed Volatilit y
The wei ght ed vol at i li t y i s cal cul at ed using an exponenti al l y wei ght ed movi ng average
( EWMA) of squared logari t hmi c ret urns. I t i s assumed t hat t he mean val ue of ret urns i s
zero because wei ght ed vol at ilit y i s t ypi call y used for short t erm peri ods.
The wei ght ed vol at i li t y over cal cul ati on period ( s, e) wi t h decay f act or , compounded t o
t he speci fi ed compounding period of PeriodLengt h bars i s gi ven by:
=
1
0
2
1
1
n
i
i e
i
n
r t h PeriodLeng
where n = e- s+ 1 and r
t
= ln(P
t
/ P
t - 1
).
Not e t hat in order t o incl ude suffi ci ent informat ion i nt o t he cal cul at ion, n shoul d be at
l east n
min
whi ch i s gi ven by:
) ln(
) c ln(
n
min
=
1
where c i s t he desi red confi dence l evel (i .e. 95%, 99% or 99.9%).
I f n
min
cal cul at ed using c = 99.9% i s l ess t han t he number of bars i n t he cal cul at ion
peri od t hen onl y t he requi red (most recent ) number of bars ar e i ncluded in t he
cal cul at ion. I f i t i s more, t hen only t he bars in the cal cul at i on period are used meani ng
t hat i nsuffi ci ent informat i on i s used in t he cal cul at i on.
I f t he cal cul at ion peri od cont ains l ess t han 2 bars, t hi s dat a seri es wi ll ret urn no value.
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
I .1.7 .2 Hist orical Volat ilit y
Hi st ori cal vol atili t y can be cal cul at ed based on a gi ven ( assumed) mean l ogari thmi c
ret urn or on t he act ual mean logari t hmi c ret urn duri ng t he hi st ori cal cal cul ati on period.
For a gi ven ( assumed) mean logari t hmi c ret urn per compounding period , t he hi st ori cal
vol at il i t y
over cal cul ati on period ( s,e) , compounded t o t he speci fi ed compoundi ng
peri od of PeriodLengt h bars i s gi ven by:
1
1
0
2
|
|
.
|
\
|
=
=
n
t h Per iodLeng
r
t h Per iodleng
n
i
i e
where n = e- s+ 1 and r
t
= ln(P
t
/ P
t - 1
).
92
Usi ng t he act ual mean l ogari thmi c ret urn duri ng t he hi st ori cal cal cul at ion peri od, t he
hi st ori cal vol atil i t y
over cal cul at i on period ( s,e) , compounded t o t he speci fi ed
compoundi ng period of PeriodLengt h bars i s gi ven by:
1
1
1
0
2
1
0
2
|
|
.
|
\
|
=
=
n
r
n
r
t h Per iodLeng
n
i
n
i
i e i e
where n = e- s+ 1 and r
t
= ln(P
t
/ P
t - 1
).
I f an overfl ow error occurred during t he comput at i on, a zero val ue i s ret urned.
I f t he cal cul at ion peri od cont ains l ess t han 2 bars, t hi s dat a seri es wi ll ret urn no value.
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
I.1.8 Hurst Exponent
The Hurst Exponent i s a st at i st i cal measure of t he predi ct abili t y of a t i me seri es. I t
i ndi cat es whet her a t i me seri es i s t rend rei nforci ng, mean revert i ng or random. The Hurst
exponent can range f rom 0 to 1. Val ues above 0.5 indi cat e a t r end reinforcing ti me
seri es, val ues bel ow 0.5 indi cat e a mean revert ing seri es and 0.5 i ndi cat es a compl et el y
random seri es. The furt her away t he val ue i s from 0. 5, t he l ess random t he t i me seri es
i s.
The Hurst Exponent i s incl uded i n Adapt i ve Model er as a met hod t o check whet her a
securi t ys pri ce hi st ory cont ai ns any predi ct abili ty or i s mostl y random. For i nst ance,
when Forecast Di rect i onal Accuracy i s l ow, t hi s may be caused by t he l ack of
predi ct abili t y i n t he securi t y pri ces. However i t should be not ed t hat t he Hurst exponent
i s an est i mat e and may not al ways gi ve a compl et e pi ct ure of t he predi ct abi lit y of a t i me
seri es.
Adapt i ve Model ers Hurst exponent cal cul at ion follows an approach commonl y used in
quant i t at i ve finance
40
. Because di fferent ways of cal cul at ing Hurst exponent s exi st , i t
may not be saf e t o compare Hurst exponent s t hat wer e cal cul at ed by di fferent syst ems.
However, t he Hurst exponent s of common fi nanci al ti me seri es cal cul at ed by Adapt i ve
Model er generall y correspond wi t h t hose report ed in lit erat ure.
The cal cul at i on peri od can be speci fi ed. I t i s preferred t o use l arge hi st ori cal sampl e
peri ods. For t hi s reason t he mi ni mum number of hi st ori cal bars requi red for t hi s dat a
seri es i s 1000.
I f t he speci fi ed cal cul at i on peri od i s l ess t han 1000 bars, no val ue i s ret urned.
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
40
See for exampl e: [ Bo Qi an, Khal ed Rasheed, Hurst Exponent and Fi nanci al Market Pr edi ct abi l i t y , I ASTED
confer ence on "Fi nanci al Engi neeri ng and Appl i cat i ons"( FEA 2004) , pp. 203 209, 2004] . The Hurst exponent
chart for t he Dow Jones i n t hi s paper can be exact l y r epl i cat ed wi t h Adapt i ve Model er.
93
I.2 Agent-based Model data series
I.2.1 Bars processed
Thi s i s t he t ot al number of quot e bars t hat have been processed by t he model si nce
model evol ution st ar t .
I.2.2 Orderbook
The dat a seri es i n t hi s cat egory gi ve informat ion about t he number of buy or sell orders
i n t he orderbook before or aft er cl eari ng.
Each of these dat a seri es has a par amet er t o speci f y whet her onl y market orders, onl y
l imi t orders or bot h t ypes of orders shoul d be i ncluded i n t he count . By defaul t , bot h
t ypes of orders will be included.
Al so they have a paramet er t o speci fy t hat t he number of orders shoul d be expr essed as
a per cent age of t he popul at i on si ze.
I .2.2 .1 Buy Order s
Thi s i s t he number of buy orders i n t he Virt ual Market s orderbook before cl earing. ( When
t he model i s paused, t hi s i s the number of buy orders t hat wer e in t he orderbook j ust
before t he l ast Vi rt ual Market cl eari ng took pl ace from whi ch t he current forecast was
deri ved) .
I .2.2 .2 Sell Orders
Thi s i s t he number of sell orders i n t he Virt ual Market s orderbook bef ore cl earing. ( When
t he model i s paused, t hi s i s the number of sel l orders t hat wer e i n t he orderbook j ust
before t he l ast Vi rt ual Market cl eari ng took pl ace from whi ch t he current forecast was
deri ved) .
I .2.2 .3 Buy Order s remaining
Thi s i s t he number of buy orders i n t he Virt ual Market s orderbook t hat remain
unexecut ed af t er t he Vi rt ual Market cl eari ng.
I .2.2 .4 Sell Orders remaining
Thi s i s t he number of sell orders i n t he Virt ual Market s orderbook t hat remain
unexecut ed af t er t he Vi rt ual Market cl eari ng.
I.2.3 Price
Thi s cat egory cont ai ns t he following pri ces generat ed by t he agent - based model :
I .2.3 .1 VM Price
Thi s i s t he Vi rtual Market s cl earing pri ce ( see Vi rt ual Market ) . I n t he defaul t
configurati on, t hi s pri ce will be used as t he Forecast . The Vi rt ual Market Pri ce VMP
t
for
t i me t i s cal cul at ed aft er t he securi t ys pri ce P
t - 1
has been recei ved and t he agent s have
eval uat ed t hei r t radi ng rul es and pl aced t hei r orders.
94
Not e t hat t he dat e and t i me of thi s dat a seri es i s ini ti all y set t o t he expect ed dat e and
t i me of (upcoming) bar t ( for whi ch t he forecast i s int ended) . Aft er bar t has act ual l y
been recei ved, t he dat e and t i me of t hi s dat a seri es i s adj ust ed t o t he act ual dat e and
t i me of bar t (i n case t hi s was di fferent t han t he expect ed dat e and t i me) . I n case a
vari abl e quot e int erval i s used, t he expect ed dat e and t i me i s based on t he average
rounded quot e int erval and wil l obviousl y be most l y i rrel evant si nce t he exact dat e and
t i me of t he next bar ar e st il l unknown.
I .2.3 .2 VM Bid and Ask
These are t he ( hi ghest ) bi d and (lowest ) ask price of any remaining orders of agent s t hat
coul d not be execut ed on t he Virt ual Market . Somet i mes ext reme bi d or ask pri ces may
occur. These are usuall y caused by onl y one or a few agent s wi t h exoti c behavi or and do
not necessari l y have a si gnifi cant effect on t he model . Not e t hat gaps in a bi d/ ask chart
i ndi cat e t hat t her e was no bi d/ ask pri ce at t hat t i me, meaning that all orders wer e full y
execut ed.
I .2.3 .3 VM Spread
Thi s i s t he di fference bet ween t he Virt ual Market s Bid and Ask pri ce as a percent age of
t he Vi rt ual Market Pri ce. The spread i s cal cul at ed aft er t he Vi rt ual Market cl eari ng and
t hus onl y t akes t he remai ning orders int o account t hat coul d not be execut ed. I f t here
was no Bi d or Ask pri ce, no val ue i s ret urned.
I .2.3 .4 Best Agent s Price
The Best Agent s Pri ce i s t he pri ce t hat woul d have been t he cl eari ng pri ce i f onl y the
orders of a group of best performing agent s would have been t aken i nt o account . So for
t he purpose of cal cul at ing t he Best Agent s Pri ce, t he pri ce di scovery mechani sm as
descri bed i n Virt ual Market i s appl i ed t o onl y t he buy and sell orders of t he best
performi ng agent s. Act ual market cl eari ng however al ways t akes i nto account t he orders
of all agent s.
The best agent s ar e sel ect ed every bar and t hus f orm a dynami c group. The group si ze
can be speci fi ed by t he user ( see 5.2.5) . The sel ect i on cri t eri on used i s t he Breedi ng
Fi t ness Ret urn. Not e t hat onl y agent s of at l east t he Mi ni mum Breedi ng Age will be
i ncluded in t he sel ect i on process. I f no orders of t he Best Agent s group can be mat ched,
t hen t he Best Agent s Pri ce wil l be t he aver age of t he hi ghest Best Agent s Bi d pri ce and
t he l owest Best Agent s Ask pri ce. I f t here i s no Best Agent s Bid pri ce t hen t he Best
Agent s Pri ce will be t he Best Agent s Ask pri ce. Vi ce ver sa, i f t here i s no Best Agent s Ask
pri ce t hen t he Best Agent s Pri ce wil l be t he Best Agent s Bi d pri ce. I f nei ther exi st s ( i .e.
when t here ar e no Best Agent s li mit orders) t hen t he Best Agent s Pri ce will be set t o t he
Vi rtual Market pri ce.
The Best Agent s Pri ce can be used as t he Forecast as an al t ernat i ve t o t he Vi rt ual Market
Pri ce ( see 5.2.5 Forecast ) . As for t he Vi rt ual Market Pri ce, The Best Agent s Pri ce BAP
t
at
t i me t i s cal cul at ed aft er t he securi t ys pri ce P
t - 1
has been recei ved and t he agent s have
eval uat ed t hei r t radi ng rul es and pl aced t hei r orders. The dat e and t i me i s set i n t he
same way as for t he Virt ual Market Pri ce dat a seri es.
I.2.4 VM Volume
Volume i s t he t ot al number of shares t hat were t raded on t he Virt ual Market at t i me t .
Volume i s doubl e count ed whi ch means t hat i t i s t he number of shares bought by
agent s pl us t he number of shares sol d by agent s. As t hese number s ar e equal and t he
t ot al i s t wi ce t he number of act ual shares changing hands t hi s i s cal l ed doubl e
counti ng .
95
I.2.5 VM Trades
Thi s i s t he number of agent orders t hat were execut ed on t he Virt ual Market at t i me t . As
ever y agent can pl ace no more t han one order at any t i me t , t hi s i s an indi cat i on of t he
number of agent s t hat were act i vel y t radi ng at t ime t ( not counti ng t hose whose orders
coul d not be execut ed). Not e t hat when an agent swi t ches a long posi ti on for a short
posi ti on or vi ce versa, t hi s i s count ed as a si ngl e t rade ( al t hough t he fi xed broker fee wil l
be charged t wi ce) .
Thi s dat a seri es has a par amet er t o speci fy whet her all orders, onl y market orders, or
onl y l i mi t orders should be incl uded in the count . By defaul t , all orders are i ncluded.
I.2.6 Bar Return
These are bar- t o- bar ret urn dat a seri es for t he Virt ual Market Pri ce. They ar e cal cul at ed
i n t he same way as t he Securi t y Bar Ret urn dat a seri es.
I.2.7 VM Return
The VM Ret urn dat a seri es gi ves t he ret urn of t he Vi rt ual Market pri ces over t he speci fi ed
cal cul at ion period usi ng t he speci fi ed cal cul ati on met hod. I t i s cal cul at ed in t he same way
as t he Securi t y Ret urn dat a seri es.
I.2.8 VM Volatility
The VM Vol at ili t y dat a seri es cal cul at e t he wei ght ed or hi st ori cal vol atili t y of t he Vi rt ual
Mar ket pri ces. They are cal cul at ed i n t he same way as t he Securi t y Vol at ili t y dat a seri es.
I.2.9 Forecast
The forecast pri ce F
t
for t he securi t y for ti me t i s ei t her t he Virt ual Market Pri ce ( by
defaul t ) or t he Best Agent s Pri ce, as speci fi ed by t he user ( see 5.2.5 Forecast ).
I.2.10 Forecast Accuracy
I .2.1 0.1 Forecast ed Price Change
The Forecast ed Pri ce Change i s t he difference bet ween a forecast ( F
t
) and t he most
recent securi t y pri ce ( P
t - 1
) t hat was known by t he agent - based model when generat i ng
t he f orecast . Posi ti ve/ negat i ve val ues i ndi cat e higher/ l ower forecast s t han t he most
recent pri ce.
1
1
|
|
.
|
\
|
=
t
t
P
F
e Pr iceChang For ecast ed
The si gn of t he Forecast ed Pri ce Change indi cat es t he forecast ed di rect ion of pri ce
change and t hi s dri ves t he Tradi ng Signal Generat or. I t s absolut e val ue t ell s how close
t he f orecast s ar e t o t he most recent real market pri ce and can be an indi cat or of
vol at i li t y, model st abil it y, forecast confi dence or ot her f act ors and can t hus be i mport ant
for t he Tradi ng Syst em. The influence of t he absolut e val ue on t he Tradi ng Syst em can
t herefore be cont roll ed by t he Significant Forecast Range paramet er i n t he Trading
Syst em par amet ers.
96
When t he forecast i s exact l y equal t o t he most recent pri ce ( or when t he Forecast ed Pri ce
Change i s out si de t he Si gnificant Forecast Range) , t hi s wi ll not be consi dered an act ual
forecast because no ( si gnifi cant ) direct i on of price change i s forecast ed. Thi s i s rel evant
for t he Forecast Di rect i onal Accuracy and Forecast Di rect i onal Si gnifi cance dat a seri es
and al so for t he Trading Syst em whi ch will regar d t hese as neut r al (insi gnifi cant )
forecast s.
Thi s dat a seri es has a Source paramet er t hat allows t he user t o sel ect whi ch pri ce dat a
shoul d be used as t he Forecast f or t he purpose of cal cul ati ng t hi s dat a seri es. Thi s can be
ei t her t he Virt ual Market Pri ce or t he Best Agent s Pri ce (regardl ess of whi ch pri ce dat a
has been sel ect ed as t he basi s for t he Forecast i n t he Model confi gurat i on paramet ers) .
Thi s allows easy compari son of the forecast accuracy of t he Vi rtual Market Pri ce and t he
Best Agent Pri ce. The Source par amet er can al so be set t o Forecast ( t hi s i s t he defaul t
set t i ng) indi cat i ng t hat what ever has been sel ect ed as t he basi s for t he Forecast i n t he
Model confi gurat i on paramet er s shoul d be used for t hi s dat a seri es.
I .2.1 0.2 Forecast Er ror
The Forecast Error gi ves t he di fference bet ween t he forecast ( F
t
) and t he securi t y pri ce
( P
t
) at t i me t for whi ch t he forecast was i nt ended. Posi ti ve/ negat i ve val ues i ndi cat e
hi gher/ l ower forecast s t han t he act ual pri ce.
Forecast Error
t
= F
t
- P
t
The Forecast Error can al so be expr essed as a percent age of pri ce ( by set t i ng t he
correspondi ng paramet er) . The cal cul at ion t hen becomes:
1
|
|
.
|
\
|
=
t
t
t
P
F
ror Forecast Er ( Relat ive)
Al t hough t he Forecast Error i s oft en bi gger t han t he Forecast ed Pri ce Change, t he si gn of
t he Forecast Error (in rel ati on to t he si gn of t he Forecast ed Pri ce Change) i s generall y
more i mport ant t han i t s absol ut e val ue. Thi s i s because t he si gn of t he Forecast ed Pri ce
Change indi cat es t he forecast ed di rect i on of pri ce change and t hi s dri ves t he Tradi ng
Si gnal Generat or.
Thi s dat a seri es has a Source paramet er.
I .2.1 0.3 Mean Absolut e Error
The Mean Absol ut e Error ( MAE) i s t he average of t he absolut e forecast errors during a
gi ven period.
More preci sel y, t he MeanAbsolut eError over cal cul at ion period ( s,e) i s:
=
=
1
0
1
n
i
i e
ror Forecast Er
n
t eError MeanAbsolu
where n = e- s+ 1 and Forecast Error
t
i s defi ned as t he Forecast Error dat a seri es.
The paramet er Express as a percent age of pri ce can be used t o get t he Mean Absolut e
Error as a per cent age of t he securi t y pri ce.
Thi s dat a seri es has a Source paramet er.
97
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
I .2.1 0.4 Mean Squared Error
The Mean Squared Error ( MSE) i s t he aver age of t he squar ed forecast error during a
gi ven period. The MeanSquaredError over cal cul at i on peri od ( s,e) i s:
=
=
1
0
2
1
n
i
i e
ror Forecast Er
n
dError MeanSquare
where n = e- s+ 1
For t he rest , t hi s dat a seri es i s equi val ent t o t he Mean Absolut e Error dat a seri es.
I .2.1 0.5 Root Mean Squared Error
Thi s dat a seri es ret urns t he squar e root of t he Mean Squared Error dat a seri es.
I .2.1 0.6 Right / Wrong Forecast ed Price Changes
The Ri ght Forecast ed Pri ce Changes dat a seri es shows t he securi t ys cl ose pri ce, but onl y
t hose line segment s are shown (i n blue) t hat correspond t o pri ce changes for whi ch t he
ri ght direct ion was forecast ed. Thi s provi des a vi sual indi cat ion of how many pri ce
changes wer e forecast ed correct and al so of t he magni t ude of t hose pri ce changes.
Li kewi se, t he Wrong Forecast ed Pri ce Changes dat a seri es shows t he line segment s ( i n
red) correspondi ng t o pri ces changes for whi ch the di rect i on was forecast ed wrong.
I t i s recommended t o show bot h dat a seri es t oget her i n one chart .
Not e: When a long Chart peri od i s used ( spanning several t housands of bars) , t hese dat a
seri es wil l not be drawn because of i nsuffi ci ent space t o render t he l ine segment s cl earl y.
I n t hi s case t he name of t he dat a seri es above t he chart will be shown in gray.
Thi s dat a seri es has a Source paramet er.
I .2.1 0.7 Forecast Direct ional Accuracy
Thi s a t he percent age of bars duri ng a gi ven period for whi ch t he forecast ed pri ce change
was in t he same di rect i on as t he act ual pri ce change ( from t he l ast pri ce on whi ch t he
forecast was based t o t he new pri ce) .
Cases wher e F
t
= P
t - 1
( neut ral forecast ) or P
t
= P
t - 1
( no pri ce change) are count ed as
nei ther a right nor a wrong forecast and are deemed i nsi gnifi cant forecast s. When t he
Appl y Signi fi cant Forecast Range par amet er i s checked, cases where t he absolut e
forecast ed pri ce change i s out si de t he Si gnifi cant Forecast Range ar e al so deemed
i nsi gnifi cant . A Forecast Di rect ional Accuracy of 50% t heref ore al ways indi cat es exact l y
t he same number of right and wrong forecast s even t hough some (or all) forecast s may
have been i nsi gnifi cant . 50% i s t hus t he neut ral l evel for t hi s i ndi cat or.
When t he Forecast Di rect i onal Accuracy i s frequent l y above 50% t hi s i ndi cat es
forecast i ng success ( t hough i t may not necessaril y be enough t o cover t ransact i on cost s,
l osses, et c.) . Al so see 7.1 Evaluat i ng forecast ing success for more on how t o int erpret
model behavior and f orecast i ng abili ti es.
98
Not e t hat when t here ar e frequent insi gnifi cant forecast s t he indi cat or becomes l ess
si gni fi cant because l ess si gnifi cant forecast s wer e incl uded in the aver age. For t hi s reason
i t i s recommended t o consul t t hi s indi cat or in combinat ion wi t h t he Forecast Di rect i onal
Si gnifi cance dat a seri es.
More preci sel y, t he Forecast Direct i onalAccuracy over a cal cul ati on peri od (s,e) i s gi ven
by:
n
FDA
ccur acy r ect ionalA For ecast Di
n
i
i e
=
=
1
0
where n = e- s+ 1 and:
<> =
= =
<> =
=
0 eDir ect ion Pr iceChang AND r ect ion For ecast Di - eDir ect ion Pr iceChang if 0,
0 eDir ect ion Pr iceChang OR 0 r ect ion For ecast Di if 0.5,
0 eDir ect ion Pr iceChang AND r ect ion For ecast Di eDir ect ion Pr iceChang if 1,
FDA
i i i
i i
i i i
i
where
=
<
>
=
1
1
i i
1 - i i
i i
i
P P if 0,
P P if 1, -
P P if 1,
ir ect ion iceChangeD Pr
and Forecast Di rect ion
i
i s defined as follows:
When Appl y Signifi cant Forecast Range i s checked,
+ > + <
+ < + >
=
ot her wise 0,
RangeMax) ( 1 / P F AND RangeMin) ( 1 / P F if 1, -
RangeMax) ( 1 * P F AND RangeMin) ( 1 * P F if 1,
r ect ion For ecast Di
1 - i i 1 - i i
1 - i i 1 - i i
i
where RangeMin and RangeMax are defi ned by t he Si gnifi cant Forecast Range as
speci fi ed in the Trading Syst em par amet er s.
When Appl y Signifi cant Forecast Range i s not checked,
=
<
>
=
1 - i i
1 - i i
1 - i i
i
P F if 0,
P F if 1, -
P F if 1,
r ect ion For ecast Di
When t he wei ght ed par amet er i s checked, t he FDA
i
val ues are exponent i al l y wei ght ed
t o gi ve more emphasi s on recent bars. Thi s may increase t he forward indi cat i veness of
t he dat a seri es. The formul a for t he wei ght ed FDA over a cal cul at ion period ( s,e) i s:
99
=
1
0
1
1
n
i
i
i e
n
FDA uracy ct ionalAcc recast Dire Weight edFo
where n = e- s+1 and =0.97.
Note that with =0.97 and a confidence level of 99%, the required number of values to
i nclude suffi ci ent i nformat i on int o t he cal cul at ion i s 151 ( al so see wei ght ed vol at il i t y) .
Therefore, n i s aut omat i call y maxi mi zed t o 151 for t he wei ght ed FDA cal cul at ion.
Thi s dat a seri es has a Source paramet er.
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
I .2.1 0.8 Single Bar FDA
Thi s dat a seri es ret urns t he FDA of onl y t he l ast bar. I t s values are t her efore ei t her 100%
( ri ght forecast ) , 0% ( wrong forecast ) or 50% (insi gnifi cant forecast ) . I t can for inst ance
be used for cal cul at ing t he aut ocorrel at ion of FDA by addi ng an aut ocorrel ati on indi cat or
t o t hi s seri es.
For t he rest , t hi s dat a seri es i s equi val ent t o t he FDA dat a seri es.
I .2.1 0.9 Forecast Direct ional Significance
Thi s i s t he percent age of si gni fi cant forecast s duri ng a gi ven peri od. Si gni fi cant forecast s
ar e f orecast s wher e F
t
< > P
t - 1
( forecast di ffers from l ast pri ce) and P
t
< > P
t - 1
( pri ce
di ffers from l ast pri ce) . I n ot her words, a si gnifi cant forecast i s a forecast t hat i s useful in
t he sense t hat a Tradi ng Si gnal can be deri ved from i t ( even t hough t he forecast may
t urn out t o be wrong) whereas an insi gni fi cant forecast i s usel ess as i t ei t her doesnt
i ndi cat e an up or down direct i on or i t was gi ven f or a bar t hat t urned out not t o bring any
pri ce change ( such as a holiday) .
I f t he Appl y Signifi cant Forecast Range par amet er i s checked, t he absolut e forecast ed
pri ce change al so needs t o be wi t hin t he Signifi cant Forecast Range i n order for the
forecast t o be consi dered si gnifi cant .
Thi s i ndi cat or gi ves an i ndi cat ion of the si gnifi cance of t he Forecast Di rect i onal Accuracy
dat a seri es. I t does not i mpl y anyt hi ng about t he vali di t y or reli abi lit y of t he Forecast
Di rect i onal Accuracy ot her t han t hat i t count s t he number of si gni fi cant forecast s. Thi s i s
especi all y useful when t he Forecast Di rect i onal Accuracy i s approachi ng unusuall y high or
l ow val ues. Al so, t hi s indi cat or can be used t o see how many act ual f orecast s ( F
t
< > P
t - 1
)
t he Agent - based Model i s generat i ng for t he purpose of eval uat i ng whet her t he model i s
st il l generat i ng forecast s or rat her t ri es t o st ay neut ral and sti ck t o t he market pri ce
( see al so Forecast ed Pri ce Change) .
The Forecast Di rect ionalSigni ficance over a cal culat i on period ( s,e) i s gi ven by:
n
FDS
e ignificanc r ect ionalS For ecast Di
n
i
i e
=
=
1
0
where n = e- s+ 1 and FDS
i
i s defi ned as foll ows:
When Appl y Signifi cant Forecast Range i s checked,
100
+ > + <
+ < + >
<> <>
=
ot her wise 0,
) RangeMax) ) ( 1 / P F AND RangeMin) ( 1 / P ( F
OR RangeMax) ) ( 1 * P F AND RangeMin) ( 1 * P ( F (
AND P P AND P F if 1,
FDS
1 - i i 1 - i i
1 - i i 1 - i i
1 - i i 1 - i i
i
where RangeMin and RangeMax are defi ned by t he Si gnifi cant Forecast Range as
speci fi ed in the Trading Syst em par amet er s.
When Appl y Signifi cant Forecast Range i s not checked,
<> <>
=
ot herwise 0,
P P AND P F if 1,
FDS
1 - i i 1 - i i
i
Thi s dat a seri es has a Source paramet er.
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
I .2.1 0.10 Forecast Direct ional Area Under Curve ( FD AUC)
Thi s i s t he Area Under t he ROC
41
Curve ( AUC) of t he forecast ed di rect i ons. The AUC i s
an i ndi cat or t hat i s used in machine l earni ng, dat a mini ng and ot her fi elds t o measure
t he di scri mi nati ng abili t y of a cl assi fi er. The AUC compar es t he t rue posi ti ve rat e ( TPR)
ver sus t he f al se posi t i ve rat e ( FPR) .
For cal cul at i ng t he Forecast Di rect i onal AUC i n Adapt i ve Model er, t he forecast i s regarded
as a bi nary cl assi fi er predi ct ing ei t her posi ti ve or negat i ve pri ce changes. The si ngl e
poi nt AUC
42
now refl ect s t he probabil it y t hat when one posi t i ve and one negat i ve pri ce
change are randoml y pi cked from hi st ory, t he cl assi fi er has predi ct ed t he di rect ion of
bot h pri ce changes correct l y. I t t hus refl ect s whet her t he Forecast Di rect ional Accuracy
can be at t ri but ed t o correct cl assi fi cat i on ( predi ct i on) of bot h posi ti ve and negat i ve pri ce
changes or t o heavi l y bi ased dat a ( i .e. more posi ti ve pri ce changes t han negat i ve ones)
and a f orecast t hat si mpl y exploi t s t hi s bi as.
The AUC normall y ranges from 0.5 t o 1. An AUC of 1 means perfect predi ct i on whil e an
AUC of 0.5 means t hat t he cl assi fi er does not perform bet t er t han random guessi ng. An
AUC below 0.5 i s al so possi bl e. I t indi cat es t hat t he cl assi fi er has di scri mi nati ng abil it y,
however i t s predi cti ons are rever sed. By rever sing t he predi ct i ons, t he cl assi fi er may st i ll
be useful .
The Forecast Di rect ionalAUC over a cal cul at i on period ( s, e) i s gi ven by:
Forecast Direct i onalAUC = ( TPR + 1 - FPR) / 2
where TPR i s the number of correct l y forecast ed up bars ( t rue posi ti ves) di vi ded by t he
t ot al number of up bars duri ng t he cal cul at ion peri od and FPR i s t he number of
41
Recei ver Operat i ng Charact eri st i c; a measur e of t he f ract i on of t rue posi t i ves versus t he fract i on of fal se
posi t i ves. See for i nst ance: Fawcet t , T. ( 2003) . Roc gr aphs: Not es and pract i cal consi derat i ons for dat a mi ni ng
r esearchers. Techni cal Report HPL- 2003- 4. HP Laborat ori es.
42
I t shoul d be not ed t hat t he concept of AUC i s most l y associ at ed wi t h cl assi fi ers t hat ret urn cont i nuous val ues
t hat ar e t urned i nt o bi nary cl assi f i ers by usi ng a di scr i mi nat i on t hr eshol d. For such cl assi fi ers, a f ul l ROC curve
can be made t hrough mul t i pl e ( TPR, FPR) poi nt s by varyi ng t he di scri mi nat i on t hreshol d. Her e however , t he
di rect i onal forecast i s used as a bi nary cl assi f i er i n i t sel f wi t hout an adj ust abl e t hr eshol d so onl y one ( TPR, FPR)
poi nt exi st s. The cal cul at i on i s t her efor e a si ngl e poi nt AUC.
101
i ncorrect l y forecast ed up bars ( fal se posi ti ves) di vi ded by t he t ot al number of down bars
during t he cal cul at i on period.
Bars wher e F
t
= P
t - 1
( neut ral forecast ) or P
t
= P
t - 1
( no pri ce change) ar e excl uded from t he
TPR and FPR count . When t he Appl y Si gni fi cant Forecast Range par amet er i s checked,
bars wher e t he absol ut e forecast ed pri ce change i s out si de t he Signifi cant Forecast Range
ar e al so excl uded f rom t he TPR and FPR count .
Thi s dat a seri es has a Source paramet er.
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
I.2.11 Filtered Volatility
The fil t ered vol at il it y dat a seri es provi de a way t o st udy t he hi st ori cal vol atil i t y of the
securi t y duri ng right forecast ed bar s separ at el y from t he vol atili t y during wrong
forecast ed bars. Thi s can be meani ngful informat i on si nce (obviousl y) t he dif ference
bet ween t he vol atili t y during ri ght forecast ed bars and t he vol at ili t y during wrong
forecast ed bars i s one of t he fact ors t hat det ermine t radi ng ret urns. Cl earl y, when t he
vol at i li t y of ri ght forecast ed bars i s higher (on aver age) t han t he vol at il it y of wrong
forecast ed bars, t he t r ading ret urns wi ll be higher t han i n t he opposi t e scenari o ( all el se
bei ng equal ) . Apart from having a hi gh Forecast Direct i onal Accuracy, a model can
i ncrease t he ret urns of i t s t rading si gnal s by focusi ng more on bars wi t h a high expect ed
vol at i li t y t han bars wi t h a l ow expect ed vol at ili t y. Thi s way a model can benefi t from
aut ocorrel at ion of vol atil it y i f present .
The fil t ered vol at il it y concept can al so be used as a par amet er i n t he St at i st i cal
Si mul ations ( Mont e Carlo) dat a seri es t o si mul at e t he effect s of di ff erences i n Ri ght Bar
vs. Wrong Bar vol at i li t y on ret urns.
Preci sel y, t he filt ered vol at ili t y dat a seri es consi st of three di fferent dat a seri es:
- Ri ght bars (vol at i lit y of right forecast ed bars)
- Wrong bars ( vol atili t y of wrong forecast ed bars)
- I nsi gnifi cant bars ( vol at ili t y of bars for whi ch the forecast was i nsi gnifi cant )
The defi ni tions of ri ght , wrong and insi gnifi cant bars correspond exact l y wi t h those of t he
Forecast ed Di rect i onal Accuracy dat a seri es. The fi l t ered vol at i lit y seri es incl ude in t he
vol at i li t y cal cul ati on onl y t hose bar s during t he speci fi ed cal cul at ion peri od t hat ar e of t he
sel ect ed t ype ( ri ght , wrong or insi gni fi cant ) . I f t he number of bars t hat can be i ncl uded in
a cal cul at i on i s l ess t han 2, a zero val ue i s ret urned.
The fil t ered vol at il it y seri es ar e ot herwi se i mpl ement ed in t he same way as t he Securi t ys
hi st ori cal vol atil i t y dat a seri es.
I.2.12 Population
Thi s cat egory cont ai ns several dat a seri es t hat present i nformat i on about t he agent
popul ation. Not e t hat t her e ar e no popul ation ret urn dat a seri es. Thi s i s because
popul ation ret urn i s di ffi cul t to defi ne because of compli cat i ons caused by agent
repl acement s. However, vari ous dat a seri es are provi ded t o st udy t he agent weal t h and
ret urn di st ri buti ons and indi vidual agent weal t h and ret urns. ( All agent weal t h and ret urn
cal cul at ions t ake i nt o account t he Broker commi ssi ons for agent ) .
102
I .2.1 2.1 Population Size
Thi s i s t he number of agent s i n t he popul ati on. The popul ati on si ze normall y st ays st abl e
during model evol ution.
I .2.1 2.2 Average Agent Age
Thi s i s t he aver age agent age measured i n numbers of bars si nce agent cr eat i on.
I .2.1 2.3 Age Dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of agent age ( measured in
numbers of bars since agent cr eat i on) . Not e t hat usuall y several agent s have a low age
as a r esul t of breeding.
I .2.1 2.4 Average Agent Wealt h
Thi s i s t he t ot al agent popul ation weal t h di vi ded by t he number of agent s. Preci sel y,
Aver ageAgent Weal t h
t
at t i me t wi t h Popul at i onSize
t
bei ng t he number of agent s in t he
popul ation and Agent Wealt h
i, t
bei ng t he weal t h of agent i at t i me t , i s gi ven by:
t
t
t
Size Populat ion
Wealt h Populat ion
nt Wealt h Aver ageAge =
where
=
=
t
Si ze Popul at i on
i
t , i t
h Agent Wealt Wealt h Populat ion
1
and Agent Wealt h
i, t
= Agent Cash
i,t
+ Agent Shares
i, t
* P
t
Agent Cash
i, t
i s t he amount of cash of agent i at t i me t .
Agent Shares
i,t
i s t he ( posi ti ve or negat i ve) number of shares t hat agent i i s hol di ng (long
or short ) at t i me t .
P
t
i s t he securi t ys pri ce at t i me t .
Be awar e t hat t hi s i ndi cat or i s not usef ul for cal cul at ing ret urns of t he agent popul ati on.
Thi s i s because t he popul at ions weal t h can change as a consequence of agent
repl acement .
I .2.1 2.5 Wealt h Dist r ibut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of indi vidual agent weal t h values.
Not e t hat usuall y t he weal t h of sever al agent s i s st i ll near t hei r initi al weal t h because of
t hei r low age.
I .2.1 2.6 St dev Agent Wealt h
Thi s i s an indi cat or of t he st andard devi at ion of agent weal t h. I n fact , t hi s dat a seri es
expr esses t he act ual st andard devi at ion as a per cent age of t he Average Agent Weal t h.
Thi s i s t o make i t easi er t o see changes in weal th di st ri bution apart from changes in t he
t ot al popul ati ons weal t h.
103
I .2.1 2.7 Population Cash
Thi s i s t he t ot al amount of cash owned by al l agent s. The Populat ionCash
t
at t i me t i s:
=
=
t
Si ze Popul at i on
i
t , i t
Agent Cash Cash Populat ion
1
I .2.1 2.8 Population Position
Thi s i s t he t ot al posi ti on i n t he securi t y of all agent s expr essed as a percent age of t hei r
t ot al weal t h. The Populat ionPosit ion
t
at ti me t i s cal cul at ed by:
t
t
t
Wealt h Populat ion
Cash Populat ion
Posit ion Populat ion = 1
Not e t hat short posi ti ons are expr essed as negat i ve val ues.
Thi s cal cul ati on i s equi val ent wi t h a wei ght ed aver age posi ti on where all t he i ndi vi dual
agent s posi ti on values ar e wei ght ed by t hei r weal t h.
I .2.1 2.9 Posit ion Dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of indi vidual agent posi ti on values
( see Agent Posi tion) . Not e t hat t he mean of thi s dat a seri es i s not equal to t he val ue
ret urned by t he Popul at i on Posi tion dat a seri es. Thi s i s because t he mean i s cal cul at ed
here as t he average of all agent posi ti on values whil e t he Popul ation Posi ti on dat a seri es
cal cul at es in fact t he aver age agent posi t ion wei ght ed by agent weal t h.
I .2.1 2.10 Breeding fit ness ret urn dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he Breedi ng fi t ness ret urn of
i ndi vi dual agent s.
I .2.1 2.11 Breeding fit ness excess ret urn dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he Breedi ng fi t ness excess
ret urn of i ndi vi dual agent s.
I .2.1 2.12 Replacement fitness ret urn dist ribution
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he Repl acement fi t ness ret urn
of indi vi dual agent s.
I .2.1 2.13 Replacement fitness excess ret ur n dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he Repl acement fi t ness excess
ret urn of i ndi vi dual agent s.
I .2.1 2.14 Trade Durat ion Dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he Trade Durat i on of indi vidual
agent s ( t he average number of bars bet ween t rades) .
104
I .2.1 2.15 Volat ilit y Dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he Vol ati li t y of indi vi dual agent s
( see Agent Vol at i lit y) .
I .2.1 2.16 Beta Dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he Bet a of indi vi dual agent s
( see Agent Bet a) .
I .2.1 2.17 Generat ion Dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he generat i on val ues of
i ndi vi dual agent s. An agent s gener at i on i s si mply i t s geneal ogi cal generat ion number i n
t he model s hi st ory. The agent s t hat are creat ed at model ini ti ali zat i on are generat i on 1,
t hei r children are gener at i on 2, et c.
I .2.1 2.18 Offspr ing Dist ribut ion
Thi s dat a seri es shows a hi st ogram of t he di st ri bution of t he number of off spring of
i ndi vi dual agent s ( see Agent Offspri ng) .
I .2.1 2.19 Parent s
Thi s dat a seri es ret urns t he number of agent s i n t he popul at ion t hat ar e par ent s ( have
act ed as par ent i n one or more breedi ng operat i ons t hat resul t ed i n new offspring
agent s) .
I .2.1 2.20 Terminat ions
Thi s i s t he number of agent s t hat were repl aced or ot herwi se t er minat ed.
I .2.1 2.21 Creat ions
Thi s i s t he number of newl y creat ed agent s t hat were added t o t he popul ation.
I .2.1 2.22 Default s
Thi s i s t he number of agent s t hat have def aul t ed ( see Def aul t management ) .
I .2.1 2.23 Margin Calls
Thi s i s t he number of agent s t hat have recei ved a margi n cal l ( see Margi n mai nt enance) .
I .2.1 2.24 Genome Size
The genome si ze i s t he si ze of an agent s t r adi ng rul e measured in the t ot al number of
nodes. A node i s a gene i n the genome such as a funct i on or a val ue. The genome si ze
can be an indi cat or of t he compl exi t y of t he t radi ng rul e. Tradi ng rul es change i n si ze and
st ruct ure because of breedi ng operat ors such as crossover and mut at ion.
The Average Genome Si ze dat a seri es show t he aver age genome si ze of t he enti re agent
popul ation whil e t he Min Genome Si ze and Max Genome Si ze seri es show t he mi ni mum
and maxi mum genome si zes in the agent popul at ion. There i s al so a Genome Si ze
Di st ri bution seri es showi ng t he di st ri buti on of i ndi vi dual agent genome si zes.
105
I .2.1 2.25 Genome Dept h
The genome dept h i s t he hi ghest number of hi erar chi cal l evel s t hat occurs in an agent s
genome ( t r ading rul e). The dept h of a t radi ng rul e can be an indi cat or of i t s compl exi t y.
The Average Genome Dept h dat a seri es show t he average genome dept h of t he ent ire
agent popul ation whil e t he Min Genome Dept h and Max Genome Dept h seri es show t he
mini mum and maxi mum genome dept hs i n t he popul ation. There i s al so a Genome Dept h
Di st ri but ion seri es showi ng t he di st ri bution of i ndi vi dual agent genome dept hs.
I .2.1 2.26 Average Nodes Crossed
Thi s i s t he aver age number of genome nodes ( genes) per agent t hat were exchanged i n
crossover operat i ons.
I .2.1 2.27 Average Nodes Mut ated
Thi s i s the aver age number of genome nodes ( genes) t hat wer e changed per mut at i on
operat i on.
I .2.1 2.28 Mut ations
Thi s i s t he number of mut at i on operat i ons t hat t ook pl ace ( t he number of off spring
agent s t hat were mut at ed) .
I.2.13 Agent
Thi s cat egory cont ai ns dat a seri es t hat gi ve informat ion about i ndi vi dual agent s. When
one of these dat a seri es i s l aunched, an agent number needs t o be provi ded. Not e t hat
t hi s number i s not a unique permanent agent i dent i fi er but si mpl y i ndi cat es a sl ot in
t he agent popul ati on. During t hei r life ti me, agent s occupy one slot in t he agent
popul ation until t hey are repl aced by anot her agent or ot herwi se t ermi nat ed. Aft er t hei r
removal from t he agent popul ati on, t hei r dat a can no l onger be request ed and t he sl ot i s
made avail abl e for anot her agent .
However, si nce agent s are ( usuall y) frequent l y bei ng repl aced by new agent s, i t woul d be
i nconveni ent i f a chart cont ai ning dat a about a speci fi c agent woul d suddenl y di sappear
( when t he agent get s repl aced) whi l e t he user i s wat ching the chart . Therefore, t he
hi st ori cal val ues of agent dat a seri es t hat ar e bei ng shown in a chart ar e bei ng preser ved
even aft er agent t ermi nat ion. The moment t hat a new agent t ook over t he sl ot ( repl aci ng
t he previ ous agent ) i s i ndi cat ed by a dot i n t he chart .
Not e t hat where agent number or agent i i s ment i oned, t he slot number i s meant
unl ess i ndi cat ed ot herwi se.
Most agent dat a seri es are non-recomput abl e. Therefore, when vi ewing an agent dat a
seri es i n a chart , t here may be a gap bet ween t he agent s creat ion bar ( mar ked by a dot
i n t he chart ) and t he st art of t he plot t ed val ues. Once an agent s dat a seri es i s bei ng
shown i n a chart , al l hi stori cal val ues will be saved in t he chart (i ncluding those of
previ ous agent s in t he same slot ) .
I .2.1 3.1 Wealt h
Agent Wealt h
i,t
of agent i at t i me t i s gi ven by:
Agent Wealt h
i,t
= Agent Cash
i,t
+ Agent Shares
i, t
* P
t
Agent Cash
i, t
i s t he amount of cash of agent i at t i me t .
Agent Shares
i,t
t he number of shares of t he securi t y t he agent s holds in i t s port folio (long
or short ) at t i me t .
P
t
i s t he securi t ys pri ce at t i me t .
106
Not e t hat Agent Wealt h of the l ast 250 bars i s st ored for all agent s.
I .2.1 3.2 Posit ion
Thi s i s t he agent s posi t ion in t he securi t y expressed as a percent age of i t s weal t h.
Agent Posit ion
i,t
of agent i at t i me t i s cal cul at ed by:
t , i
t , i
t , i
h Agent Wealt
Agent Cash
ion Agent Posit = 1
I .2.1 3.3 Cumulat ive ret urn
The Cumul ati ve ret urn R
i,t
of agent i at t i me t since i t s creat i on at t i me Creat ionTi me i s
gi ven by:
1 =
me Cr eat i onTi , i
t , i
t , i
h Agent Wealt
h Agent Wealt
R
I .2.1 3.4 Cumulat ive excess ret urn
The Cumul ati ve excess ret urn R
i,t
of agent i at t i me t si nce i t s creat ion at t i me
Creat ionTi me i s gi ven by
43
:
me Cr eat i onTi
t
me Cr eat i onTi , i
t , i
t , i
P
P
h Agent Wealt
h Agent Wealt
R =
where P
t
i s t he securi t ys pri ce at t i me t .
I .2.1 3.5 Breeding fit ness ret urn
The Breeding fi t ness ret urn i s a t rai ling ret urn of a weal t h movi ng aver age. Thi s ret urn
measure i s used as t he fi tness cri t erion for t he sel ect i on of agent s t o breed. More
speci fi call y, i t i s t he ret urn over t he l ast n bar s of an exponenti al movi ng aver age of
agent weal t h, where n i s set t o t he mi ni mum breeding age wi t h a maxi mum of 250. I f
t he agent age i s l ess t han n, no val ue i s ret urned.
I .2.1 3.6 Breeding fit ness excess ret urn
The Breeding fi t ness excess ret urn i s the excess Breeding fit ness ret urn over an
exponent i al moving average of t he securi t ys r et urn during the n- bar period.
I .2.1 3.7 Replacement fit ness ret urn
The Repl acement fi t ness ret urn i s the aver age ret urn of a weal t h movi ng aver age ( si nce
agent cr eat i on) per bar. Thi s ret urn measure i s used as t he fi t ness cri t erion for t he
sel ect i on of agent s t o be repl aced by new agent s. More speci fi call y, i t i s t he cumul at i ve
ret urn ( si nce agent creat ion) of an exponenti al moving aver age of agent weal t h, di vi ded
by agent age ( i n bars) , where n i s set t o t he mini mum breeding age wi th a maxi mum of
250. I f t he agent age i s l ess t han n, no val ue i s ret urned.
43
See 8.5. Memor y l i mi t ati ons.
107
I .2.1 3.8 Replacement fit ness excess ret urn
The Repl acement fi t ness excess ret urn i s the excess Repl acement fi t ness ret urn over an
exponent i al moving average of t he securi t ys r et urn si nce agent creat ion
44
.
I .2.1 3.9 Trade Durat ion
Thi s dat a seri es gi ves an i ndi cat ion of the aver age number of bars bet ween successi ve
t rades of an agent . Thi s can be consi dered as a measure of t he t rading hori zon of an
agent or i t s t rading frequency and i s t herefore an i mport ant el ement of t he
t radi ng/ i nvest ment st yl e of an agent . Preci sel y, t he Trade Durat i on i s t he agent s age ( i n
bars) di vi ded by t he number of t rades (buy or sell t ransact ions) t hat have been execut ed
during i t s lifet i me. Not e t hat when an agent swi tches a l ong posi tion for a short posi ti on
or vi ce ver sa, t hi s i s count ed as a si ngl e t rade ( al t hough t he fi xed broker commi ssi on will
be charged t wi ce) . I f an agent has not made any t r ades yet , no val ue i s ret urned.
I .2.1 3.10 Volat ilit y
Thi s dat a seri es gi ves t he hi st ori cal vol at il it y of an agent s weal t h. As t he vol ati li t y can be
used as a measure of absol ut e ri sk, i t i s an i mport ant el ement of t he t rading/ invest ment
st yl e of an agent . The vol atili t y i s annuali zed and i s cal cul at ed over t he l ast 250 bars (or
l ess if t he agent s age i s l ess t han 250 bars) . The vol at i lit y i s cal cul at ed assumi ng a zero
mean l og ret urn. At l east 20 bars must be avail abl e t o cal cul at e t he agent vol atil i t y so
t he agent s age must be at l east 20 bars or no val ue wi ll be ret urned. For t he rest , t he
vol at i li t y i s cal cul at ed i n the same way as t he securi t ys hi st ori cal vol atil i t y.
I .2.1 3.11 Beta
Thi s dat a seri es gi ves t he bet a of an agent s weal t h ret urns agai nst t he securi t ys r et urns.
Since t he bet a can be used as a measure of rel at i ve ri sk, i t i s an i mport ant el ement of
t he t radi ng/ i nvest ment st yl e of an agent . I n par t i cul ar, i t reveal s whet her an agent i s
usi ng a buy- and- hold st yl e st rat egy (bet a near 1) , a cont rari an st yl e st rat egy ( negat i ve
bet a) or an absolut e ret urn ( hedge fund ) st yl e st rat egy (bet a near 0) . The agent bet a i s
cal cul at ed on t he pri ce changes per bar over t he l ast 250 bars ( or l ess i f t he agent s age
i s l ess t han 250 bars) . At l east 20 bars must be avail abl e t o cal cul at e t he agent bet a so
t he agent s age must be at l east 20 bars or no val ue wi ll be ret urned. For t he rest , t he
agent bet a i s cal cul at ed in t he same way as t he Trading Si mul at or bet a.
I .2.1 3.12 Offspr ing
Thi s dat a seri es ret urns t he number of offspri ng of an agent ( new agent s t hat wer e
creat ed in breedi ng ( crossover) operat i ons in whi ch t he agent was a parent ) . Thi s
number incl udes offspri ng agent s t hat have al ready been repl aced/ t ermi nat ed.
44
See 8.5. Memor y l i mi t ati ons.
108
I.3 Trading System data series
I.3.1 Signal
When added t o a chart , t hi s dat a seri es plot s t he t r ading si gnal s in t he chart usi ng t he
foll owing symbol s:
Long signal
Cash signal
Short signal
Li ke t he f orecast s, t he t radi ng si gnal symbol s are plot t ed at t he next bar ( t he bar
foll owing the l ast bar upon whi ch the forecast and t he si gnal were based) . The dat e/ t i me
of thi s dat a seri es i s t he dat e/ t i me of the close of t he l ast bar upon whi ch t he si gnal was
based ( unli ke t he forecast dat e/ t i me) .
The Y- axi s val ue at whi ch t he symbol s are plot t ed i s t he cl osi ng pri ce of t he securi t y at
t he bar upon whi ch t he forecast and t he si gnal wer e based. I t i s recommended t o show
t he Si gnal dat a seri es in a chart t oget her wi th t he Pri ce dat a seri es and/ or t he Forecast
dat a seri es.
Not e: When a long Chart peri od i s used ( spanning several t housands of bars) , t he si gnal s
wi ll not be drawn because of i nsuffi ci ent space t o render t hem cl earl y. I n t hi s case t he
name of t he dat a seri es above t he chart wil l be shown in gray.
Be awar e t hat t he t r ading si gnal s are not exact ly buy or sell si gnal s but i ndi cat e when t o
ent er ( and exi t ) a long or short posi tion. I .e. a cash si gnal aft er a long si gnal means
sel l and a cash si gnal aft er a short si gnal means buy t o cover.
When added t o t he Current Values window, t he Si gnal dat a seri es show t he l ast
gener at ed si gnal .
I.3.2 Trading Simulator
I .3.2 .1 TS Wealt h
The Weal t h
t
of the Trading Si mul at or at t i me t wi t h Cash
t
bei ng t he amount of cash of t he
Trading Si mul at or at t i me t and Shares
t
t he number of shares hel d long ( posi ti ve val ues)
or short (negat i ve values) by t he Tradi ng Si mulat or at t i me t i s gi ven by:
Wealt h
t
= Cash
t
+ Shares
t
* P
t
I .3.2 .2 TS Posit ion
The Posi t ion
t
in t he securi t y of the Trading Si mulat or at t i me t wi th Cash
t
and Wealt h
t
i s:
t
t
t
Wealt h
Cash
Posit ion = 1
Not e t hat short posi ti ons are expr essed as negat i ve val ues.
Because t he Tradi ng Si mul at or al ways uses al l i ts avail abl e capi t al t o ent er a long or
short posi tion, Posit i on i s usuall y ei t her ( approximat el y) + 100% or - 100% or 0%.
Posit i on can be sli ghtl y diff erent from - 100% or + 100% because of t ransact i on cost s and
109
t he f act t hat t he Posit ion i s cal cul at ed based on t he most recent market pri ce whil e t he
pri ce for whi ch t he posi tion was opened may have been di fferent due t o spreads. I f a
short posi tion i s hel d for some t i me whil e the securi t y pri ce increases, t he Posi ti on will
become l ess t han - 100%.
The dat e and t i me t hat i s shown wi t h t he Posi tion dat a seri es i s equal t o t he ( closing)
t i me of t he l ast i mport ed quot e bar. Of course i t i s not possi bl e t o open a posi tion exact l y
at t he same t i me as t he quot e t hat was used t o gener at e t he t radi ng si gnal . I n reali t y a
posi ti on can onl y be opened some t i me aft er t he quot e t i me, t aki ng i nto account t he ti me
t o recei ve t he quot e, t o cal cul at e t he forecast and t radi ng si gnal and to pl ace and fill the
order. Therefore, t he dat e and t i me for t he posi t i on in fact approxi mat el y indi cat es t he
moment when t he posi t i on was opened.
I .3.2 .3 TS Trades
Thi s i s t he number of t rades of t he Trading Si mul at or t hat were execut ed at t i me t . Thi s
i ndi cat or can onl y have t he foll owing val ues:
- 0 (no t rades)
- 1 ( a singl e buy or sel l t ransact i on to go from no posi ti on t o a long or short
posi ti on or vi ce versa)
- 2 ( t wo buy or sell t ransact i ons t o go from a short posi ti on t o a long posi t ion or
vi ce versa)
When short posi tions are di sabl ed onl y t he val ues 0 and 1 are possi bl e.
I t i s recommended t o add a movi ng average t o t hi s dat a seri es t o show the aver age
number of t ransact i ons per bar.
I .3.2 .4 TS Ret urn
The TS Ret urn dat a seri es measures t he Trading Si mul at ors Weal t h ret urn and i s
ot herwi se compar abl e t o t he Securi t y ret urn dat a seri es. Therefore, combi ning t he TS
Ret urn and t he Securi t y Ret urn dat a seri es i n one chart (bot h usi ng t he same cal cul at i on
peri ods and met hods) provi des a good way of compari ng the Trading Si mul at or ret urn
wi th t he Securi t y ret urn.
Al so a TS Excess Return dat a seri es i s avail abl e for di rect l y cal cul at i ng t he excess
ret urns ( Trading Si mul at or ret urn minus Securi ty ret urn) .
Not e t hat al l Tradi ng Si mul at or ret urn cal cul at i ons t ake int o account al l t ransact i on cost s
(i . e. t he broker commi ssi ons, spread and sl ippage as speci fi ed in t he Tradi ng Syst em
Paramet ers) .
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .5 Volat ilit y
The vol at ili t y dat a seri es measure t he vol atili t y of the Trading Si mul at ors Weal t h in t he
same way as t he Securi t y vol at il i t y seri es measure t he securi t ys pri ce vol atili t y.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .6 Bet a
The bet a dat a seri es measures t he bet a of t he Tradi ng Si mul at or weal t h ret urns agai nst
t he securi t ys ret urns. Besi des t he cal cul at ion period, t he pri ce change int erval can be
speci fi ed ( t o cal cul at e i .e. t he dai l y, weekl y, or mont hl y bet a) .
110
The Bet a over a cal cul ati on period ( s,e) wi t h Wealt hRet urn bei ng a seri es of n weal t h
ret urns over periods of t he speci fi ed pri ce change int erval duri ng ( s,e) and R a seri es of
securi t y ret urns over t hese same periods, i s gi ven by:
2
R
) R , t ur n Re Wealt h ( iance var Co
Bet a
=
where
=
=
1
0
1
n
i
R i t ur n Re Weal t h i
) R ( ) t urn Re Wealt h (
n
) R , t urn Re Wealt h ( iance var Co
Not e t hat when t he pri ce change i nt erval i s bi gger t han t he model s quot e i nt erval (i.e.
weekl y when usi ng dail y quot es) , t he bet a i s only cal cul at ed once per i nt erval (i .e. once
per week) . For t hi s reason t he chart shows t he bet a values by dot s i nst ead of lines.
The bet a dat a seri es al so cal cul at es t he R- squar ed ( squar e of t he bet a) as an indi cat ion
of the proportion of the weal t h ret urns vari ance t hat can be at t ri but ed t o t he securi t y
ret urns vari ance. The R- squared val ue i s shown i n t he dat a overl ay of t he bet a dat a
seri es.
I f l ess t han 20 pri ce change i nt erval s ar e avai l abl e i n t he cal cul at i on peri od, t hi s dat a
seri es ret urns no val ue.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .7 Alpha
The al pha dat a seri es measures t he al pha of t he Trading Si mul at or. Al pha i s a measure of
ri sk- adj ust ed excess ret urn.
The Alpha over a cal cul at ion period ( s,e) wi t h Wealt hRet urn being the ret urn of t he
Trading Si mul at or over ( s, e) , compounded t o t he speci fi ed compounding peri od and R
bei ng t he securi t ys ret urn over ( s, e) , compounded t o t he speci fi ed compounding period
and r
f
being t he ri sk free rat e ( per compounding period) i s gi ven by:
Alpha = Wealt hRet urn r
f
Bet a (R- r
f
)
where Bet a i s t he bet a of t he Tradi ng Si mul at or weal t h ret urns agai nst t he securi t ys
ret urns over t he cal cul at i on period (usi ng t he model s quot e int erval as t he bet a s pri ce
change i nt erval ) .
I f Bet a
t
ret urns no val ue, t hen t hi s dat a seri es wi ll ret urn no val ue.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .8 Value at Risk ( VaR)
The VaR dat a seri es measures t he Val ue at Ri sk of the Tradi ng Si mul at or weal t h. VaR
gi ves an est i mat e of t he mini mum l oss t hat can be expect ed wi t h a cer t ai n probabili t y
over a gi ven t i me hori zon.
The met hod used t o est i mat e VaR i s hi st ori cal si mul at i on. Hi st ori cal ret urns are sampl ed
from t he speci fi ed cal cul at i on period. The ti me hori zon period l engt h (in bars) for whi ch
t o cal cul at e VaR can al so be speci fi ed. Typi cal l y VaR i s cal cul at ed f or a ti me hori zon of
111
one quot e int erval (one bar) for short t erm purposes ( i .e. 1 day i f t he model s quot e
i nt erval i s day) . For long t erm purposes a l onger ti me hori zon period l engt h may be
speci fi ed provi ded t hat enough hi stori cal dat a i s avail abl e.
More speci fi call y, VaR i s t he k
t h
worst ret urn of the Trading Si mul at or ret urns t hat were
cal cul at ed over all t he ( overl apping) sampl e periods of PeriodLengt h bars during t he
cal cul at ion period, where k i s n* , n i s the number of sampl e periods, i s t he speci fi ed
confidence l evel and PeriodLengt h i s t he ti me hori zon peri od l engt h (i n bars) . ( I n fact ,
VaR i s negat ed t o show t he loss as a posi ti ve val ue) .
VaR may be expressed ei t her as an absol ut e amount or as a percent age of t he current
Trading Si mul at or weal t h.
Not e t hat VaR may become negat i ve. Thi s i ndi cat es t hat t he k
t h
worst ret urn i s st ill
posi ti ve.
For a reli abl e VaR cal cul at i on, t he cal cul at ion period should be long enough to cont ai n a
suf fi ci ent number of sampl e peri ods.
I f t he cal cul at ion peri od cont ains l ess t han PeriodLengt h bars, no val ue i s ret urned.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .9 Relat ive VaR
The Rel at i ve VaR measures t he Val ue at Ri sk by est i mat i ng t he mi ni mum excess loss
t hat can be expect ed. I nst ead of t he Trading Simul at or sampl e ret urns, t he excess
ret urns are used whi ch are cal cul at ed as Tradi ng Si mul at or ret urn minus securi t y ret urn.
For t he rest , t hi s dat a seri es i s i denti cal t o t he VaR dat a seri es.
I .3.2 .10 Sharpe Rat io
The Sharpe Rat i o dat a seri es measures t he Shar pe rat io of the Trading Si mul at or weal t h.
The Sharpe Rat i o i s a ri sk- adj ust ed performance measure. The SharpeRat io over a
cal cul at ion period ( s,e) wi t h Wealt hRet urn bei ng t he ret urn of the Trading Si mul at or over
( s, e), compounded t o the speci fi ed compoundi ng period and r
f
being t he ri sk free rat e
( per compounding peri od) i s gi ven by:
f
r t ur n Re Wealt h
o Shar peRat i
=
where i s t he hi st ori cal vol at i li t y of the Trading Si mul at or weal t h during ( s,e) ,
compounded t o t he speci fi ed compounding peri od and usi ng act ual mean l og ret urn.
I f
= 0 (i .e. when t he Trading Si mul at or weal t h has not changed during t he cal cul at ion
peri od) t he dat a seri es will ret urn no val ue.
I f t he number of compounding periods in t he calcul at i on period i s l ess t han 0.75, t hi s
dat a seri es will ret urn no val ue.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .11 Sortino Ratio
The Sortino Rat io dat a seri es measures t he Sortino rat io of t he Trading Si mul at or weal t h.
The Sortino Rat io i s a modifi cat i on of t he Sharpe Rat i o t hat onl y includes downsi de
vol at i li t y in t he cal cul at ion. The SortinoRat io over a cal cul at i on period ( s, e) wi t h
Wealt hRet urn bei ng t he ret urn of t he Trading Simul at or over ( s, e) , compounded t o t he
112
speci fi ed compoundi ng period and T
being the mini mum accept abl e ret urn ( per
compoundi ng period) i s gi ven by:
Downside
T t ur n Re Wealt h
io Sor t inoRat
=
where
Downside
i s t he hi st ori cal downsi de vol at ili ty of t he Tradi ng Si mul at or weal t h duri ng
( s, e), whi ch i s compounded t o t he speci fi ed compoundi ng peri od and cal cul at ed usi ng
l n(T+ 1) as t he mean l og ret urn per period. ( Only bars wi t h a Trading Si mul at or l og
ret urn lower t han l n( T+ 1) / PeriodLengt h are i ncluded i n t he summat i on of squared excess
ret urns, wi th Periodl engt h being t he number of bars per compounding period) .
I f
Downside
= 0, t hi s dat a seri es wil l ret urn no value.
I f t he number of compounding periods in t he calcul at i on period i s l ess t han 0.75, t hi s
dat a seri es will ret urn no val ue.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .12 Risk- adj ust ed Ret urn
The ri sk- adj ust ed ret urn measures t he Tradi ng Si mul at ors ret urn adj ust ed for t he
( hypot het i cal ) cost of keepi ng asi de ext ra buffer capi t al (in ri sk free asset s) t o reserve
agai nst t he ri sky invest ment ( t he Tradi ng Si mulat ors weal t h) . The si ze of t he ext ra
buffer equal s t he VaR of t he Tradi ng Si mul at or and can t herefore i ncorporat e vari ous
degrees of ri sk aversi on by adj ust i ng t he VaR confidence l evel paramet er.
More speci fi call y, t he Ri skAdj ust edRet urn
over a cal cul at i on period ( s,e) wi t h
Wealt hRet urn bei ng t he ret urn of t he Trading Simul at or over ( s, e) , compounded t o t he
speci fi ed compoundi ng period and r
f
bei ng t he risk free r at e (per compoundi ng peri od) i s
gi ven by:
VaR
VaR r t ur n Re Wealt h
t ur n Re ed RiskAdj ust
f
+
+
=
1
where VaR
i s cal cul at ed ( as a per cent age of weal t h) by t he VaR dat a seri es over ( s, e) ,
usi ng t he speci fi ed VaR confidence l evel and using t he speci fi ed compoundi ng peri od as
t he VaR t i me hori zon period l ength.
Because t he VaR cal cul at ion uses t he speci fi ed compounding period as t he t i me hori zon,
t he cal cul at ion period shoul d be l ong enough to cont ai n a suffi ci ent number of sampl e
peri ods for a reli abl e VaR cal cul at ion.
I f VaR ret urns no val ue (i.e. if t he cal cul at i on peri od i s short er t han t he compounding
peri od) , t hen thi s dat a seri es will ret urn no val ue.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I .3.2 .13 Maximum Drawdown
Thi s dat a seri es cal cul at es t he maxi mum drawdown of t he Trading Simul at or weal t h t hat
occurred duri ng the speci fi ed cal cul ati on period. Not e t hat t he maxi mum drawdown i s
expr essed as an absol ut e ret urn val ue.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
113
I .3.2 .14 MAR Ratio
The MAR Rat io refers t o t he Managed Account Report s rat i o whi ch i s defined as
Compounded Annual Growt h Rat e di vi ded by Maxi mum Drawdown. The MAR Rat io dat a
seri es used here gi ves t he MAR rat io of the Trading Si mul at or over a cal cul at ion peri od
( s, e) by:
n MaxDr awDow
t ur n Re Wealt h
MAR =
where Weal t hRet urn i s t he annuali zed Tradi ng Si mul at or ret urn over ( s, e) and
MaxDrawDown i s cal cul at ed over ( s, e) usi ng t he MaxDrawdown dat a seri es.
Not e t hat MAR rat ios cal cul at ed over l onger periods are generall y lower t han over short er
peri ods. Thi s i s because maxi mum drawdown t ends t o increase wi t h longer cal cul at i on
peri ods whil e annuali zed ret urn does not .
I f MaxDrawdown = 0, t hi s dat a seri es will ret urn no val ue.
I f t he Trading Si mul at or has not st art ed yet or i f t he cal cul ati on period st art s before
Trading Si mul at or st ar t , no val ue i s ret urned.
I.3.3 Statistical Simulations
I .3.3 .1 I nt roduct ion
The St at i st i cal Si mul at ions est i mat e t he l i kel y range of t rading ret urns by performi ng a
number of evaluat i ons each consi st ing of a seri es of si mul at ed securi t y ret urns, t rades
and resul ting weal t h values.
The St at i st i cal Si mul at ions i nclude Hi st ori cal Si mul at i on (HS) and Mont e Carlo Si mul ation
( MCS) and are i mpl ement ed as di st ri bution dat a seri es. Thi s means t hat for ever y bar an
ent i re new si mul at ion i s performed, refl ect ing t he present si t uat ion by incorporat i ng
current i nformat i on such as t he sampl e period ( for HS) , Trading Syst em paramet er
val ues, Tradi ng Si mul at or weal t h, et c
45
. When shown in a chart , t he resul t s of t he
si mul ati on are present ed as a hi st ogram of t he ret urns of all t he indi vi dual evaluat i ons of
one si ngl e si mul at ion. The dat a overl ay present s general di st ri but ion st at i st i cs ( mean,
medi an, st andard devi at i on, min, max) as well as t he Val ue at Ri sk, cal cul at ed accordi ng
t o t he speci fi ed paramet er s.
The si mul ations are comput ed as fol lows: a securi t y pri ce change ( r et urn) i s si mul at ed
( by hi st ori cal sampl ing for HS or randoml y generat ed for MCS) and t hen a t rade (t hat
would occur prior t o t hat pri ce change) i s si mul at ed based on t he speci fi ed expect ed
Forecast Di rect i onal Accuracy ( FDA) and Forecast Di rect i onal Signi fi cance ( FDS)
probabili t i es ( and t aki ng int o account t he current posi ti on and the rel evant Tradi ng
Syst em par amet ers) . Thus t he probabi lit y t hat t he si mul at ed posi tion i s i n t he same
di rect i on as t he si mul at ed pri ce change depends on t he expect ed FDA and FDS
probabili t i es. Then t he si mul ations weal t h i s adj ust ed t aki ng int o account t he pri ce
change, broker commi ssi ons, spread, sli ppage, et c. Then t he next pri ce change, t rade
and weal t h adj ust ment ar e si mul at ed and so on until the end of t he i nvest ment hori zon i s
reached. Fi nal l y t he weal t h ret urn i s cal cul at ed ( as Weal t h / St art ingCapi t al - 1) and
compounded t o t he speci fi ed compounding peri od. Thi s entire process forms a si ngl e
eval uat ion and i s repeat ed as many t i mes as t he speci fi ed number of eval uat ions
( st art i ng every eval uat ion wi t h t he same speci fied st art i ng capi t al ).
45
Onl y when usi ng MCS wi t h a fi xed st art i ng capi t al and whi l e l eavi ng al l Tr adi ng Syst em paramet ers
unchanged, t he di ff erent out comes per si mul at i on are onl y bei ng caused by r andom fact ors.
114
I n addi t ion t o t he dat a seri es paramet ers, t he fol lowing Tradi ng Syst em paramet er s can
have an effect on t he St at i st i cal Si mul ation dat a seri es (depending on ci rcumst ances) :
- Allow Short Posit ions
- Gener at e cash signal when forecast is out si de range
46
- St art Capi t al
- all paramet ers i n t he Broker Commission, spread and slippage sect i on
I n case an overflow error occurred during the comput at i on, no value i s ret urned.
Furt her det ail s speci fi c to t he dat a seri es ar e expl ained bel ow.
I .3.3 .2 Hist orical Simulat ion
The Hi st ori cal Si mul at ion dat a seri es has t he foll owing paramet er s:
Par amet er Explanat i on
Cal cul ati on peri od The peri od t o use for hi st or i cal sampl i ng. Securi t y r et urns ar e
randoml y drawn from t hi s peri od. I f t he st art of t he cal cul at ion
peri od i s bef or e model evol ut i on st art , t hi s dat a seri es wi l l
ret urn no val ue.
Compoundi ng per i od
The peri od t o whi ch t he r esul t i ng weal t h ret urn wi ll be
compounded.
Number of eval uat i ons
The number of eval uat i ons per si mul at i on.
I nvest ment hori zon
The number of securi t y r et urns ( bar s) t hat ar e si mul at ed per
eval uat i on.
Expect ed For ecast Di rect i onal Accuracy Expect ed percent age of ri ght for ecast s of al l si gni fi cant
forecast s.
Expect ed For ecast Di rect i onal Si gni fi cance Expect ed percent age of si gni fi cant forecast s of al l forecast s.
Thi s paramet er defi nes t he pr obabi l i t y t hat a ( si mul at ed)
forecast i s si gni fi cant ( i nsi de an i magi nar y si gni fi cance r ange)
and t hat an ei t her ri ght or wr ong for ecast wi l l be si mul at ed.
Use curr ent Tradi ng Si mul at or Weal t h as st art
capi t al
I ndi cat es whet her or not t he curr ent Tr adi ng Si mul at or Weal t h
shoul d be used as t he St art capi t al for t he si mul at i on ( and t hus
ever y eval uat i on) .
St art capi t al
The i ni t i al capi t al of t he si mul ati on ( and t hus every
eval uat i on) .
VaR conf i dence l evel The confi dence l evel t o be used for t he Val ue at Ri sk
cal cul ati on.
Show VaR percent age val ue I ndi cat es whet her t he Val ue at Ri sk shoul d be expr essed as a
percent age of t he St art capi t al ( def i ned above) or as an
absol ut e amount .
I f t he st art of t he cal cul ati on peri od i s before model evoluti on st art , t hi s dat a seri es wi ll
ret urn no val ue.
I .3.3 .3 Mont e Carlo Simulat ion
The si mul at ed securi t y ret urns are normall y di stri but ed
47
wi t h being t he speci fi ed drift
and t he speci fi ed expect ed vol at i li t y.
I t i s possi bl e t o speci fy t he expect ed vol ati li t y separ at el y for right , wrong and
i nsi gnifi cant f orecast ed bars, consi st ent wi t h t he concept of filt ered vol at ili t y. Be awar e
t hat t he vol at i li t y needs t o be speci fi ed per compoundi ng peri od. Therefore, when
changing t he compounding peri od, t he vol atili t y shoul d al so be adj ust ed.
The Mont e Carl o Si mul ati on dat a seri es has t he fol lowi ng paramet er s:
46
Thi s paramet er now r el at es t o t he si mul at ed i nsi gni fi cant bars t hat occur wi t h pr obabi l i t y 1- FDS i nst ead of
t he Si gni f i cant Forecast Range paramet er whi ch i s not used by t he St at i st i cal Si mul at i on dat a ser i es.
47
Obvi ousl y t hi s i s a grave si mpl i fi cat i on of real i t y.
115
Par amet er Explanat i on
Compoundi ng per i od
See Hi st or i cal Si mul at i on.
Number of eval uat i ons
See Hi st or i cal Si mul at i on.
I nvest ment hori zon
See Hi st or i cal Si mul at i on.
Dri f t
The expect ed ret urn of t he securi t y per compoundi ng peri od.
Not e t hat when changi ng t he compoundi ng per i od t he dri f t
shoul d al so be adj ust ed.
Speci fy f il t ered vol at il i t y
Speci fi es whet her fi l t ered or general vol at i l i t y i s bei ng used.
General vol at il i t y The expect ed vol at i l i t y of t he secur i t y per compoundi ng peri od.
Not e t hat when changi ng t he compoundi ng per i od t he vol at i l i t y
shoul d al so be adj ust ed.
Vol at i li t y ri ght f orecast s
The expect ed vol at i l i t y of t he secur i t y per compoundi ng peri od
duri ng ri ght f or ecast ed bars. Not e t hat when changi ng t he
compoundi ng per i od t he vol at i l i t y shoul d al so be adj ust ed.
Vol at i li t y wrong for ecast s
The expect ed vol at i l i t y of t he secur i t y per compoundi ng peri od
duri ng wr ong for ecast ed bar s. Not e t hat when changi ng t he
compoundi ng per i od t he vol at i l i t y shoul d al so be adj ust ed.
Vol at i li t y i nsi gni fi cant forecast s
The expect ed vol at i l i t y of t he secur i t y per compoundi ng peri od
duri ng i nsi gni fi cant forecast ed bars. Not e t hat when changi ng
t he compoundi ng per i od t he vol at il i t y shoul d al so be adj ust ed.
See Expect ed For ecast Di r ect i onal Si gni fi cance f or t he meani ng
of i nsi gni fi cant forecast s.
Expect ed For ecast Di rect i onal Accuracy
See Hi st or i cal Si mul at i on.
Expect ed For ecast Di rect i onal Si gni fi cance
See Hi st or i cal Si mul at i on.
Use curr ent Tradi ng Si mul at or Weal t h as st art
capi t al
See Hi st or i cal Si mul at i on.
St art capi t al
See Hi st or i cal Si mul at i on.
VaR conf i dence l evel See Hi st or i cal Si mul at i on.
Show VaR percent age val ue See Hi st or i cal Si mul at i on.
116
II. Command line syntax
Adapt i ve Model er may be st art ed using any of the foll owing command l ine synt axes:
Command l ine Explanat ion
"Adapt i ve Model er " [ model [ / Updat e] ]
Opens t he speci fi ed model and
opt i onal l y updat es i t .
"Adapt i ve Model er " / RunBat ch: bat chf i l e
St ar t s t he speci fi ed bat ch.
"Adapt i ve Model er " [ / C[ : n] [ quot efi l e] [ confi gurat i on] [ st yl e]
[ / RunToEnd] [ / RunBar s: b] [ / E: export f i l e] [ / Over wri t e] [ / R: r ]
[ / SaveAt End] [ / Model Pat h: pat h] [ / PauseAt End] [ / Cl oseAt End] ]
Cr eat es t he speci f i ed number of model s
usi ng t he speci fi ed quot e- fi l e( s) ,
conf i gurat i on, st yl e and ot her set t i ngs.
The fol lowing paramet er s are used on the command line:
Par amet er Explanat ion
model
Fil ename of model t o open.
/ Updat e Opens t he speci fi ed model and evol ves i t unt il t he end of t he quot e f i l e. Then saves
t he model and exi t s. ( Appl i cat i on wi ll run mi ni mi zed) .
/ RunBat ch: bat chf i l e St art s t he bat ch i n bat chfi l e.
/ C[ : n] Cr eat e new model ( s) for each speci fi ed quot efi l e. n i s an opt i onal number of runs per
quot efi l e. I f n i s not provi ded, one run wi l l be cr eat ed per quot efi l e.
quot efi l e Opt i onal quot e f il ename, a di rect or y cont ai ni ng quot e f i l es or a sel ect i on of quot e
fi l enames usi ng wi l dcards. I f no quot e fi l e i s speci fi ed, a conf i gur at i on fi l e must be
speci fi ed t hat i ncl udes a quot e fi l e. ( I f a speci fi ed quot e fi l e, di rect or y or wi l dcard
sel ect i on does not speci fy any val i d quot e fi l e, no model wi l l be cr eat ed) .
confi gurat i on Opt i onal conf i gur at i on fi l e wi t h paramet er val ues for cr eat i ng t he new model s. I f no
conf i gurat i on i s speci fi ed t he defaul t confi gur at i on wi ll be appl i ed t o al l new model s. I f
a quot e fi l e was speci fi ed on t he command l i ne, any quot e f il e i ncl uded i n t he
conf i gurat i on wi ll be i gnor ed. The confi gurat i on fil e must have an .acn ext ensi on.
st yl e Opt i onal st yl e f il e t o be appl i ed t o al l newl y creat ed model s. I f no st yl e i s speci fi ed
t he defaul t st yl e wi l l be appl i ed t o al l new model s. The st yl e fi l e must have an .aps
ext ensi on.
/ RunToEnd Opt i onal . Speci fi es t hat model evol ut i on shoul d run unt i l t he end of t he quot e fi l e i s
reached. I f nei t her / RunToEnd or / RunBar s i s speci f i ed, model evol ut i on wi l l run unt i l
t he end of t he quot e fil e.
/ RunBars: b Opt i onal . Speci fi es t hat model evol ut i on shoul d run for b bar s.
/ E: expor t fi l e Opt i onal fi l ename of a shar ed export f i l e t o be used by al l model s f or export i ng t he
fi nal val ues at t he end of t he run of t he dat a seri es sel ect ed i n t he speci f i ed st yl e ( or
def aul t st yl e) . ( I f no dat a ser i es ar e sel ect ed, al l dat a seri es wi l l be export ed) .
/ Overwri t e Opt i onal . Speci fi es t hat t he export f i l e speci fi ed i n t he / E swi t ch shoul d be overwr i t t en.
I f / Overwri t e i s not i ncl uded, t he expor t fi l e wi ll be appended t o.
/ R: r Opt i onal . Speci fi es t hat run numbers t o be appended t o model names wi l l st art
count i ng from r. Useful t o add mor e runs t o an al ready exi st i ng seri es of runs.
/ SaveAt End Opt i onal . Speci fi es t hat model are aut omat i cal l y saved at t he end of t he run i n t he
pat h speci fi ed by t he / Model Pat h swi t ch. The fi l enames ar e aut omat i cal l y set t o t he
quot e f i l e name combi ned wi t h t he run number. I f t hi s fil e al ready exi st s t he user i s
prompt ed t o sel ect a pat h and fil ename.
/ Model Pat h: pat h Opt i onal . Speci fi es t he pat h t o save model s i f t he / SaveAt End swi t ch was speci f i ed.
/ PauseAt End
Opt i onal . Speci fi es t hat model s are aut omat i cal l y paused at t he end of t he run.
/ Cl oseAt End Opt i onal . Speci fi es t hat model s are aut omat i cal l y cl osed at t he end of t he run. ( I f
/ SaveAt End was not speci fi ed, al l model dat a wi l l be l ost at t he end of t he run except
for any export ed dat a) .
Not es:
- Any pat h or fil ename t hat cont ai ns spaces should be encl osed wi t hi n doubl e
quot at i on marks.
- All fil enames must i nclude ext ensi ons.
- For bat ch processi ng i t i s recommended t o al so read 10. Bat ch processing and
aut omat i on.
117
III. Genetic programming in Adaptive Modeler
Before expl aini ng how Adapt i ve Model er use genet i c programmi ng, a bri ef general
i nt roduction t o genet i c programmi ng and st rongly t yped genet i c programmi ng will be
gi ven i n I I I . 1 for those not famil i ar wi t h ( st rongly t yped) genet i c programming. Not e t hat
t hi s i s t he general ( conventi onal ) approach of ( st rongl y t yped) genet i c programmi ng. The
way Adapt i ve Model er uses genet i c programmi ng i s expl ained in I I I .2.
III.1 General introduction to genetic programming
Genet i c programmi ng ( GP) i s an evol utionary comput ing t echni que inspi red by bi ologi cal
evol ution to opt i mi ze a popul at i on of comput er programs t o perform a cert ai n t ask. The
programs (or genomes) represent candi dat e solut ions for a gi ven t ask or probl em and
ar e eval uat ed by a cert ai n f itness funct ion t hat measures how well t he program performs
t he t ask / sol ves t he probl em. Fi t t er programs get sel ect ed over l ess fi t programs t o
part i ci pat e in reproduct ion or recombi nat i on operat i ons t o creat e a new gener at i on of
programs. I n a r ecombi nat ion operat i on such as crossover, randoml y chosen part s ( set s
of genes) of t wo programs are exchanged t o cr eat e t wo new programs. A mut at i on
operat or can al so be appli ed t o randoml y change a smal l part of a program. The process
of creat i ng new generat i ons i s repeat ed unti l one or more programs i n t he popul ati on
have achi eved a sat i sfact ory fi t ness l evel . The first gener at ion of programs i s creat ed
randoml y.
GP uses f unct ional programming t o encode t he genomes. I n funct i onal programmi ng a
program i s wri t t en as an expression as opposed t o i mperat i ve programmi ng where a
program consi st s of st at ement s. ( Li sp i s a common exampl e of a funct i onal programmi ng
l anguage) . A funct ional program consi st s of ( mat hemat i cal ) funct ions and ot her symbol s,
al so call ed funct ions and t erminals. Funct i ons are operat ors such as add() or
aver age( ) t hat t ake argument s. Terminal s are const ant s or vari abl es t hat t ake no
argument s. A f unct ional program has a t r ee st ruct ure i n whi ch t he first ( out er) funct ion
call i s t he root node and i t s argument s are t he chil d nodes. These argument s can be
funct ion call s t hemsel ves wi t h lower l evel chi ld nodes for t hei r argument s and so on. For
exampl e a f uncti onal program add( max( x, 5), 2) in t ree repr esent at i on may l ook l i ke
t hi s:
Thi s program si mpl y t akes t he maxi mum of 5 and what ever x i s and t hen adds 2. I n t hi s
exampl e add and max ar e functi ons and x, 5 and 2 are t er minal s.
A funct i onal program can al so be wri t t en as an s- expr essi on or parent hesi zed li st s. A
funct ion call i s t hen wri t t en as a li st wi t h t he f unct i on name fi rst and t he argument s
foll owing. The exampl e i n s- expression becomes ( add ( max x 5) 2) .
To sol ve a probl em wi t h GP, a set of functi ons and t erminal s must be defi ned t hat i s
appropri at e t o t he probl em t o be sol ved. Thi s i s where speci fi c domain knowl edge comes
i n. Choosing the ri ght functi on and t erminal s as well as defining t he ri ght fi tness funct ion
can have a great i mpact on the performance of GP.
add
root
max
x
5
2
118
The creat i on of programs in GP heavil y uses r andom fact ors. The fi rst gener at i on of
programs i s creat ed randoml y. Al so t he crossover and mut at i on operat ors t hat ar e used
t o creat e l at er generat i ons use random numbers. Thi s i s t o ensure t hat t he search space
( of al l possi bl e programs) get s expl ored t horoughl y. However, t he r andom creat i on of
programs can l ead t o programs t hat make no sense at al l or t hat cant even be properl y
eval uat ed because a funct i on argument doesnt ret urn t he t ype of val ue t he funct ion
needs. To ci rcumvent t hi s probl em st rong t yping i s used. I n St rongl y Typed GP ( STGP) a
set of t ypes i s defined ( fi t ting t he probl em domai n) and every funct i on and t erminal i s
defi ned t o ret urn a speci fi c t ype and every funct ion argument i s defi ned t o be of a
speci fi c t ype. Thi s defi nes what functi ons and t ermi nal s can be used as argument s for
ot her funct i ons. When done properl y, st rong t yping can si gni fi cantl y hel p t he creat i on of
more meani ngful and fi t t er programs.
III.2 Genetic programming in Adaptive Modeler
Adapt i ve Model er uses a speci al adapt i ve form of St rongl y Typed GP. The genomes
( programs) are t he agent s t radi ng rul es. Thei r t ask i s t o t rade t he securi t y on t he Virt ual
Mar ket based on t hei r anal ysi s of hi st ori cal quotes. The fi t ness functi on i s a measurement
of an agent s i nvest ment ret urn over a cer t ai n peri od. However, t her e ar e some
i mport ant di fferences bet ween t he way Adapt i ve Model er uses GP and t he gener al way
descri bed above.
III.2.1 Differences between Adaptive Modeler and conventional GP
- I n Adapt i ve Model er, cal cul ati ng t he fi t ness of agent s does not invol ve any ( re-
) execut ion of t hei r t rading rul es on hi st ori cal bars. Thi s i s because t he agent s
have al ready execut ed t hei r t radi ng rul es on t hose hi st ori cal bars once (on behal f
of their rol e in t he Agent - based model ) and Adapt i ve Model er i s onl y int erest ed i n
t he ret urns t hat t hey have al ready made for real in the Agent - based model , not
i n any hypot het i cal ret urns t hat an agent coul d have made i f i t was sent back i n
t i me agai n.
- I n convent ional GP t he programs ar e eval uat ed by t he same fi t ness funct ion ever y
gener at i on. For the purpose of Adapt i ve Model er, a dynami c fi t ness functi on i s
needed. Ever y t i me t he fi tness of agent s i s evaluat ed, t he ret urn cal cul ati on
peri od shift s forward t o incl ude t he most recent quot e bars. ( I n GP t erms t hi s
coul d be call ed a kind of ret raining met hod) .
- Adapt i ve Model er normall y doesnt use t he concept of generat ions as descri bed
above. I nst ead a st eady- st at e approach i s used in whi ch onl y a small part of t he
popul ation i s repl aced at a t i me ( t ypi call y ever y bar) i nst ead of t he ent ire
popul ation at once. Thi s allows for a graduall y changing popul ation whi ch i s
necessar y t o mai nt ain a cert ai n degree of st abilit y.
III.2.2 Input of the trading rules
The input of t he t radi ng rul es consi st s of t he hi st ori cal pri ce and vol ume dat a of t he
securi t y on t he Real Market and t he Virt ual Market .
III.2.3 Output of the trading rules
The out put of t he t radi ng rul es i s an Advi ce consi st ing of a desi red posi ti on in t he
securi t y (as a per cent age of weal t h) and an order li mit pri ce or market order indi cat i on
for buyi ng or sel ling t he securi t y.
119
III.2.4 Defined types
The fol lowi ng t ypes ar e defi ned ( and descri bed in more det ail below t he t abl e) :
Type Descript ion
Advi ce Combi nat i on of a Posi t i on and a Li mi t ( root t ype) .
Posi t i on Posi t i on i n t he securi t y as % of weal t h
Li mi t Order l i mi t pri ce
Di rect i on Posi t i on di rect i on ( l ong, shor t or cash)
Leverage Absol ut e posi t i on si ze as % of weal t h
Quot e Pri ce ( from Real or Vi rt ual Market dat a)
Vol ume Vol ume ( f rom Real or Vi rt ual Market dat a)
Market Market ( Real Market or Vi rt ual Mar ket )
Change Di fference bet ween t wo val ues ( i n %)
Lag Number of bars
Bool Bool ean ( True or Fal se)
I I I .2 .4.1 Advice
Thi s i s t he root t ype of t he genome t ree, meani ng t hat t he genomes root node ( whi ch
ret urns t he fi nal out put of the t radi ng rul e) must be of thi s t ype. An Advi ce consi st s of
combinat ion of a Posit ion val ue and a Limit val ue. They are combined ( encoded) int o an
Advi ce val ue si mpl y because a t r ee can have only one root node and t hus ret urn onl y one
val ue.
I I I .2 .4.2 Position
Thi s t ype i s used t o denot e t he si ze and di rect i on of an agent s posi ti on (asset all ocat i on)
i n t he securi t y as a percent age of i t s weal t h. For i nst ance, i f an agent s posi ti on i s 100%
t hen i t owns onl y shares and no cash. Not e t hat negat i ve posi ti ons represent short
posi ti ons.
I I I .2 .4.3 Limit
Thi s t ype i s used for li mi t pri ces of agent orders or to i ndi cat e a market order. Arguabl y,
t he t ype Quot e coul d have been used for t hi s, but having a speci fi c t ype for order li mi t
pri ces allows more cont rol over t he way order limi t pri ces are bei ng generat ed.
I I I .2 .4.4 Direct ion
Thi s t ype i s used t o denot e posi ti on direct i ons . For t hi s t ype onl y t hree possi bl e val ues
exi st : l ong, short and cash ( corresponding wi th t he si gn of a Posit ion val ue) . Thi s t ype i s
used in combinat ion wi t h Lever age t o cr eat e Posit ion values.
I I I .2 .4.5 Leverage
Thi s t ype i s used for an agent s absol ut e posi t ion si ze as a per cent age of weal t h (in ot her
words t he Posit ion wi t hout sign/ di rect i on) . For inst ance a l ever age of 50% means an
agent has a posi tion of 50% of i t s weal t h in t he securi t y, ei t her long or short . Thi s t ype i s
used in combinat ion wi t h Direct ion t o creat e Posi t ion values.
I I I .2 .4.6 Quot e
Thi s t ype i s used for securi t y pri ces, ei t her from t he Real or Vi rtual Market . I t i s used for
open, high, l ow, close, bi d or ask pri ces. Furt hermore, i t i s used bot h for pri ces t aken
di rect l y from the hi st ori cal dat a as well as for cal cul at ed averages, maxi mum, mi nimum,
et c.
120
I I I .2 .4.7 Volume
Thi s t ype i s used for volume dat a, ei t her from t he Real or Virt ual Market . I t i s used bot h
for volume dat a t aken di rect l y f rom t he hi st ori cal dat a as well as for cal cul at ed averages,
maxi mum, mini mum, et c.
I I I .2 .4.8 Market
Thi s t ype denot es t he mar ket t ype. Onl y t wo values of t hi s t ype exi st : Real Market and
Virtual Market . Thi s t ype i s used for a market ar gument of several functi ons t hat can
operat e on ei t her Real market or Vi rt ual market dat a.
I I I .2 .4.9 Change
Thi s t ype i s used for rel at i ve changes bet ween t wo Quot e val ues or t wo Volume val ues,
for inst ance a pri ce change such as p
t
/ p
t - 1
- 1.
I I I .2 .4.10 Lag
Thi s t ype i s used t o denot e a number of bars.
I I I .2 .4.11 Boolean
Thi s t ype i s used for t he bool ean val ues True or Fal se.
III.2.5 Function and terminal set
I n Adapt i ve Model er, t he function and t ermi nal s ar e al so call ed genes . The ent i re set of
genes wi t h t hei r ret urn t ype and argument t ypes i s shown in t he t abl e below. The
t er mi nal s ( wi th no argument s) have names st ar t ing wi t h a capi t al and are li st ed on top.
The funct i ons foll ow bel ow t he t ermi nal s. Not e t hat some f uncti ons (i .e. + , > and i f )
ar e def ined more t han once for different argument t ypes. The genes are descri bed i n
more det ail below t he t abl e.
Gene Ret urn t ype Arg1 t ype Arg2 t ype Arg3 t ype Arg4 t ype
CurPos Posi t i on
LevUni t Leverage
Ful l Lev Leverage
Rmar ket Market
Vmar ket Market
Long Di rect i on
Short Di rect i on
Cash Di rect i on
Bar Lag
I nvPos Posi t i on
RndPos Posi t i on
RndLi m Li mi t
Mkt Or der Li mi t
open Quot e Lag Market
hi gh Quot e Lag Market
l ow Quot e Lag Market
cl ose Quot e Lag Market
bi d Quot e Lag Market
ask Quot e Lag Market
average Quot e Lag Market
mi n Quot e Lag Market
max Quot e Lag Market
vol ume Vol ume Lag Market
avgvol Vol ume Lag Market
mi nvol Vol ume Lag Market
maxvol Vol ume Lag Market
> Bool Quot e Quot e
> Bool Vol ume Vol ume
121
> Bool Change Change
change Change Quot e Quot e
change Change Vol ume Vol ume
+ Lag Lag Lag
+ Leverage Leverage Lever age
di r Bool Lag Market
i supbar Bool Lag Market
upbars Bool Lag Lag Market
bsmi n Lag Lag Market
bsmax Lag Lag Market
vol at Change Lag Market
rsi > = 80 Bool Lag Market
rsi < = 20 Bool Lag Market
sk> sd Bool Lag Market
sd< sd Bool Lag Market
ema Quot e Lag Market
mfi > = 80 Bool Lag Market
mfi < = 20 Bool Lag Market
pos Posi t i on Di rect i on Lever age
addpos Posi t i on Di rect i on Lever age
li m Li mi t Quot e Quot e Lag Di rect i on
advi ce Advi ce Posi t i on Li mi t
and Bool Bool Bool
or Bool Bool Bool
not Bool Bool
i f Quot e Bool Quot e Quot e
i f Lag Bool Lag Lag
i f Change Bool Change Change
i f Bool Bool Bool Bool
i f Advi ce Bool Advi ce Advi ce
i f Market Bool Market Market
i f Di rect i on Bool Di rect i on Di r ect i on
i f Li mi t Bool Li mi t Li mi t
i f Leverage Bool Lever age Leverage
i f Posi t i on Bool Posi t i on Posi t i on
i f Vol ume Bool Vol ume Vol ume
I I I .2 .5.1 CurPos
CurPos ret urns t he agent s current posi ti on in t he securi t y as a percent age of i t s weal t h
( 100% i s a full long posi tion, 0% i s a full cash posi ti on and - 100% i s a short posi ti on for
100% of weal t h) .
I I I .2 .5.2 LevUnit
LevUni t i s t he mini mum uni t ( st epsi ze) of l everage ( t he absolut e posi tion si ze as % of
weal t h) . During model evol ut ion i t i s a const ant value t hat i s speci fi ed by t he Mini mum
posi ti on uni t set t i ng on t he Model t ab of t he New Model di alog box. Lever age val ues
can be added ( by a + functi on) t o creat e l arger l ever age val ues.
I I I .2 .5.3 FullLev
Ful lLev i s a const ant value of 100% represent i ng ful l lever age . Thi s gene can be used
i nst ead of t he LevUni t and + genes t o force agent s t o onl y pl ace orders for 100%, -
100%, or 0% posi ti ons. I t can al so be used in combi nati on wi th the LevUni t and +
genes. Using t hi s gene may resul t in short er l ever age subt rees si nce l ess +
operat i ons wi ll be required t o reach desi red l everage val ues. Short er genome t rees may
i ncrease comput at i on performance and ar e bet t er readabl e.
I I I .2 .5.4 Rmarket, Vmarket
I ndi cat es t he Real Market ( t he i mport ed securi t y pri ce and vol ume dat a) or t he Virt ual
Mar ket ( t he pri ce and vol ume dat a of t he Virt ual Market ) .
122
I I I .2 .5.5 Long, Short , Cash
I ndi cat es a long, short or cash posi tion direct i on ( const ant val ue of 1, -1 or 0) . These
t er mi nal s are used i n for i nst ance t he pos funct i on t o creat e a Posi ti on by mul tipl ying a
Leverage val ue wi t h a Di rect i on val ue.
I I I .2 .5.6 Bar
I ndi cat es a si ngl e bar ( const ant value of 1) . Thi s t ermi nal i s used t o creat e Lag val ues
t hat are used t o i ndi cat e a peri od l engt h (in number of bars) for ret ri eving hi st ori cal
market dat a or cal cul at i ng i ndi cat ors such as average. Lag values can be added ( by a +
funct ion) t o creat e l arger Lag values. ( Not e t hat Lag val ues ar e al ways at l east 1).
I I I .2 .5.7 I nvPos
I nvPos ret urns t he opposi t e posi tion of t he agent ' s current posi tion by mul t i pl ying t he
current posi ti on wi t h - 1 (long becomes short and vi ce ver sa) .
I I I .2 .5.8 RndPos
Ret urns a r andom posi tion value rangi ng from -100% t o 100% sampl ed from a uni form
di st ri bution.
I I I .2 .5.9 RndLim
Ret urns a r andom li mi t pri ce t hat i s generat ed as f oll ows. Fi rst t he Vi rt ual or Real Market
i s chosen at random. Then t he l ast cl osi ng pri ce i s t aken from t hi s market . Then t hi s
pri ce i s mul tipli ed wit h a normall y di st ri but ed random value with =1 and =3.5 *
m
where
m
i s t he st andard devi at i on of t he log ret urns of t he l ast 20 bars of t he chosen
market
48
.
I I I .2 .5.10 MktOrder
I ndi cat es t hat an order shoul d be pl aced as a market order.
I I I .2 .5.11 open, high, low, close
These funct ions ret urn pri ce dat a from t he Real or Virt ual Market . As argument s t hey
t ake a Lag val ue for speci fying whi ch hi stori cal bar t o ret ri eve t he dat a from and a Market
val ue for speci fying ei t her t he Real or the Vi rtual Market . For i nst ance, open(l ,m) ret urns
t he open pri ce of bar t -l on market m, where t i s t he current bar. For t he Real Market , i f
open, high or low pri ces ar e not i ncluded i n t he quot e fil e, the close pri ce i s ret urned. For
t he Vi rt ual Market , open, hi gh and low al ways ret urn the close pri ce ( t he cl earing pri ce) .
( Not e t hat si nce a Lag val ue i s al ways at l east one, onl y bars before t he current bar can
be request ed. Thi s i s because at t he t i me t he genomes ar e bei ng eval uat ed, t he current
bar number al ready point s t o t he upcomi ng bar t hat st ill needs t o be i mport ed. Therefore
at t he t i me of genome evaluat i on, t he bar before t he current bar al ways has t he most
recent Real Market pri ce dat a) .
I I I .2 .5.12 bid, ask
Bi d and ask ret urn t he bid and ask pri ce dat a for t he speci fi ed bar and market . For t he
Real Market , t he bi d and ask pri ces from t he quot e fil e are ret urned. I f t he bi d or ask
pri ces are not included in t he quot e fil e or if t hey ar e 0, t hen t he close pri ce i s ret urned.
For t he Vi rtual Market , t he bi d and ask pri ce are ret urned as def ined i n VM Bid and Ask.
48
Thi s met hod i s part l y based on [ M. Rabert o, S. Ci ncot t i , S. M. Focar di , M. Marchesi , "Agent - based si mul at i on of
a f i nanci al market ", Physi ca A 299, 319- 327 ( 2001) ] wi t h t he di ff er ence t hat m= 1 i nst ead of 1.01 so t hat no
spr ead i s added/ subt ract ed for i ncreasi ng t he l i kel i hood of an order bei ng execut ed. The r eason for t hi s i s t hat
i n t hi s i mpl ement at i on, at t he t i me t he RndLi m gene i s eval uat ed, i t i s not known whet her t he agent wi l l pl ace a
buy or sel l order and t hus whet her t he spr ead shoul d be added or subt ract ed.
123
I I I .2 .5.13 average, min, max
These funct ions cal cul at e t he average, mi ni mum or maxi mum of the close pri ces over t he
l ast gi ven number of bars on the gi ven mar ket . For exampl e, aver age( l ,m) i s t he aver age
close pri ce over bar s [ t - l , t -1] on market m, where t i s t he current bar. Not e t hat t he hi gh
and l ow pri ce dat a i s not used i n t he cal cul at ion of min and max.
I I I .2 .5.14 volume
Ret urns vol ume dat a for t he speci fi ed bar and market . For t he Real Market t hi s i s t he
vol ume dat a t hat was i ncluded i n t he quot e fil e. ( I f no vol ume dat a i s incl uded in t he
quot e fi l e whil e t hi s gene i s sel ect ed, t hi s functi on ret urns 0) . For t he Vi rtual Market t he
vol ume dat a i s defi ned in VM Volume.
I I I .2 .5.15 avgvol, minvol, maxvol
These funct ions cal cul at e t he average, mi ni mum or maxi mum vol ume over t he l ast gi ven
number of bars on t he gi ven mar ket . For exampl e, avgvol (l ,m) i s aver age vol ume over
bars [ t - l ,t - 1] on market m, wher e t i s t he current bar.
I I I .2 .5.16 >
The funct i on > i s a great er t han compari son for argument pai rs of t he t ypes Quot e,
Volume or Change. I t ret urns True if t he val ue of t he first argument i s great er t han t he
val ue of the second argument , Fal se ot herwi se. Not e t hat a < f unct ion i s not defi ned
nor necessar y si nce t he argument s can be gi ven in ei t her order. Al so > = and =
operat ors are not defined si nce t hey are l ogi cally equi val ent t o not < resp. not > and
not < .
I I I .2 .5.17 change
The change funct i on i s defined for argument pai rs of t he t ypes Quot e or Vol ume. I t
ret urns t he rel at i ve change of t he fi rst argument val ue from t he second argument val ue.
For i nst ance, change( q1,q2) ret urns q1/ q2 1. I n case t he second argument val ue i s
zero, t hi s functi on ret urns zero.
I I I .2 .5.18 +
The + functi on i s defi ned for argument pai rs of t he t ypes Lag and Lever age. I t si mpl y
adds Lag or Lever age val ues t o creat e l arger val ues from smal l er ones.
I I I .2 .5.19 dir
Thi s funct ion cal cul at es t he pri ce di rect i on over t he l ast speci fi ed number of bars on the
gi ven mar ket and ret urns a bool ean val ue t o i ndi cat e whet her or not t he direct i on i s
upwards. More speci fi cal l y, dir(l ,m) ret urns True i f close( t - 1,m) > cl ose( t - 1-l ,m) , where t
i s t he current bar.
I I I .2 .5.20 isupbar
Ret urns a bool ean val ue t o indi cat e whet her t he speci fi ed bar on t he speci fi ed market i s
an up bar or not . More speci fi call y, i supbar(l ,m) ret urns True i f close( t -l ,m) > close( t - l -
1,m) , where t i s current bar
124
I I I .2 .5.21 upbars
Thi s funct ion checks i f t he number of up bars during t he l ast speci fi ed number of bars
on a gi ven mar ket i s higher t han or equal to a given number. More speci fi cal l y,
upbars( l 1,l 2,m) ret urns True i f t he number of up bars on market m duri ng [ t -l 1,t - 1] > =
l 2, where t i s t he current bar.
I I I .2 .5.22 bsmin, bsmax
These funct ions st and for bars si nce mi numum and bars since maxi mum . They ret urn
t he number of bars si nce t he mi ni mum/ maxi mum cl ose pri ce over a gi ven period. For
exampl e, bsmi n(l , m) ret urns t he number of bars since t he mi ni mum cl ose pri ce over bar s
[ t - l ,t - 1] on market m, wher e t i s t he current bar.
I I I .2 .5.23 volat
Thi s funct ion ret urns t he vol ati li t y ( st andard devi ati on) of t he logari t hmi c ret urns of t he
close pri ces duri ng t he gi ven peri od on t he gi ven market . For gi ven argument s l and m,
vol at ( l ,m) ret urns t he st andard devi at ion of t he most recent n bars on market m where n
= l + 9. Since l i s al ways at l east 1, n i s al ways at l east 10.
I I I .2 .5.24 rsi> = 80, r si< = 20
These funct ions cal cul at e an RSI ( Rel at i ve St rengt h I ndex) val ue of t he pri ce dat a of t he
gi ven period and market and ret urn a bool ean t o indi cat e whet her or not t he val ue i s
hi gher t han or equal t o 80 resp. lower t han or equal t o 20. For gi ven argument s l and m,
t he RSI i s cal cul at ed over t he most recent n bars on market m where n = l + 9. Since l i s
al ways at l east 1, n i s al ways at l east 10.
I I I .2 .5.25 sk> sd, sk< sd
These funct ions cal cul at e a St ochast i c Oscil l at or of the pri ce dat a of t he gi ven period and
market and ret urn a bool ean i ndi cat i ng whet her or not t he fast %K si gnal i s hi gher ( resp.
l ower) t han t he slow %D si gnal . For gi ven argument s l and m, t he Stochast i c Oscill at or i s
cal cul at ed over t he most recent n bars on market m wher e n = l + 9. Since l i s al ways at
l east 1, n i s al ways at l east 10. For exampl e, sk> sd( l ,m) ret urns True i f t he fast %K
si gnal i s higher t han t he slow %D si gnal over bars [ t - l ,t - 1] on market m, and Fal se
ot herwi se.
I I I .2 .5.26 ema
Thi s funct ion ret urns an exponenti al moving average of t he pri ce dat a of t he gi ven peri od
and market . For gi ven argument s l and m, ema( l , m) ret urns an exponent i al movi ng
aver age of t he most recent n bars on market m where n = l + 9. Since l i s al ways at
l east 1, n i s al ways at l east 10.
I I I .2 .5.27 mfi> = 80, mfi< = 20
These funct ions cal cul at e an MFI ( Money Fl ow I ndex) value of the volume dat a of t he
gi ven period and market and ret urn a bool ean t o indi cat e whet her or not t he val ue i s
hi gher t han or equal t o 80 resp. lower t han or equal t o 20. For gi ven argument s l and m,
t he MFI i s cal cul at ed over t he most recent n bars on market m wher e n = l + 9. Since l i s
al ways at l east 1, n i s al ways at l east 10. Not e t hat t he MFI cal cul ati on uses vol ume dat a
and for t he Real Market al so hi gh and low pri ces. I f t he vol ume dat a on t he gi ven market
i s zero during the cal cul ati on period, bot h MFI funct ions will ret urn Fal se. I f hi gh and low
pri ces are not included in t he quot e fil e t hey will be consi dered equal to t he cl ose pri ce.
125
I I I .2 .5.28 pos
Thi s funct ion combines a Di rect i on and a Lever age val ue i nt o a Posi ti on. To do t hi s i t
si mpl y mul tipl i es t he Di rect i on val ue wi t h t he Lever age val ue.
I I I .2 .5.29 addpos
Thi s funct ion combines t he Di rect i on and Lever age argument val ues i nto a Posi tion (li ke
pos ) and adds t he agent ' s current posi ti on. The resul ti ng Posi t ion i s ret urned. Not e t hat
t he ret urned posi tion value can be hi gher or lower t han t he agent s current posi tion.
I I I .2 .5.30 lim
Thi s funct ion i s a si mpl e al gori t hm t o cal cul at e an order l i mi t pri ce. I t t akes as argument s
t wo Quot es, a Lag and a Di rect i on. The al gori thm used by t hi s functi on i s based on t he
assumpt ion t hat t raders det er mi ne t hei r order l imi t pri ce ( t o a cert ai n ext ent ) based on
t he observed mar ket pri ces and t he magni t ude of pri ce changes. The al gorit hm cal cul at es
t he difference bet ween t he t wo gi ven Quot e val ues, processes t hi s dif ference a bi t furt her
wi th t he gi ven Lag and Di rect i on values and adds t hi s t o t he first Quot e val ue. The
agent s way of cal cul at ing it s order l imi t pri ce and t he urgency of i t s order can t hus be
represent ed i n t he choi ce of Quot e val ues and Lag and Di rect i on values. Not e t hat t he
Lag and Di rect i on t ypes ar e used here for t heir ari t hmet i c conveni ence and not because
of their meani ng. More speci fi call y, l im( q1,q2,l ,d) = q1 + l * 0.1 * d * ( q2 - q1). Not e
t hat when t he Di rect i on val ue i s Cash ( 0) , t he funct ion si mpl y ret urns q1.
I I I .2 .5.31 advice
Combi nes a Posi tion and a Li mi t val ue int o an Advi ce. The Advi ce i s ul timat el y ret urned
by t he genome ( ei t her direct l y t hrough t hi s funct ion or t hrough an if funct ion) and t hen
processed furt her by t he program as descri bed i n Order generat i on.
I I I .2 .5.32 and, or, not
These are logi cal operat ors on t hei r Bool argument s.
I I I .2 .5.33 if
The i f functi on i s defi ned for al l t ypes. The fi rst argument i s a Bool val ue. I f t hi s i s True,
t he second argument val ue i s ret urned, otherwi se t he t hi rd argument val ue i s ret urned.
< End of Users Gui de>