Raul Vg

intraday DAX strategy mini-1€, timeframe 5 min

Category: Strategies By: Raul Vg Created: January 16, 2017, 10:00 AM
January 16, 2017, 10:00 AM
Strategies
70 Comments
intraday DAX strategy mini-1€, timeframe 5 min

Good afternoon,

This robot simply tries to buy or sell in the direction of the first 5 minutes of the market, ie if the first bar 5 minutes from the opening at 9am is positive, we buy, otherwise we sell.

With a spread of 1 point in the DAX mini 1 € and a time frame of 5 min.

In addition, it has an accumulator, in case the operation wins, the next day we will add 2 contracts, in case of losing the operation, we will divide between two contracts that we put the next day. Example:

Day 1: 1 contract -> We win; Day 2: 3 contracts-> We win; Day 3: 5 contracts-> We lost; Day 4: 3 (2.5) contracts-> We win; Day 5 = 5 contracts …

In addition, it has a manual multiplier to assume greater or lesser risk with the number of contracts.

There are also a maximum number of contracts.

IMPORTANT: For a faithful backtest, you must use PRT v10.3, in v.10.2 the results are NOT real.

A discussion thread is ongoing on the forum about the settings and feedback about the strategy, you can read, ask your questions and participate here:  https://www.prorealcode.com/topic/5-min-mini1e-dax-spread-1/

//—————–

Buenas tardes,

Este robot trata simplemente de comprar o vender en la dirección de los primeros 5 minutos del mercado, es decir, que si la primera barra de 5 minutos desde la apertura a las 9h es positiva, compramos, en caso contrario, vendemos.

Con un spread de 1 punto en el DAX mini 1€ y un time frame de 5 min.

Además, tiene un acumulador, en el caso de que la operación resulte ganadora, al día siguiente sumaremos 2 contratos, en el caso de perder la operación, dividiremos entre dos los contratos que metemos al día siguiente. Ejemplo:

Día 1: 1 contrato -> Ganamos; Día 2: 3 contratos-> Ganamos; Día 3: 5 contratos-> Perdemos; Día 4: 3 (2,5) contratos-> Ganamos; Día 5= 5 contratos…

Además, tiene un multiplicador manual para asumir mayor o menor riesgo con la cantidad de contratos.

También hay puesto un máximo de contratos.

IMPORTANTE: Para un backtest fiel, hay que usar PRT v10.3, en la v.10.2 los resultados NO son reales.

// Definición de los parámetros del código
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada

// La posición se cierra a las 17:29 p.m. si no toca ni stop ni take.
DEFPARAM FlatAfter =173000

once ordersize=1
// No se abren nuevas posiciones después de la vela que se cierra a las 09:06
HoraEntradaLimite = 090600
// El análisis de mercado empieza en la vela de 5 minutos que cierra a las 09:05
HoraInicio = 090500

// Órdenes máximas
if Ordersize>18 then
 Ordersize=18
endif

// Riesgo, multiplicador de contratos.

n=6

// Condiciones para el analisis.

if Time >= HoraInicio and time <= HoraEntradaLimite then

// Condiciones de entrada de posiciones largas.

c1 = open < close-1
IF c1 THEN
 IF PositionPerf(1) < 0 THEN
  OrderSize = OrderSize/2//+1
  if ordersize<1 then
   ordersize=1
  ENDIF
 ELSIF PositionPerf(1) > 0 THEN 
  OrderSize =OrderSize+2
 endif
// Si la primera barra del día de 5 min es positiva, compramos.
 buy ordersize*n shares at market
endif

// Condiciones de entrada de posiciones cortas.

c2= open > close-1
IF c2 THEN
 iF PositionPerf(1) < 0 THEN
  OrderSize = OrderSize/2//+1
   if ordersize<1 then
    ordersize=1
   ENDIF
 ELSIF PositionPerf(1) > 0 THEN
  OrderSize =OrderSize+2
 ENDIF
// Si la primera barra del día de 5 min es negativa, vendemos.
 sellshort ordersize*n shares at market
 endif
endif

SET STOP ploss 5
SET TARGET pPROFIT 10

 

Download
Filename: intraday-DAX-5minutes.itf
Downloads: 922
Raul Vg
Raul Vg Senior
As an architect of digital worlds, my own description remains a mystery. Think of me as an undeclared variable, existing somewhere in the code.
Author’s Profile

Comments

Bobbi
7 years ago
#

Hola y gracias por compartir! Descubrí que en 5 minutos teníamos algo muy bueno! Pero no en el buen sentido del mercado ... ¿es posible devolver las compras / ventas para hacer pedidos positivos? Gracias de antemano

Dominik
9 years ago
#

Hola Raul ... it looks wonderful :-) Why does it not work if I use less than 100,000 € capital? For example 10,000 €

Nacho
10 years ago
#

