low complexity algorithmic trading by feedforward neural

12
1 Low complexity algorithmic trading by Feedforward Neural Networks J. Levendovszky 1,2 , I. Reguly 1 , A. Olah 1, A. Ceffer 2 {levendovszky.janos,reguly.istvan,olah.andras}@itk.ppke.hu 1 PĂĄzmĂĄny PĂ©ter Catholic University, Faculty of Information Technology and Bionics, 1088 Budapest, PrĂĄter u. 50/a, Hungary 2 Budapest University of Technology, Department of Networked Systems and Services, 1118 Budapest, Magyar TudĂłsok krt. 2, Hungary Abstract—In this paper, novel neural based algorithms are developed for electronic trading on financial time series. The proposed method is estimation based and trading actions are carried out after estimating the forward conditional probability distribution. The main idea is to introduce special encoding schemes on the observed prices in order to obtain an efficient estimation of the forward conditional probability distribution performed by a feedforward neural network. Based on these estimations, a trading signal is launched if the probability of price change becomes significant which is measured by a quadratic criterion. The performance analysis of our method tested on historical time series (NASDAQ/NYSE stocks) has demonstrated that the algorithm is profitable. As far as high frequency trading is concerned, the algorithm lends itself to GPU implementation, which can considerably increase its performance when time frames become shorter and the computational time tends to be the critical aspect of the algorithm. Keywords neural networks, non-linear regression, estimation, algorithmic trading G1 – General Financial Markets, G12 – Asset Pricing 1. Introduction The selection of portfolios which are optimal in terms of risk-adjusted returns has been an intensive area of research in the recent decades [Anagnostopoulos, 1]. Furthermore, the main focus of portfolio optimization tends to move towards the application of High Frequency Trading (HFT) when a huge amount of financial data is taken into account within a very short time interval and trading with the optimized portfolio is also to be performed at high frequency within these intervals. HFT presents a challenge to both algorithmic and architectural development, because of the need for developing algorithms running fast on specific architectures (e.g. GPGPU, FPGA chipsets) where speed is the most important attribute. On the other hand, profitable portfolio optimization and trading needs the evaluation of rather complex goal functions with different constraints which sometimes cast the problem in the NP hard domain

Upload: others

Post on 08-Nov-2021

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Low complexity algorithmic trading by Feedforward Neural

1

LowcomplexityalgorithmictradingbyFeedforwardNeuralNetworks

J.Levendovszky1,2,I.Reguly1,A.Olah1,A.Ceffer2{levendovszky.janos,reguly.istvan,olah.andras}@itk.ppke.hu

1PĂĄzmĂĄnyPĂ©terCatholicUniversity,FacultyofInformationTechnologyandBionics,1088Budapest,PrĂĄteru.50/a,Hungary

2BudapestUniversityofTechnology,DepartmentofNetworkedSystemsandServices,1118Budapest,MagyarTudĂłsokkrt.2,Hungary

Abstract—In this paper, novel neural based algorithms are developed forelectronic trading on financial time series. The proposed method isestimationbasedand tradingactionsarecarriedoutafterestimating theforwardconditionalprobabilitydistribution.Themainideaistointroducespecial encoding schemes on the observed prices in order to obtain anefficient estimation of the forward conditional probability distributionperformedbyafeedforwardneuralnetwork.Basedontheseestimations,atrading signal is launched if the probability of price change becomessignificantwhichismeasuredbyaquadraticcriterion.The performance analysis of ourmethod tested on historical time series(NASDAQ/NYSEstocks)hasdemonstratedthatthealgorithmisprofitable.Asfarashighfrequencytradingisconcerned,thealgorithmlendsitselftoGPU implementation, which can considerably increase its performancewhentimeframesbecomeshorterandthecomputationaltimetendstobethecriticalaspectofthealgorithm.Keywordsneuralnetworks,non-linearregression,estimation,algorithmictradingG1–GeneralFinancialMarkets,G12–AssetPricing1.IntroductionThe selectionofportfolioswhich areoptimal in termsof risk-adjusted returnshasbeenanintensiveareaofresearchintherecentdecades[Anagnostopoulos,1].Furthermore,themainfocusofportfoliooptimizationtendstomovetowardsthe application of High Frequency Trading (HFT) when a huge amount offinancialdataistakenintoaccountwithinaveryshorttimeintervalandtradingwith the optimized portfolio is also to be performed at high frequencywithinthese intervals.HFTpresentsa challenge tobothalgorithmicandarchitecturaldevelopment, because of the need for developing algorithms running fast onspecific architectures (e.g. GPGPU, FPGA chipsets) where speed is the mostimportant attribute. On the other hand, profitable portfolio optimization andtrading needs the evaluation of rather complex goal functionswith differentconstraints which sometimes cast the problem in the NP hard domain

