Page 1 of 1

Dynamic Trend following algorithm Strategy

PostPosted: Tue Sep 03, 2019 10:53 am
by Apprentice
1.png

2.png


Based on the article "The Application of Trend Following Strategies in Stock Market Trading" and "Trend following algorithms in automated derivatives market trading"
Simon Fong, Jackie Tai

Pseudo code of Adaptive P&Q Rules
Repeat
Compute RSI(t) and EMA(RSI(t))
If price is advancing at t
If RSI(t)>EMA(RSI(t)) and 40<EMA(RSI(t))>60
If no position opened
Open a long position, P'
Else if short position opened
Close out short position, Q'
Else if price is declining at t
If RSI(t)<EMA(RSI(t)) and 40<EMA(RSI(t))>60
If no position opened
Open a short position, Q'
Else if long position opened
Close out long position, P'
If end of market
Close all opened position
Until Market Close

Dynamic Trend following algorithm Strategy.lua
(30.98 KiB) Downloaded 339 times