top of page

Daily RSI2 strategy (Made with ChatGPT)

Writer: ProRealAlgosProRealAlgos

37 lines of AI-generated code for swing trading SP500 on the daily timeframe. Long only. Please remember to run in test before starting it. I also suggest adding a stoploss.






The code

defparam cumulateorders = false

// Define RSI parameters
RSIPeriod = 2
RSIOversold = 15
RSIOverbought = 20

// Calculate RSI
RSIValue = rsi[RSIPeriod]

//Day-of-the-week filter
DayOfWeekFilter = dayofweek
FilterDay = 5 // Friday

// Monthly filter

if month = 0 or month = 1 or month = 2 or month = 3 or month = 4 or month = 10 or month = 11 or month = 12 then
LongMonths = 1
else
LongMonths = 0
endif

if month = 5 or month = 6 or month = 7 or month = 8 or month = 9 then
AvoidMonths = 1
else
AvoidMonths = 0
endif

// Entry condition
if RSIValue crosses under RSIOversold and DayOfWeekFilter = FilterDay and Longmonths then
buy at market
endif

if RSIValue crosses over RSIOverbought and DayOFweekFilter = Filterday and not AvoidMonths then
sell at market
endif


Credit to quantifiedstrategies.com for the initial idea



Comments


Try the products free for 7 days

Easy setup • full version • get-started support

ProRealTime made easy

CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. On average 76% of retail investor accounts lose money when trading CFDs. Past performance is no guarantee of future results. You should consider whether you understand how CFDs work before starting.

Read full terms and conditions

ProRealTime™ is a trademark registered by the third-party entity ProRealTime SAS

We have no link with the ProRealTime™ entity that offers the ProRealTime™ trading software

Copyright ProRealAlgos 580648-4231
Harju maakond, Tallinn, Kesklinna linnaosa, Pille 13, 10173

bottom of page