Page 2: Low complexity algorithmic trading by Feedforward Neural

2

[D’Aspermont,7,10,11].Asresult, thecomputationalparadigmsemerging fromthefieldofneuralcomputing,whichsupportfastandparallel implementations,areoftenusedinthefieldalgorithmictrading.In this paper,wepropose a fast trading algorithm,where the trading signal isprovided by a FeedFoward Neural Network (FFNN). Based on non-linearregression theory and the function representation capabilities of neuralnetworks[Hornik,Stinchcombe,White,1,Funahashi,2],aproperlytrainedFFNNcan approximate the conditional forward expected value. If the forwardpricesare encoded into an orthogonal vector set, then an appropriate FFNN canestimate the forward conditional probability distribution. Based on theestimatedprobabilities,onecangivealow-riskpredictiononthetendencyofthepricemovements(increasingordecreasing).This, in turn,canthenbemappedinto an appropriate trading action (buy/sell). There is a quadratic indexrepresentingthereliabilityoftheestimationonthepricetendencyandtradingisonlylaunchedifthisindexexceedsagiventhreshold.IfthereareseveralFFNNimplementedinaparallelmannerbyusingdifferentlinearcombinationsoftheassetprices (portfolios), thenonecanpick thebestportfolio for tradingwhichhas themost favourableconditionaldistribution forpredicting the tendencyofpricechange.Thepaperisorganizedasfollows:

‱ InSection2,wegiveaformalpresentationoftheproblemandthemodel.

‱ InSection3,wegiveaneuralnetworkbasedsolution.

‱ In Section 4, we propose a complexity reduction scheme that makesimplementationfeasible.

‱ In Section 5, we analyze the performance on randomly generated andhistoricaltimeseriesofrealdata(NASDAQ/NYSEstocks).

‱ InSection6,someconclusionsaredrawn.2.ThemodelLetusassumethatthereisavectorvaluedrandomassetpriceprocess(e.g.thevaluesofsharesinSP500),whichisdenotedby ( )1( ) ( ),..., ( )Nt s t s t=s .Aportfoliois expressed by a portfolio vector ( )1( ) ( ),..., ( )Nt w t w t=w yields a linearcombination of asset prices (being the portfolio price) as a time series

( )1

: ( ) ( )N

Ti i

ix t w s t t

=

= =∑ w s . The possible prices are taken from a discrete set

{ }1( ), ( ) ,...,i Ms t x t Q q q∈ = .Let

( )( )( 1) ( ) ,..., 1 , 1,...,i i j MP P x t q x t q x t L q i M= + = = − + = = denotetheconditional

probabilities having L past observations about ( )x t at hand. With theseconditionalprobabilities,onecandeviseaBayesiantradingstrategy,asfollows:

Page 3: Low complexity algorithmic trading by Feedforward Neural

3

( )( )

if ( 1) ( ) then buy at and sell at 1;

if ( 1) ( ) then sell at and buy back at 1.i i

i i

P x t x t t t

P x t x t t t

+ > +

+ < +

Ormoreprecisely,

: :

: :

if ( ) and then buy at and sell at 1;

if ( ) and then buy at and sell at 1.

i ii i m i i m

i ii i m i i m

x t m P P t t

x t m P P t t> <

> <

= > +

= < +

∑ ∑

∑ ∑ (1)

Onecanalsoseethatgiven ( ) Mx t q= ,thelargerthevalueof2

: :i i

i i m i i mP P

> <

⎛ ⎞−⎜ ⎟

⎝ ⎠∑ ∑ the

morereliabledecisionwecanmakeontrading.Asaresult,theriskofthetradingcanalsobe taken intoaccountbychoosingaproper andthentradingcan

