@ all , @raul Vg
Good afternoon guys,
Something new?
I discussed the problem last Thursday with the PRT development team. Having the exact same behavior as the IG server trailing stop is quite difficult. I know they are working hard to make it more realistic, thanks to the feedback from members.
@ all
I think the tick-to-tick problem is already solved. Today I have put in the demo account the rogot and it coincides with the movement that simulates
I’ve been checking for several days. Still fails with both trailing and normal stop and take.
Here are Live vs Backtest results for a 1s timeframe. Overall it throws up more questions than answers. As this is being run on a 1s TF the manually coded trailing stop should update quickly and keep up with the market movement (I hope). However there are a few problems:
1)Only one trade is taken in Live on the 8th, after that, no further trades are executed in Live for the next week which is really strange.
2) The trades for the 8th don’t match up – but that could be because for some reason the backtest takes multiple positions (opening and closing) starting from 08.05 whereas Live only takes 1 position.
3) The last trade on the 8th – exit @ 080602- matches up perfectly. But that could be a coincidence.
There is still some problem with the tick by tick backtest engine it seems unless someone can spot what the problem is.
// 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 =163000
once ordersize=1
// No se abren nuevas posiciones después de la vela que se cierra a las 09:06
if time=080000 then
val0800=close
endif
if time=080500 then
val0805=close
endif
HoraEntradaLimite = 080559//080600
// El análisis de mercado empieza en la vela de 5 minutos que cierra a las 09:05
HoraInicio = 080500
// Órdenes máximas
if Ordersize>18 then
Ordersize=18
endif
// Riesgo, multiplicador de contratos.
n=4//6
// Condiciones para el analisis.
if Time >= HoraInicio and time <= HoraEntradaLimite then
// Condiciones de entrada de posiciones largas.
c1 = val0800 < val0805-1//open < close-1
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
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= val0800 > val0805-1//open > close-1
if not onmarket then
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
endif
endif
//trailing stop function
trailingstart = 5 //trailing will start @trailinstart points profit
trailingstep = 1 //trailing step to move the "stoploss"
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
newSL = tradeprice(1)+trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
newSL = newSL+trailingstep*pipsize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
newSL = tradeprice(1)-trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
newSL = newSL-trailingstep*pipsize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
SET STOP PLOSS 5.5
FYI, some modifications have been made to the backtest engine and are already available in the current platform version. The fix about the accuracy of backtests and the IG trailing stop should come in March.
@nicolas
In the current version 10.3 demo account ? thanks
@manuele
It’s now live, so it should have been pushed in demo and real account.
does anybody trades this strategie in dax in live ?
what is your minimum stop distance ? does it works well ?
In france we have 18 point distance stop in live and 5 point distance stop in demo ….
in demo everything is working very well but i dont know if it will works in live ….
i would know if your distance is more than 5 point if the strategy works well in live .
@ Paris. Hi – I have been running the 1s strategy live for a while now. The last few days it has worked well and performed as it should with the trailing stop updating 1 point at a time as in the code. However, it does still have some issues that I’ve still not got to the bottom of. It will need a couple of weeks more data before I can pass judgement as to how effective it is. I will post updates once I have a more fuller set of results.
ok manel thanks i will see your 1 s strategie …
I was referring to the 1s strategy only by the way. I have been running the others in live as well but the results are mixed so far, pretty flat overall. I am still evaluating them to see which are worth pursuing and/or amending.
here in france we have a new law that has just coming out and it change a lot , so i think it is better to continue the discussion in french forum cause it is very specific to our country .