I found this system for the DAX and it sounds very interesting. Can someone code this for me please? Here are the trading rules:
Morning Weakness
– Entry short position: 8:40 am
– Time stop: 10:30 a.m
– Take Profit: 15 points
– Stop loss: 45 points
– Note: Once the markets become more volatile, it makes sense the
Add condition that the lecture was strong.
Noon Strength
– Entry long position: 10:30 a.m
– Time stop: 2:35 p.m
– Take Profit: 80 points
– Stop loss: 60 points
– 1st condition: previous day’s closing price below GD 10
– 2nd condition: previous day’s closing price above GD 250
Afternoon weakness
– Entry short position at 14:35
– Time stop: 18:20
– Take Profit: 15 points
– Stop loss: 50 points
– 1st condition: Price at entry is below the opening price of the
Cash market at 9 a.m
Overnight Anomaly
– Entry long position at 18:20
– Time stop: Next day at 8:40 am
– Take Profit: 100 points
– Stop loss: 100 points
– 1st condition: previous day’s closing price above GD 250
https://ninjacademy.traderfox.de/handelssysteme/intraday-charlie-intraday-dax-zyklen/id-2675
This is the code (without the NOTE and the GD explanations):
DEFPARAM CumulateOrders = true
//
IF Not OnMarket THEN
ID = 0
ENDIF
//
IF Time = 090000 THEN
PriceAt9 = close
ENDIF
//-----------------------------------------------------------------------------------------------------
/*
Morning Weakness
- Entry short position: 8:40 am
- Time stop: 10:30 a.m
- Take Profit: 15 points
- Stop loss: 45 points
- Note: Once the markets become more volatile, it makes sense the Add condition that the lecture was strong.
*/
IF Time = 084000 THEN //What does you note mean?
SELLSHORT 1 Contract at Market
SET TARGET pPROFIT 15
SET STOP pLOSS 45
ID = 1
ENDIF
IF OnMarket AND ID = 1 AND Time = 103000 THEN
EXITSHORT AT Market
ENDIF
//
//-----------------------------------------------------------------------------------------------------
/*
Noon Strength
- Entry long position: 10:30 a.m
- Time stop: 2:35 p.m
- Take Profit: 80 points
- Stop loss: 60 points
- 1st condition: previous day’s closing price below GD 10
- 2nd condition: previous day’s closing price above GD 250
*/
IF Time = 103000 THEN //what does GD mean ?
BUY 1 Contract at Market
SET TARGET pPROFIT 80
SET STOP pLOSS 60
ID = 2
ENDIF
IF OnMarket AND ID = 2 AND Time = 143500 THEN
SELL AT Market
ENDIF
//
//-----------------------------------------------------------------------------------------------------
/*
Afternoon weakness
- Entry short position at 14:35
- Time stop: 18:20
- Take Profit: 15 points
- Stop loss: 50 points
- 1st condition: Price at entry is below the opening price of the Cash market at 9 a.m
*/
IF Time = 143500 AND (close < PriceAt9) THEN //What does you note mean?
SELLSHORT 1 Contract at Market
SET TARGET pPROFIT 15
SET STOP pLOSS 50
ID = 3
ENDIF
IF OnMarket AND ID = 3 AND Time = 182000 THEN
EXITSHORT AT Market
ENDIF
//
//-----------------------------------------------------------------------------------------------------
/*
Overnight Anomaly
- Entry long position at 18:20
- Time stop: Next day at 8:40 am
- Take Profit: 100 points
- Stop loss: 100 points
- 1st condition: previous day’s closing price above GD 250
*/
IF Time = 182000 THEN //what does GD mean ?
BUY 1 Contract at Market
SET TARGET pPROFIT 100
SET STOP pLOSS 100
ID = 4
ENDIF
IF OnMarket AND ID = 4 AND Time = 084000 THEN
SELL AT Market
ENDIF
Thank you Roberto. GD means moving average, so SMA. I will test it.
This the updated version (with MAs):
DEFPARAM CumulateOrders = true
//
IF Not OnMarket THEN
ID = 0
ENDIF
//
IF Time = 090000 THEN
PriceAt9 = close
ENDIF
//
Sma10 = average[10,0](close)
Sma250 = average[250,0](close)
//-----------------------------------------------------------------------------------------------------
/*
Morning Weakness
- Entry short position: 8:40 am
- Time stop: 10:30 a.m
- Take Profit: 15 points
- Stop loss: 45 points
- Note: Once the markets become more volatile, it makes sense the Add condition that the lecture was strong.
*/
IF Time = 084000 THEN //What does you note mean?
SELLSHORT 1 Contract at Market
SET TARGET pPROFIT 15
SET STOP pLOSS 45
ID = 1
ENDIF
IF OnMarket AND ID = 1 AND Time = 103000 THEN
EXITSHORT AT Market
ENDIF
//
//-----------------------------------------------------------------------------------------------------
/*
Noon Strength
- Entry long position: 10:30 a.m
- Time stop: 2:35 p.m
- Take Profit: 80 points
- Stop loss: 60 points
- 1st condition: previous day’s closing price below GD 10
- 2nd condition: previous day’s closing price above GD 250
*/
IF (Time = 103000) AND (Dclose(1) < Sma10) AND (Dclose(1) > Sma250) THEN
BUY 1 Contract at Market
SET TARGET pPROFIT 80
SET STOP pLOSS 60
ID = 2
ENDIF
IF OnMarket AND ID = 2 AND Time = 143500 THEN
SELL AT Market
ENDIF
//
//-----------------------------------------------------------------------------------------------------
/*
Afternoon weakness
- Entry short position at 14:35
- Time stop: 18:20
- Take Profit: 15 points
- Stop loss: 50 points
- 1st condition: Price at entry is below the opening price of the Cash market at 9 a.m
*/
IF Time = 143500 AND (close < PriceAt9) THEN //What does you note mean?
SELLSHORT 1 Contract at Market
SET TARGET pPROFIT 15
SET STOP pLOSS 50
ID = 3
ENDIF
IF OnMarket AND ID = 3 AND Time = 182000 THEN
EXITSHORT AT Market
ENDIF
//
//-----------------------------------------------------------------------------------------------------
/*
Overnight Anomaly
- Entry long position at 18:20
- Time stop: Next day at 8:40 am
- Take Profit: 100 points
- Stop loss: 100 points
- 1st condition: previous day’s closing price above GD 250
*/
IF Time = 182000 AND (Dclose(1) > Sma250) THEN
BUY 1 Contract at Market
SET TARGET pPROFIT 100
SET STOP pLOSS 100
ID = 4
ENDIF
IF OnMarket AND ID = 4 AND Time = 084000 THEN
SELL AT Market
ENDIF
Because of the TimeStop at 14:35 I could only take time frames <= 5 min for the backtest.
Tested were 1 Mio units with 2 points spread of the itf-file unchanged after download.
Unfortunately I haven’t gotten around to it yet. Does not look good. And if you only use the “overnight anomaly”?
hi phoentzs,
I have no real clue about dax morning/noon/afternoon cycles – I mean I did not test them ever. but since overnight anomaly is generally well known, I was “stealing” the idea and did my own implementation for cfd and futures (as somebody told: “steal the ideas, but not the implementation”) – and it seams to work. it has ultra-simple logic, no GDs/SMAs or other indicators, just checking if prices around the end of main stock trading hours (let’s say 17:30) are stronger than at opening in the morning (09:00) and then buying and holding overnight, just with stop loss, but no targets – simply selling in the morning before the cash market opens. very few lines of code. it’s consistently profitable, but not extraordinary profitable strategy. you have to consider also cost of holding the position overnight – these costs increased a lot recently with increasing interest rates. so on one hand it might work better with futures (no overnight costs) than with cfd, on other hand with cfd you have an option to choose “guaranteed” exit stop (which again cost some points but only if triggered) – which prevents you from huge slippage / overnight gaps / over-weekend gaps while guaranteed stops are not available with futures trading (well, maybe one can create it somehow with options, but again I have here no real clue about “how”, just rough idea). no free lunch, as always.
according my tests there is also an anomaly of “weak morning/noon” which is opposite to the logic above: when dax is negative from opening till lunch time and makes new lows of the day after lunch time, it “usually” goes down until end of the day and even more overnight. strategy makes small losses month after month, it’s not even profitable every year, but it catches basically all smaller and bigger crasches of dax index and “makes a killing” then. it’s kind of “insurance” against crashes, good to have in the portfolio of strategies, especially because it seems particularly hard to find any stragegy at all which works on the short side when it comes to equity indices trading.
sorry I will not share any codes or more details on the scenario details above, just want to encourage to excercise some coding yourself, think of simple scenarios which you can write down in few words/sentences (and code accordingly), and test it, not fogetting to consider the costs (spread, slippage, holding position overnight).
regards
justisan