onlytakeplaceif2

: :i i

i i m i i mP P Δ

> <

⎛ ⎞− >⎜ ⎟

⎝ ⎠∑ ∑ .

However,toperformtradingasdetailedabove,oneneedstheestimationoftheconditional probabilities

( )( )( 1) ( ) ,..., 1 , 1,...,i i j MP P x t q x t q x t L q i M= + = = − + = = .

3.TradingwithFNNN

As was mentioned earlier, the estimation of can be given by anFFNN,basedonobservingthehistoricalpartofthetimeseriesofagivenassetpriceorportfoliox(t).Basedontheseobservations,onecanconstructatrainingset containing some samples followed by the observed forward price x(k+1)given as follows: where

. Let us then construct an FFNN based predictor

( )( 1) , tx t Net+ = w x where .Oncetheoptimalweightsare

found by minimizing the error function ,

the FFNN will provide the optimal non-linear predictionbecause

and

(for further details see

[Haykin,3]).However,toperformthetradingalgorithmelaboratedbyformulas(1),oneneeds theconditionalprobabilities insteadof theconditionalexpectedvalue. In order to obtain the forward distribution, let us encode the possiblevaluesofthepriceoftheportfoliointoanorthonormalvectorset:

0Δ >

, 1,...,iP i M=

( ){ }( ) , ( 1) , 1,...,Kk x k k Kτ = + =x

( )( ),..., ( 1)k x k x k L= − +x

( )( ),..., ( 1)t x t x t L= − +x

( )( )2( )

1

1:min ( 1) ,K

Kopt k

kx k Net

K =

+ −∑ww x w

( ) ( ), ( 1)t tNet E x t= +x w x

( )( ) ( )( )2 2

1

1lim ( 1) , ( 1) ,K

k tK kx k Net E x t Net

K→∞=

+ − = + −∑ x w x w

( )( ) ( ) ( )2min ( 1) , , ( 1)t t tE x t Net Net E x t+ − → = +w

x w x w x

Page 4: Low complexity algorithmic trading by Feedforward Neural

4

( ) ( ):1 if

0 otherwise

l ll i liq s

i lή→ = = ⎧âŽȘ =⎚

âŽȘ⎩

s

andrewritethetrainingsetaccordingtotheencodingmechanism:

where .

Then by minimizing the error function

one will obtain

,whereduetotheencoding,componentloftheconditionalexpected value will yield the corresponding conditional probability as

Havingtheconditionaldistributionathand,onecanthenimplementthetradingstrategydiscussedabove,intheformof

4.ReducingthecomplexitybyintroducingspecialencodingschemesThedrawbackofthemethodgivenabove,isthehighcomplexityneuralnetworkrequiredforestimatingtheforwarddistribution,asthedimensionoftheoutput

is . This may result in a large network withmanyconnections which needs long training periods preventing high frequencytrading. A possible way to reduce complexity is to decrease the number ofoutputs.Inordertoachievethisletusrecallthat

whichcanbeinterpretedasasetoflinearequationswithrespecttothevariables.Forshort,werefertothissetofequationsas ,where

and ,andvectoryisobservableattheoutput

of theFFNNwhilematrixS isdeterminedby thecodeused forencoding. It isclearthatifthecodesarechosentoformaninvertiblematrixSoftypeMxMthenvector can be fully calculated by solving the

corresponding set of linear equations.However, for trading onemay not needthefulldistributionbutratherevaluating

( ){ }( )1, , 1,...,K

k k k Kτ += =s x ( )( )1 if 1l

k lx k q+ = + =s s

( ) ( )2 2

11

1 , ,K

k kk

Net E NetK +

=

− → −∑ s x w s x w

( ) ( )( ), KoptNet E=x w s x

( ) ( ) ( ) ( ) ( )( ) ( ) ( ) ( )

1 1( 1)

M Mi i i l

l l li l li i

E s p p p p x t q PÎŽ= =

= = = = + = =∑ ∑s x s x s x s x x

: :

: :

if ( ) and and then buy at and sell at 1;

if ( ) and then buy at and sell at 1.

i ii i m i i m

i ii i m i i m

x t m P P t t

x t m P P t t

Δ

Δ> <

> <

= − ≄ +

= − ≀ − +

