Good afternoon , during my system in real i received a loss but in the backtest there is a profit using tick by tick test , very strange and serious problem
on the Wallstreet cash , spread 2 pt and time frame 5 min,
Prorealtime can give me some explanation please ?
FOllow the code and attached the screenshot operation in live and in the backtest
//-------------------------------------------------------------------------
// Codice principale : SECONDA_BAR_DAX 5minutes
//-------------------------------------------------------------------------
//// si acuista la seconda barra dopo le h9.05 target 4punti in direzione della prima
/////in test in live
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada
DEFPARAM FlatAfter =173000
// No se abren nuevas posiciones después de la vela que se cierra a las 09:06
HoraEntradaLimite = 153600
// El análisis de mercado empieza en la vela de 5 minutos que cierra a las 09:05
HoraInicio = 153500
n=1
//trend = Dclose(1)<Dclose(2)
outside = high>high[1] and low<low[1]
//blackhammer = close>open and (high-close)<2 and (open-low)>=3*(close-open)
whitehammer = close>open and (low-open)<2 and (high-close)>=3*(close-open)
if range > 35 then
positive = high-close>5
else
positive = high-close>1
endif /// Molto signficativa nel periodo estivo
hammer2 = open>close and (close-low>10) and (open-close)<5
/// STOP 1° gennaio // intervento provvisorio
if Time >= HoraInicio and time <= HoraEntradaLimite and not outside then
// Condiciones de entrada de posiciones largas.
c1 = open < close-1
IF c1 and not whitehammer and positive THEN
BUY n contract AT close+1*pointsize LIMIT
//buy n shares at market
endif
// Condiciones de entrada de posiciones cortas.
c2= open > close-1
IF c2 and not outside and not hammer2 then
//sellshort n shares at market
sellshort n contract AT close-1*pointsize LIMIT
endif
endif
if longonmarket then
sell at low stop
endif
if shortonmarket then
exitshort at high stop
endif
SET TARGET pPROFIT 3.8
To write code, please use the <> “insert PRT code” button, in order to make code more readable, thus making members more willing to help.
You should apply PRT directly, or your Broker.
I can test it on my demo account if you tell me the date when the problem occurred.
Also, the version you posted refers DAX, while you wrote about WALLSTREET CASH (10), which one should be tested upon?
Roberto
HI ROberto
sorry not consider the description in the code , the code worked on wallstreet cash 10E .
The problem occurred today at 15.35
I attached another picture to explain better
REgards
My test was in profit at 15:35, like yours. Oddly enough I got a profit of 7.5 pips, instead of 3.8 as your strategy seems to have set.
I don’t know what could have happened, because slippage can occur quite often, sure in terms of a few decimals, not twice as much! But you should notice that 15:35 is quite around the “opening bell” and sudden spikes may sometimes occur, in such a case slippage could easily top your planned profit/loss (when, like in this case, you’re scalping).
Unfortunately I am not aware of the mechanics of trade management by IG.
It is unfortunately the case that the differences between the PRT backtest world and the real world mean that writing small pip scalping strategies on PRT is virtually impossible. Even when creating longer term strategies you have to be wary that if they only have a slight edge in PRT backtest or demo then they will likely fail in the real world. Only very robust strategies stand any chance.
Thanks for the contribution .
but I think the very problem is to the backtest rappresentation :
the close of the position should be at the previous high as a real trade .
In the backtest the close is the profit in the next bar …
My doubt is not on the loss taken in real because is correct , My doubt is the backtest that show the wrong result .
regards.
I think the backtest is fine, I outlined the SETUP candlestick and the HIGH to wich the SL is set and it is NEVER hit, so the strategy takes its profit as planned.
I don’t know what happend in real market, but the backtest sounds fine!
Most likely a sudden momentary expansion in spread in the real world that was never seen on the backtest.
That is a big problem with PRT. In live trading happen strange things. For example one of my strategies went long in the FTSE 7th dec. For no reason the trade was close on the morning of the 15th dec. It closed with a profit but it should simply have stayed open. When I now run a backtest of the same strategy it is still in the trade today with a big profit.
And that are just trades like these that most strategies need to be successful. Once in a while they are right and then you want them to milk as much out of the trade as possible and not close prematurely. Cutting such winners short can ruin the whole performance of a strategy.
Asking for an explanation from PRT results only in silence. 🙁
I’ve had exactly the same thing happen to me as you did Despair – except I was on the rough end of the deal. In demo the trade stayed open and went on to close for a small profit – in the real world I took a £250 hit. It was best to be no where near me on that day.