Dynamic Trend following algorithm Strategy

Strategies are published here.

Moderator: admin

Dynamic Trend following algorithm Strategy

Postby Apprentice » Tue Sep 03, 2019 10:53 am

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
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36435
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Return to Custom Strategies

Who is online

Users browsing this forum: No registered users and 28 guests