∑ ∑

∑ ∑

( ),Net=y w x dim( ) M=y

( ) ( ) ( )( ) ( ) ( )

1,

MK i iopt

iNet E p

=

= = =∑y x w s x s s x

( )( ) , 1,...,ip i M=s x =Sp y( )l

li iS s= ( ) ( )( )(1) ( ),..., Mp p=p s x s x

( ) ( )( )(1) ( ),..., Mp p=p s x s x

: :

: :

if ( ) and and then buy at and sell at 1;

if ( ) and then buy at and sell at 1.

i ii i m i i m

i ii i m i i m

x t m P P t t

x t m P P t t

Δ

Δ> <

> <

= − ≄ +

= − ≀ − +

∑ ∑

∑ ∑

Page 5: Low complexity algorithmic trading by Feedforward Neural

5

Inorder toobtain trading information(i.e.evaluating theprobabilitiesofpricetendencies) we can construct shorter code words because matrix S does notneedtobeinverted.Lemma1:Let us assume that and the first row of matrix S is given as

. Then if and then the trading

actionisBuyattimetandSellattimet+1.Proof:

Since then .

Furthermore,since then

whichindicatesthatprobabilityofpricerisewillbegreaterthantheprobabilityofpricedropasaresultthecorrecttradingactionisBuyattimetandSellattimet+1.With a very similar reasoning, one can conclude that if and

thenthetradingactionisSellattimetandBuybackattimet+1.What happens if but ? In this case we cannot

determine the tendency (rise or drop) of the forward price as

stillholdsbutformthisinequalitywecannotinferthat .Thesame

is true for the case of ( )1sgn 1y = and . In this case we needfurtherinformationabouttheprobabilities.Toobtainthisinformationletusconsiderthefollowinglemma.Lemma2:Let us assume that and the first row of matrix S is given as

1

1 if / 21 if / 2i

i MS

i M≀⎧

= ⎹− >⎩

,whilethesecondrowissetas 2

1 if 3 / 41 if 3 / 4i

i MS

i M≀⎧

= ⎹− >⎩

Then if , ( )2sgn 1y = and then the tradingactionisBuyattimetandSellattimet+1.Proof:

{ }1,1liS ∈ −

1 1 if / 21 if / 2

iS i Mi M

= ⎧âŽȘ ≀⎚âŽȘ− >⎩

( )1sgn 1y = − ( ) / 2x t m M= ≀

( )/2

1 11 1 /2 1

sgn sgn sgn 1M M M

i i i ii i i M

y S p p p= = = +

⎛ ⎞ ⎛ ⎞= = − = −⎜ ⎟ ⎜ ⎟

⎝ ⎠ ⎝ ⎠∑ ∑ ∑

/2

1 /2 1

M M

i ii i Mp p

= = +

<∑ ∑( ) / 2x t m M= ≀

/2 /2 /2

: 1 /2 1 1 1 :

M M M M

i i i i i ii i m i m i M i i m i i mP P P P P P

> = + = + = = + <

= + > − =∑ ∑ ∑ ∑ ∑ ∑

( )1sgn 1y =

( ) / 2 1x t m M= ≄ +

( )1sgn 1y = − ( ) / 2 1x t m M= ≄ +/2

1 /2 1

M M

i ii i Mp p

= = +

<∑ ∑

: :i i

i i m i i mP P

> <

>∑ ∑( ) / 2x t m M= ≀

{ }1,1liS ∈ −

( )1sgn 1y = − / 2 ( ) 3 / 4M x t m M≀ = ≀

Page 6: Low complexity algorithmic trading by Feedforward Neural

6

Since then .

Furthermore, since then

Takingintoaccountthat then

whichindicatesthatprobabilityofpricerisewillbegreaterthantheprobabilityofpricedropasaresultthecorrecttradingactionisBuyattimetandSellattimet+1.Onemustnotethatsofarwehaveonly2DcodingvectorsasthetypeofmatrixSis2xM.Itiseasytoseethatifthereisfurtherambiguityintradingthenwemustaddnewrowvectors,inasimilarfashiontoidentifythecorrecttradingaction.For a time being, let us assume that we have just implemented a 1D coding

