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 Moving Average Crossover using 3 X ATR stop

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

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

’**** and system calculations. A simple moving average ****

'**** crossover system using 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, 1)

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

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

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

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

prevMarketPosition = marketPosition

164

If marketPosition <> 1 And myClose(i) > simpleAvg Then

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

End If

USING MICROSOFT EXCEL TO BACKTEST YOUR ALGORITHM

If marketPosition <> -1 And myClose(i) < simpleAvg Then

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

End If

If marketPosition = 1 And myClose(i) < entryPrice -

3 * atr Then

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

End If

If marketPosition = -1 And myClose(i) > entryPrice +

3 * atr Then

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

End If

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

’**** End of Main Traiding Loop ****

’**** No orders allowed below this point ****

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

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!