Hello, I just started practicing with prorealtime automatic trading. It is great to have discovered this community.
I wanted to show you a somehow interesting strategy based on taking the opposite direction of previous day in the morning between 09:00 and 09:30 on Ftse mib.
I then add some filter in order to avoid taking the position in an overbought or oversold environment unless there is a momentum defined by the positive or negative local derivative of RSI.
Furthermore I added a filter based on the size of the body of the previous day candle.
Will be great if you tell me what you think about it.
Ciao
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
timeenter = time = 090000
timeexit = time = 093000
b = 175
size = 5
// Conditions to enter long positions
c1 = (DClose(1) <= DOpen(1)-b)
indicator1 = RSI[14](close)
c3 = (indicator1[1] < 60)
c4 = (indicator1[1] > 40)
c5 = (indicator1[1] > indicator1[2])
c6 = (indicator1[1] < indicator1[2])
c7 = c3 OR c5
c8 = c4 OR c6
IF c1 AND c7 AND timeenter THEN
BUY size PERPOINT AT MARKET
ENDIF
if longonmarket AND timeexit THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
c2 = (DClose(1) >= DOpen(1)+b)
IF c2 AND c8 AND timeenter THEN
SELLSHORT size PERPOINT AT MARKET
ENDIF
if shortonmarket AND timeexit THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 300
Hi Francesco, are you sure you included the spread in your own tests? I did 200k bars backtest with 1.5 spread on MIB40 1€/point and I do not get the same result as you?
Hi Nicolas, I just saw your answer, sorry, yes I included the spread, I re run it and I got results similar to my first test. What I find weird is that on my platform, 100,000 half an hour candles go back to Apr 2015, while I see that yours 200,000 candles go back much further than double mine.
Anyway I have just posted a refined version of this code on the forum. Would be great if you could have a look to that as well.
Pls also note that I did the backtest in tick by tick mode.
Regards
Francesco