Took the last code from this post: https://www.prorealcode.com/topic/5-min-mini1e-dax-spread-1/page/3/#post-21815
Modified the code to be lightweight with only useful code, don’t know if it’s the last version, but this kind of coding should be used in your future development, to gain some time while backtesting:
// 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
Margin = 60
Lottfree = 0
orderSize = max(1,1+ROUND((strategyprofit-lottfree)/Margin))
ordersize=min(18,ordersize)
n=1
if Time >= HoraInicio and time <= HoraEntradaLimite then
if not onmarket then
c1 = open < close-2*pointsize
c2= open > close-1*pointsize
IF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2
ELSIF PositionPerf(1)> 0 THEN
OrderSize =OrderSize+2
endif
ordersize=max(ordersize,1)
IF c1 THEN
buy ordersize*n contract AT close+2 stop
endif
IF c2 THEN
sellshort ordersize*n contract AT close-1 stop
endif
endif
endif
SET STOP ptrailing 5
AlcoParticipant
Senior
@jonjon
Dow has a minimum 9 pip SL.
AlcoParticipant
Senior
@jonjon
Oh wait, sorry I got it wrong. It has a minimum 9 pip SL before opening. After opening it has a minimum of 6 pip SL.
@Alco. That sounds better. I’ll try getting the data. I actually trade the Dow anyway (I’m currently trading through X_Trader and chart through eSignal). The equivalent contract on PRT to what I trade is the Mini DJ30 Full0317 Future. Hopefully this is similar to the prices you get.
I’ll let you know how it goes.
BCParticipant
Master
Hi Nicolas
Is it possible Live trade with “ptrailing” function with V10.2?
Thanks
@Bin
Yes of course, the reason why people are complaining about it, is about the lack of reliability into backtest in version pre 10.2 and the “0 bar” phenomena.
Hello guys,
First of all, Grandisimo trabajo Raul,
Next…
This is only an idea, I tried the strategy in 15 minutes timeframe, only changing some data (attach shot3). I have compared the both timeframe in the last year (small backtest) and the results were sightly diferent.
I changed the code to start both system with only one contract for really small accounts (sadly my case)
As you can see, the drawdown is very similar but gains not
So, what’s your opinion
HappyTrading
// Definición de los parámetros del código
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada
DEFPARAM FlatAfter =173000
once ordersize=1
HoraEntradaLimite = 091600
HoraInicio = 091500
Margin = 60
Lottfree = 0
orderSize = max(1,1+ROUND((strategyprofit-lottfree)/Margin))
if Ordersize>18 then
Ordersize=180
endif
n=1
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*n contract AT close+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*n contract AT close-1 stop
endif
endif
endif
SET STOP ptrailing 5
Jonjon, Could you pass the backtest from the day of June 2014 that gives you the error until today? Counting that you have it in the dax of 25 € per point, it would have to divide everything between 25.
Hi Carlos, thank you very much, I see in your backtest a benefits curve that is not very attractive and an excessive max drawdown, for example, for the last robot that I have shared the max drawdown is half and profits more than double
The gain / loss ratio is practically half
Thanks for the comment, what capital do you think is the best to start in live account. I would like to get code to start with 2000€ of capital and trying to asuming a real risk
Saludos de Madrid.
Raul – here you go. Your previous code exactly as it was with a trailing stop of 5. Problem seems to be with the data around end June & July 2014. The backtest here is from 1 Aug 2014 until 30 Dec 2016.
Have a good weekend guys. Catch you Monday
@carlos
With the same strategy you are waiting 3 times longer (3 bars of 5 minutes in a 15 minutes timeframe) to place and move stoploss with the trailing stop. As you may already know it, nothing happens between 2 bars in probacktest.
Hi jonjon, Many thanks for your time and for helping me, there is one thing that bothers me, and is that in my backtest of a year and a half earns 33,000euros, and in yours 2 and a half years with a very good profit curve earns 600,000 / 25 = 24,000 euros. I do not understand how it can be so
Hi,
at this time, for me, the best code is this. I have modified the code posted from nicolas in relation to position size leaving only my position size and optimizing the best position trade in max 38 lots. Thanks
// 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
HoraEntradaLimite = 090600
HoraInicio = 090500
Margin = 60
Lottfree = 0
orderSize = max(1,1+ROUND((strategyprofit-lottfree)/Margin))
ordersize=min(38,ordersize)
n=1
if Time >= HoraInicio and time <= HoraEntradaLimite then
if not onmarket then
c1 = open < close-2*pointsize
c2= open > close-1*pointsize
IF c1 THEN
buy ordersize*n contract AT close+2 stop
endif
IF c2 THEN
sellshort ordersize*n contract AT close-1 stop
endif
endif
endif
SET STOP ptrailing 5
Thanks