Hi all,
I know I must be doing something stupid but I just cant get any of the strategies to show me any backtest results. First of all I go to an open chart, say DAX, and click the drop down menu next to the button with a chart and a plus next to it. On the Backtesting & automatic trading tab, I then click new, then select the “Creation by programming” tab and paste in the copied code. Finally I click “ProBacktest my strategy.
The backtest seems to run but the open trades are usally alway 0 and if they are not then any trade that has been opened always ends up as even. There is never any winning or losing trades to view.
I’d be very grateful for your help! Thanks!
Easiest is to post your code on here and I’ll run it for you on my Platform.
I’ve had this in the past and it’s a very simple reason, but I’m blowed if I can recall what it was!? 🙂
The 0 bars may be because you have not got tick by tick mode selected?
I guess you have tried a few different Timeframes and markets / instruments?
Thanks for the reply, I’m very grateful. The code I’m using is below. No I havent tried any different time frames but as it’s a DAX breakout, I’ve only tried it with the DAX. Thanks again.
DEFPARAM FLATBEFORE=090100
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = false // Kumulieren von Positionen deaktiviert
// einmalige werte
once size = 1
once profi = 20
once in = 1
once korrek = 1
sl = 35
// Verhindert das Trading an bestimmten Wochentagen
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
noEntryAfterTime = 100000
timeEnterAfter = time < noEntryAfterTime
// einen trade nur
IF (CurrentTime = 010000) then
onetrade= 0
ENDIF
// Bedingungen zum Einstieg in Long-Positionen
IF (CurrentTime = 085900) then
high7= HIGHEST[120](high)
low7= LOWEST[120](low)
ENDIF
IF (close > high7) AND (CurrentTime >= 090100) then
onetrade= 1
ENDIF
IF (CurrentTime >= 090100) AND not daysForbiddenEntry AND (onetrade = 0) AND timeEnterAfter THEN
BUY size CONTRACT AT high7 STOP
ENDIF
IF (LONGONMARKET = 1) then
onetrade= 1
in= 1
korrek= 0
//l1 = POSITIONPRICE + 0.0008
l2= POSITIONPRICE - sl
//sell at l1 LIMIT
sell at l2 stop
ENDIF
// Bedingungen zum Einstieg in Short-Positionen
IF close < low7 AND (CurrentTime >= 090100) then
onetrade= 1
ENDIF
IF (CurrentTime >= 090100) AND not daysForbiddenEntry AND (onetrade = 0) AND timeEnterAfter THEN
SELLSHORT size CONTRACT AT low7 STOP
ENDIF
IF (SHORTONMARKET = 1) then
onetrade= 1
in= 1
korrek= 0
//s1 = POSITIONPRICE - 0.0008
s2= POSITIONPRICE + sl
//EXITSHORT at s1 LIMIT
EXITSHORT at s2 STOP
ENDIF
// korrektur
IF (LONGONMARKET < 1) AND (SHORTONMARKET < 1) then
in= 0
ENDIF
IF in = 0 and korrek = 0 then
d1= POSITIONPERF(1) > 0
d2= POSITIONPERF(1) < 0
IF d1 and size > 1 then
size = size - 1
korrek = 1
ELSIF d2 then
size = size + 1
korrek = 1
ENDIF
ENDIF
// Stops und Targets
SET STOP pLOSS 60
SET TARGET pPROFIT sl
// Performance
IF STRATEGYPROFIT > profi then
size= 1
profi= profi + 20
ENDIF
I got it going on 1 min TF and it looks very promising!
I see you’ve been trying to get it going on Daily, but you are Flat Before 090100 and no trades after 100000 so you miss the Daily Open at 000000 every day.
Try rejigging your time constraints or better still work it as a lower TF Strategy??
PS Always use that blue PRC icon Insert PRT Code to add code to a post then you get it formatted all nice and friendly like! 🙂
Thanks, but I still can’t get it to work. How are you altering the TF? On the actual chart before clicking the button?
Yes on the Chart as shown by red arrow on attached.
If you are running it on daily time frame then any time criteria will not be met so you will get no trades.