Buenos días Raul, tengo puesto este sistema desde hace unos días en una cuenta demo en la versión 10.3 de proreal y no coincide el Backtest con las operaciones que lleva hechas ¿Sabes a que se debe? Se supone que con la versión 10.3 los backtest son fiables.

 

Muchas gracias.

larouedegann
10 years ago
#

Bonjour Nicolas,

comment se fait-il qu'avec cette stratégie stop loss à 5 pips, PRT mettant le stop à 17 pips ???????

sur 42 contrats,ça fait mal.y a t-il une explication ?les ordres étant passés en même temps(achat-vente    stop  limite)

Personnellement je ne comprends pas

Nicolas
10 years ago
#

For everyone information, a discussion thread is ongoing here: https://www.prorealcode.com/topic/5-min-mini1e-dax-spread-1/

This is where you'll find last versions and debate about this intraday trading strategy.

Raul Vg
10 years ago
#

Hi alemaliz,

In the IG broker, the minimum trailing stop is 5 with the open market.

 

alemaliz
10 years ago
#

Hello Raul vg the minimum stop on the Dax and mini 1 and not to 18 points how do you insert

SET STOP ptrailing 5
Orders will be refused all I deleted

jonjon
10 years ago
#

All. These are the results with the version of the code I posted above. I know the code has changed but I have been asked for the results with a stop of 5.

Stop 5, Target 10: initial equity of EUR10k is too small. You have a max drawdown of EUR9063 and the strategy stops in Feb 2014. If you increase starting equity to EUR20k, strategy moves into profit from approx Q2 2014. It does really well but you have to be comfortable with the drawdown. Obviously returns aren't as high as you have doubled starting equity.

 

Stop 5, Target 12: Starting equity of 10k. Works OK. Drawdown of 6,014 (so more than when stop is 3). Makes more overall (+968% over the 4 years). Winning trades 35.62%, G/L 1.5, Loss of worst trade 1,651.

Overall, if you are just concerned with the total gain over the 4 years, stop 5 & target 12 is better. However I wasn't happy with the drawdown. The strategy "ticks along" through 2013 no matter what the settings (either small gain or, in most cases, loss). I optimised and walked forward from 2013 and I decided on Stop 3, Target 12. I was tempted with Stop 4, Target 10 (Gain 976%, % winning 36%, G/L 1.75) however had drawdown 5,834 and in particular had a worse year in 2013.

Hope this is of use.

 

Raul Vg
10 years ago
#

I have created a post in the English forum to share the images. Can you try the backtest 4 years with the code forum? Has a trailing and how input is different.

Nicolas
10 years ago
#

Better to give the URL of your post: https://www.prorealcode.com/topic/5-min-mini1e-dax-spread-1/

Alco
10 years ago
#

Like today, I used the code you posted yesterday on a demo account. I have a €5 loss. But in the v10.3 backtest it shows a win of 14 pips.

Raul Vg
10 years ago
#