(matrixShasasinglerowdefinedas 1

1 if / 21 if / 2i

i MS

i M≀⎧

= ⎹− >⎩

).Ambiguityintrading

occurs if but or if but. In this casewerefrain fromtradingeven though theoutcome

canstillbeprofitable.Based on this coding schemes, one can indeed reduce the number of outputswhich, in turn, will reduce the number of connections in the correspondingFFNN:5.NumericalresultsToimplementtheneuralbasedestimationoftheforwarddistribution,wehaveused the Neural Net toolbox ofMatlab R2015b, and the Levenberg-Marquardtbackpropagationalgorithmfortraining.5.1.PerformanceanalysisonrandomlygeneratedtimeseriesFirst,weinvestigatedtheperformanceofthealgorithmsonarandomtimeseriesgeneratedasfollows:

‱ WesetM=16andL=4andgeneratedatablerepresentingthetheprobabilitiesof the state transitions of the time series (a total number of M^L*(M-1)independentparameterswereset,subjecttouniformdistribution).

‱ OurobjectivewastoapproximatethisforwardprobabilitydistributionbyanFFNN with one hidden layer, containing 5-45 neurons and training it onlearningsetswithsizerangingbetween10and400.

( )/2

1 11 1 /2 1

sgn sgn sgn 1M M M

i i i ii i i M

y S p p p= = = +

⎛ ⎞ ⎛ ⎞= = − = −⎜ ⎟ ⎜ ⎟

⎝ ⎠ ⎝ ⎠∑ ∑ ∑

/2

1 /2 1

M M

i ii i Mp p

= = +

<∑ ∑

( )3 /4

2 11 1 3 /4 1

sgn sgn sgn 1M M M

i i i ii i i M

y S p p p= = = +

⎛ ⎞ ⎛ ⎞= = − = −⎜ ⎟ ⎜ ⎟

⎝ ⎠ ⎝ ⎠∑ ∑ ∑

3 /4

1 3 /4 1

M M

i ii i Mp p

= = +

<∑ ∑( ) / 2x t m M= ≀

3 /4 3 /4 3 /4

: 1 3 /4 1 1 1 :

M M M M

i i i i i ii i m i m i M i i m i i mP P P P P P

> = + = + = = + <

= + > − =∑ ∑ ∑ ∑ ∑ ∑

( )1sgn 1y = − ( ) / 2 1x t m M= ≄ + ( )1sgn 1y =

( ) / 2x t m M= ≀

Page 7: Low complexity algorithmic trading by Feedforward Neural

7

‱ Weutilizedthecomplexityreductiontechnique,andgeneratethreematrices;S1withonerows,S3withthree,andS7withsevenrows,eachgeneratedfromthepreviousonebyrecursivebisection.

‱ For each combination of training set size (hist), number of hidden layerneurons (num_neur) and the size of matrix S, we have carried out thefollowingtest:on300ticks,foreach,wecaneithertrade(short/long)ornot.Every five tickswe re-trainourneuralnetworkgiven thepasthist samples.Foreverytick,wefeedtheneuralnetworkwiththeprecedingsamples(L=4),and observe the forward distribution at the output. Based on the outputtradingdecisionsaremadeasdescribedinSection4.Thesuccessofthetradeisdeterminedbythenexttickvalue.

Wecancharacterizetheperformanceofthealgorithmbytwobasicperformanceindices: (i) the success rate; and (ii) the number of trades.On top of this,weimplement a simple trading simulation that startswith a given capital (10000USD),andateverytickitinvestsaquarterofthecurrentcapitalifthedecisionismadetotrade,andrealizestheprofit(orloss)forthattradeatthenexttick.Figure 1 shows the corresponding three subfigures on differenthist-num_neurcombinations when predicting the full forward distribution, according to thetradingstrategydescribedinSection3:withan increasingtrainingsetsize,wequicklyachieveover70%successrateandthenumberoftradesisaround270with𝜀 = 0.1, and as expected, the profit at the end of 300 trades increasesexponentiallywiththesuccessrate.Figure2showsresultsusinganSmatrixwithonerow.AsexpectedinthecaseofthisspecificSmatrix,thenumberoftradesisaround150,or50%.Successrateisaround70%regardlessofthenumberofneuronsused,andthetotalprofitafter300 is close to 400%. Increasing the size of the S matrix to three rows givesresults shown inFigure3.Here some clear trends emerge, namely: (i) smallernetworks have a higher success rate, butmake fewer trades, and (ii) with anincreasingtrainingsetsize,successratessaturatequickly.WithmatrixShavingmorerows,thenumberoftradesincreasestoaround220,gettingcloseto75%.Asaconclusion,thesmallestnetworkgivesthehighestprofitafter300ticks,onaverage around 900%. Results, when using a matrix S with seven rows, arepresentedinFigure4,whichlookssimilartothethreerowcase,butthenumberof trades has now increased above 260, or 87% which is also in line withexpectations.Theoverallprofitafter300ticksdoubledtoaround1300%.Theseresultsdemonstratetheapplicabilityofthetheorytorandomlygeneratedtimeseries,andgiveusagoodsenseofhownetworkswithvariousparametersperform. It also shows that the reduced complexity system requires a smallertraining set than the full complexity system, but does not perform better atlargertrainingsets.

