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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Simple RSI system using 3 X ATR stop and 5 X ATR profit objective

’****************************************************************

’**** This is a good place to put all of your function calls ****

’**** and system calculations. A simple RSI system ****

'**** that buys when RSI < 20 and sells when RSI > 80. ****

'**** Utilizes a 5 ATR Profit and a 3 ATR Protective Stop ****

’****************************************************************

Call BollingerBand(myClose, 60, 2, avg, upBand, dnBand,

i, 1)

simpleAvg = Average(myClose, 19, i, 1)

atr = Average(myTrueRange, 20, i, 1)

rsiVal = RSI(myClose, 14, i, 0)

Call Stochastic(3, 4, 7, stoK, stoD, slowD, i, 1)

’****************************************************************

’**** Put All Of Your Orders Here ****

’****************************************************************

prevMarketPosition = marketPosition

If marketPosition <> 1 And rsiVal < 20 Then

Call Trade(Buy, "RSIBuy", myClose(i), moc, i)

End If

If marketPosition <> -1 And rsiVal > 80 Then

Call Trade(Sell, "RSISell", myClose(i), moc, i)

End If

If marketPosition = 1 Then

If myClose(i) < entryPrice - 3 * atr Then

Call Trade(ExitLong, "L-ATR Stop", myClose(i), moc, i)

End If

If myClose(i) > entryPrice + 5 * atr Then

Call Trade(ExitLong, "L-ATR Prof", myClose(i), moc, i)

End If

End If

If marketPosition = -1 Then

If myClose(i) > entryPrice + 3 * atr Then

Call Trade(ExitShort, "S-ATR Stop", myClose(i),

End If

moc, i)

If myClose(i) < entryPrice - 5 * atr Then

165

USING MICROSOFT EXCEL TO BACKTEST YOUR ALGORITHM

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!