31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function Xaverage(dataList, prevXavg, length, index, offset)

Function Xaverage(dataList, prevXavg, length, index, offset)

If prevXavg = 0 Then

Xaverage = dataList(index - offset)

Else

Xaverage = prevXavg + 2 / length * (dataList(index

- offset) - prevXavg)

End If

End Function

Sub MACD(dataList, shortLen, longLen, smooth, myMacd, mySmoothMacd,

xMavg1, xMavg2, index, offset)

Sub MACD(dataList, shortLen, longLen, smooth, myMacd,

mySmoothMacd, xMavg1, xMavg2, index, offset)

If xMavg1 = 0 And xMavg2 = 0 Then

xMavg1 = dataList(index - offset)

xMavg2 = dataList(index - offset)

myMacd = 0

mySmoothMacd = 0

Else

xMavg1 = xMavg1 + 2 / shortLen * (dataList(index

- offset) - xMavg1)

xMavg2 = xMavg2 + 2 / longLen * (dataList(index

- offset) - xMavg2)

myMacd = xMavg1 - xMavg2

mySmoothMacd = mySmoothMacd + 2 / smooth * (myMacd - mySmoothMacd)

End If

End Sub

307

EXCEL SYSTEM BACKTESTER

Sub Stochastic(kLen, dLen, dSloLen, kVal, dVal, dSloVal, index, offset)

Sub Stochastic(kLen, dLen, dSloLen, kVal, dVal, dSloVal, index, offset)

Dim index1, index2, hh, ll, sum As Double

Dim i, j, k As Integer

Dim kSto(100) As Double

Dim dSto(100) As Double

indexPt = index - offset

index1 = kLen + dLen

index2 = dLen - 1

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!