Figure1–Randomgeneratedseries,predictingfullforwarddistribution

Page 8: Low complexity algorithmic trading by Feedforward Neural

8

Figure2–Randomgeneratedseries,Swithonerow

Figure3-Randomgeneratedseries,Swith3rows

Figure4-Randomgeneratedseries,Swith7rows

5.2.PerformanceonrealstockdataHaving investigated theperformanceofouralgorithmsonrandomlygenerateddatasets, we now use the method for trading on stock prices. We havedownloaded1-hourtickstockdatafromNASDAQandNYSEbetweenthe26thofOctober,2015,andthe30thofMay,2016.WeextractedthetimeseriesforalloftheSP500stocks,andgeneratedanumberofportfolios,eachconsistingof fivedifferentstocks.Weselectedportfolioswithonlyasmallamountofmovementinthemean;thisisbecauseouralgorithmsperformbestwhenthetimeseriestakesitsvaluesonalarge fraction of the price levels for any given time window. Thus due to theexamplescoveringthewholestatespaceweobtaina“rich”trainingsetandtheFFNNcansuccessfullylearntheforwarddistribution.Ifitisnotthecase,andthemean shifts, then after training we observe such input values that were notincluded in the trainingset,whichresults inpoorgeneralization.For thesamereason,wehaverestrictedthetrainingsetsizesbetween10and300.

Table1-Stocksandweightsofthethreeportfolios

Portfolio1 PRU OKE IP AMGN WDC 14.16 8.55 -0.36 15.3 -24.24

Portfolio2 VLO TIF A CHD FL 18.87 -12.54 -1.58 7.88 11.16

Portfolio3 NKE CHRW TROW FTR SCG 23.91 15.67 -19.31 -13.13 -7.11

Page 9: Low complexity algorithmic trading by Feedforward Neural

9

First, we evaluate Portfolio 1; results are shown in Figure 4, here we onlyevaluatethestrategywithanSmatrixthathassevenrows(exhibitingthebestperformanceongenerateddata).Tradingbeginsatthe400thtickmark,andcontinuestothe700thtick.Wecomparethefullcomplexity,forward-distribution estimation algorithm, shown in Figure 5, to the reducedcomplexityone,showninFigure6,bothat𝜀 = 0.1.Asexpected,thesuccessrateisonlyafewpercentpointsabove50%,butconsistentlyso,andgiventhelargenumberoftrades,after300ticks,ourprofitisaround102-105%.Theprofitwitha buy-and-hold strategy (buy at the first tick sell at 300) is 98% (2% loss),though.Clearly, the full complexity system carries out more trades, but with a lowersuccess rate compared to the reduced complexity system. In the reducedcomplexitycase,wealsoobserveadecreasingnumberoftradesasthelengthofthetrainingset is increased,whichis likelyduetooverfittingandthechangingstatisticalpropertiesofthetimeseries.

Figure5–Portfolio1,fullsystem

Page 10: Low complexity algorithmic trading by Feedforward Neural

10

Figure6Portfolio1,Swith7rows