Yes, I have noticed, has been because in backtest the openings and closures are perfect and live if there are fast movements are delayed, if you look at the price of entry in the backtest is different from the live entry. Plus today has been a day that has just gone up 5 points, this is scalping :( To solve this problem, I have modified the code. You have it in these last comments, instead of opening directly, it creates opening orders. I will create in the forum a topic.

Alco
10 years ago
#

Hi  Raul! Thanks for your strategy. Looks very promising! Maybe you could make a topic for this strategy so we can post and share results easily.

Raul Vg
10 years ago
#

with other accumulator:

// Definición de los parámetros del código
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada

DEFPARAM FlatAfter =172900

once ordersize=1

HoraEntradaLimite = 090600

HoraInicio = 090500

if Ordersize>50 then
Ordersize=10
endif
if Time >= HoraInicio and time <= HoraEntradaLimite then


// Condiciones de entrada de posiciones cortas
c1 = open < close-2
if not onmarket then
IF c1 THEN
IF PositionPerf(1) < 0 THEN
OrderSize = OrderSize-1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
ENDIF
endif
buy ordersize shares AT close[1]+2 stop
endif

c2= open > close-1

IF c2 THEN
iF PositionPerf(1) < 0 THEN
OrderSize = OrderSize-1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
endif
ENDIF
sellshort ordersize shares AT close[1]-2 stop
endif
endif
endif


SET STOP ptrailing 5

 

Raul Vg
10 years ago
#

Hi, I made the small changes in programming. Now, instead of launching the purchase or sale just after finishing the first 5 minutes, what it does is to launch a purchase order 2 points above the closing if it is positive, a sales order of the points below the closing Yes Is negative.

// Definición de los parámetros del código
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada

DEFPARAM FlatAfter =173000

once ordersize=1

HoraEntradaLimite = 090600

HoraInicio = 090500

if Ordersize>15 then
Ordersize=15
endif



if Time >= HoraInicio and time <= HoraEntradaLimite then



c1 = open < close-2
if not onmarket then
IF c1 THEN
IF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2//+1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
ENDIF
endif
buy ordersize*6 contract AT close[1]+2 stop
endif

c2= open > close-1

IF c2 THEN
iF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2//+1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
endif
ENDIF
sellshort ordersize*6 contract AT close[1]+2 stop
endif
endif
endif




SET STOP ptrailing 5

 

jonjon
10 years ago
#

The code is no different to Raul's above. Here it is again (with a few bits translated into English by Google). I thought it would be useful to attach the screenshot of the equity curve or the Backtest Report for everyone however I didn't know it wasn't allowed in the comments. 

 

// Definition of parameters
DEFPARAM CumulateOrders = false // No accumulation of orders

// The position is closed at 4:30 p.m., local market time (London).
DEFPARAM FlatAfter =162900

once ordersize=1
// No new positions after the candle closes at 08:06
EndTime = 080600
// Market analysis starts in the candle 5 minutes closes at 08:05
StartTime = 080500

// Max orders
if Ordersize>11 then
Ordersize=11
endif

// Risk & multiplier contracts

n=1

// Conditions for analysis

if Time >= StartTime and time <= EndTime then

// Conditions to enter long positions

c1 = open < closeO-1
IF c1 THEN
IF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2//+1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
endif
// If the first day of 5 bar min is positive, we buy
buy ordersize*n shares at market
endif

// Conditions to enter short positions

c2= open > close-1
IF c2 THEN
iF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2//+1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
ENDIF
// If the first day of 5 bar min is positive, we sell.
sellshort ordersize*n shares at market
endif
endif

SET STOP ploss 3 //5
SET TARGET pPROFIT 12 //10

 

jonjon
10 years ago
#

Hi Raul

I would be happy to email you the screenshots (it's the least I could do for you sharing the strategy).

Noted re: minimum stop size of 4 for you. I wouldn't be surprised if I had the same. We'll see.

I'll run the backtest again with a stop of 5 and will post below.

Raul Vg
10 years ago
#

The smallest stop loss allowed by my broker in the DAX is 4 points

Raul Vg
10 years ago
#

Would you try using a 5-point trailing? If I tell you my email, could you send me screenshots?

jonjon
10 years ago
#

You can see clearly from the equity curve what you mean by whole months of nothing going on...just ticking along with small losses, then on a number occasions there is a run of 6+ winners in a row and then there is a nice spike up in profits. Almost like steps is you see what I mean. I would say approximately 20 of these "steps", followed by a "quiet period" of small losses, then another "step"

Raul Vg
10 years ago
#

Yes, basically it is that, when there is no series of winning days, stay stable or with few losses, but the moment you chain a few days winners, they increase profits a lot.

CN
CN
10 years ago
#

Just copy-paste the code, you cant add a file to the comments.

jonjon
10 years ago
#

I've backtestest from 2 Jan 2013 until 20 Dec 2016 (just for making forward testing nice and neat 4 1-year periods). It's almost 200,000 bars. I can't attach files when I take a screen shot and I have even downloaded SnapMyScreen.

I've made a few changes to your first code (where the order size is reduced by /2). I've limited ordersize to 11 to be conservative. Also focused on minimising max drawdown.

n=1, Ordersize = 11, Stop = 3, Target = 12 (I know, the stop may be too close and I could miss profitable moves). I'll see how it goes and may go back to a stop of 5. Spread 1. I'm also including an Order Fee of EUR1 / contract.

Results seem promising: Gain 787.09%, % winning trades 26.54%, Gain/Loss 1.75, Max Drawdown 3,886. As to be expected a brilliant performance in Q4 2016 with nearly EUR30k profits (all building up to this). So far this year just seems to be "ticking over" with small losses.

I'll attach files when I can. It always says "HTTP error". 

Hope this helps.

 

Raul Vg
10 years ago
#

jon no, bin, sorry

Bin
Bin
10 years ago
#

Thanks for your share, really amazing result, will try it immediately. But how come the result from 2016 DEC to now is not good as before.

Raul Vg
10 years ago
#

Hi jon. Yes, but look at the backtest as there are whole months going flat as of January and February 2016. Or in September, there isn´t strategy (at least that I know) that of a perfect money evolution, but at least in this when you lose, you lose little and when you win, the profits soar. I'm looking for someone with 200,000 bars to see how it behaves earlier and see if it's a solid strategy.

jonjon
10 years ago
#

Thanks Raul. I get it mathematically now. Just slow getting my head around it after too much screen time. A big thing I wasn't factoring in (even though it was in plain sight) is the difference in the target (10) and stop (5).

As I said, I wasn't trying to be pedantic or difficult.

Thanks again. Great strategy.

Eric
10 years ago
#

let us know if you get any slippage with real money

ProRealCode ProRealCode
Loading...