Ftse mib morning inversion strategy 30 min TF

Category: Strategies By: Francesco78 Created: April 12, 2017, 8:44 AM
April 12, 2017, 8:44 AM
Strategies
8 Comments

Dear all,

This is my first strategy posted, I have coded this strategy based on my empirical experience, the idea is that Italy 40 index tends to invert directionality in the morning at 09:00 CET. 09:00 is the time when the future starts trading and is also the time when the index bid offer spread shrinks from around 25ticks to 6/7 ticks.

The fliter I used are:

  1. the previous day bar has a well defined directionality, parametrized by the variable b in the code, set at 120.
  2. the market is volatile enough: ATR[50] >20

The code force open and close at 30 minutes distance, open at 09:00 and closes at 09:30

In the code I also added an accumulator of positions, ading up positions as long as the strategy is profitable.

You find the results in the picture named btVP.png.

I also tried to do a walk forward analysis, with constant positions, and the results are in backtestwg.png

There is one thing to note before trying to run the code.

In the example I used a 30 minutes time frame in order to capture the longest possible timeseries, but pls be warned that in real you should open a position slightly later than 09:00:00 because the bid offer tightnes only after few seconds after. Ideally 09:01:00 should be fine.

As far as I know Nicolas has done a 200, 000 backtest and it looks that the strategy has worked consistently well up to 2013.

Any comment, improvement will be greatly appreciated.

// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
timeenter = time = 090000
timeexit = time = 093000

indicator1 = AverageTrueRange[50](close)
volfilter= indicator1>20

b = 120
size = 5
increasestep = 2000
// Conditions to enter long positions
c1 = (DClose(1) <= DOpen(1)-b) and abs(dclose(1)-dopen(1))<900

NotAugust = CurrentMonth < 8 OR CurrentMonth > 8

if strategyprofit >=0 then
 IF c1  AND timeenter  and NotAugust  and volfilter THEN
  BUY size+round(strategyprofit/increasestep) PERPOINT AT MARKET
 ENDIF
endif

if strategyprofit < 0 then
 IF c1  AND timeenter  and NotAugust  and volfilter THEN 
  BUY size/2 PERPOINT AT MARKET
 ENDIF
endif

if longonmarket AND timeexit and volfilter THEN
 SELL AT MARKET
ENDIF

// Conditions to enter short positions
c2 = (DClose(1) >= DOpen(1)+b)and abs(dclose(1)-dopen(1))<900

if strategyprofit >=0 then
 IF c2    AND timeenter and NotAugust and volfilter THEN
  SELLSHORT size+round(strategyprofit/increasestep) PERPOINT AT MARKET
 ENDIF
endif
if strategyprofit < 0 then
 IF c2    AND timeenter and NotAugust and volfilter  THEN
  SELLSHORT size/2 PERPOINT AT MARKET
 ENDIF
endif

if shortonmarket AND timeexit THEN
 EXITSHORT AT MARKET
ENDIF

// Stops and targets
SET STOP  ploss 300
set target pprofit 400

 

Download
Filename: btVP.png
Downloads: 86
Download
Filename: wfdetail.png
Downloads: 58
Download
Filename: backtestwf.png
Downloads: 116
Download
Filename: morninginvITALY40_30m.itf
Downloads: 219
Francesco78 Master
Currently debugging life, so my bio is on hold. Check back after the next commit for an update.
Author’s Profile

Comments

Logo Logo
Loading...