Figure7showstheaveragedresultsof the fullcomplexitysystemcomparedtotheaveragedresultsof thereducedcomplexitysystem,whilechangingepsilon,the threshold for trading. As epsilon increases, the number of trades fallsrapidly,buttheaveragesuccessrate improves,showingthattheoutputsoftheneural networks indeed represent the probability of increase or decrease.Furthermore,thelossfromincorrecttradingpredictionsalsodecreases,leadingto a slight overall increase in the profit at the end of 300 ticks. The reducedsystemclearlyperformsmuchbetter than the full complexity system.Figure8showsmatching figures forportfolios2and3,underlining theefficiencyof thereducedcomplexitysystem.Notably,forportfolio3,thesuccessrateisworseforthe reduced complexity system, but the overall profit is higher, due to smallerlosseswhenthewrongtradingdecisionismade.

Figure7–Portfolio1,varyingepsilon

Page 11: Low complexity algorithmic trading by Feedforward Neural

11

Figure8–Portfolio2and3,varyingepsilon

Finally, we introduce a new trading strategy in which we are concurrentlyrunning the predictive algorithm on all three portfolios described previously,andateachtickwetradewiththeonewiththehighestprobabilityofincreaseordrop. Results are shown in Figure 9, which outperform all of the individualportfolios,makingmorethan290outof300possibletrades,achievingahighersuccess rate, and giving an average profit of 107.3%, or up to 115% is somecases.

Figure9–Concurrenttradingstrategy

6.ConclusionsIn this paper, we have presented a neural network based Bayesian tradingalgorithm,predictingatimeseriesbyhavinganeuralnetworklearntheforwardconditional probability distribution of state transitions, when the values arediscretized.Recognizingoneofthekeylimitationsofthealgorithm,wedesigneda complexity reduction scheme by developing a special coding technique thatmakestrainingviableevenonshorter trainingsets.Wehave implementedthistrading algorithm, and demonstrated that it can learn the distribution of arandomlygenerated time series, yielding successful tradingdecisionson them.Then we tested the performance of the new method on real stock data fromNASDAQandNYSE.Asdemonstratedthemethodisprofitableevenonrealdata.Furthermore, it hasbeenpointedout that as far as theprofit is concerned thesystem with low complexity encoding performs as well as the one with theorthogonalcodingscheme.AcknowledgementsTheresearchreportedherehasbeensupportedbyGrantKAP15-062-1.1-ITK.

Page 12: Low complexity algorithmic trading by Feedforward Neural

12

REFERENCES

[1] Hornik, K, Stinchcombe, M, White, H Multilayer Feedforward Networks are Universal Approximators. Neural Networks,

VOL. 2, 1989, pp.359-366. [2] Funahashi,K.I.On the Approximate Realization of Continuous Mappings by Neural Networks. Neural Networks, VOL. 2,

1989, pp.183-192. [3] Haykin, S. Neural Network Theory: a Comprehensive Foundation, Prentice Hall, 1999. [4] Anagnostopoulos, K.P., and Mamanis, G. (2011) The mean-variance cardinality constrained portfolio optimization

problem: An experimental evaluation of five multiobjective evolutionary algorithms.. Expert Systems with Applications, 38:14208-14217

[5] Banerjee, O., El Ghaoui, L., d’Aspermont A. (2008) Model Selection Through Sparse Maximum Likelihood Estimation. Journal of Machine Learning Research, 9: 485-516

[6] Box, G.E., Tiao, G.C. (1977) A canonical analysis of multiple time series. Biometrika 64(2), 355-365 [7] Chen, L., Aihara, K. (1995) Chaotic Simulated Annealing by a Neural Network Model with Transient Chaos Neural

Networks 8(6) 915-930 [8] D’Aspermont, A, Banerjee, O., El Ghaoui, L.(2008) First-Order Methods for Sparce Covariance Selection. SIAM Journal

on Matrix Analysis and its Applications, 30(1) 56-66 [9] D’Aspremont, A.(2011) Identifying small mean-reverting portfolios. Quantitative Finance, 11:3, 351-364 [10] Fama, E., French, K.(1988) Permanent and Temporary Components of Stock Prices. The Journal of Political Economy

96(2), 246-273 [11] Manzan, S. (2007) Nonlinear Mean Reversion in Stock Prices. Quantitative and Qualitative Analysis in Social Sciences,

1(3), 1-20 [12] Markowitz, H. (1952) Portfolio Selection. The Journal of Finance 7:1,77-91