I backtested it (excl spread) and it had good results (8% gain during 2 sept – 13 sept), see attachment
What did happen was that is created in backtesting many small orders which are not generated if you are in auto trading. So this is lowering the result if you test with spread.
So i adjusted the stop loss (see code below)
I just run it now in auto trading (demo environment) with good results so far (see attachment).
Keep you posted after the opening to at 15:30 CET
DEFPARAM CumulateOrders = FALSE
// Russell 2000
// Timeframe 1 min
// INPUT
STARTTIME = 000000
ENDTIME = 220000
EURO = 1.10989
EXPOEURO = 7500
PRO = 0.04
LOS = 0.2
// CALCULATIONS
MAXLOSS = ((EXPOEURO / 100) * -5)
EXPOSURE = (EXPOEURO * EURO)
TRAIL = LOS * (EXPOSURE /100)
NUMBEROFCONTRACTS = (EXPOSURE / Open ) * (1 / POINTVALUE)
// CONDITIONS
NOTTRADING = not onmarket
WINDOW = currenttime >= starttime and currenttime <= endtime
SAMEBAR = tradeindex = barindex
OTHERBAR = tradeindex < barindex
MOREPROFIT = strategyprofit >= strategyprofit[1]
LESSPROFIT = strategyprofit < strategyprofit[1]
NOPROFIT = strategyprofit = 0
LASTLONG = longonmarket[1]
LASTSHORT = shortonmarket[1]
CURRENTshort = (Average[20](close) >= Average[50](close))
CURRENTlong = (Average[20](close) < Average[50](close))
FIRSTORDER = NOTTRADING and window and NOPROFIT
CONTINUELONG = NOTTRADING and window and OTHERBAR and MOREPROFIT and LASTLONG
SWITCHLONG = NOTTRADING and window and OTHERBAR and LESSPROFIT and LASTSHORT
SWITCHSHORT = NOTTRADING and window and OTHERBAR and LESSPROFIT and LASTLONG
CONTINUESHORT = NOTTRADING and window and OTHERBAR and MOREPROFIT and LASTSHORT
CONTINUESAMEBAR = NOTTRADING and window and SAMEBAR
CONTINUELONGINBAR = CONTINUESAMEBAR and CURRENTLONG
CONTINUESHORTINBAR = CONTINUESAMEBAR and CURRENTSHORT
if not firstorder and not continuelong and not switchlong and not switchshort and not continueshort and not continuelonginbar and not continueshortinbar then
CONTINUELONG = NOTTRADING and window and OTHERBAR and CURRENTlong
CONTINUESHORT = NOTTRADING and window and OTHERBAR and CURRENTshort
endif
if FIRSTORDER or CONTINUELONG or SWITCHLONG or CONTINUELONGINBAR then
Buy NUMBEROFCONTRACTS CONTRACTS AT MARKET
endif
if SWITCHSHORT or CONTINUESHORT or CONTINUESHORTINBAR then
SELLSHORT NUMBEROFCONTRACTS CONTRACTS AT MARKET
endif
if strategyprofit < MAXLOSS then
QUIT
endif
// STOPS
SET STOP $TRAILING TRAIL
SET TARGET %PROFIT PRO
//graph window
//graph NOTTRADING
//graph OTHERBAR
//graph SAMEBAR
//graph MOREPROFIT
//graph LESSPROFIT
//graph LASTLONG
//graph LASTSHORT
//graph FIRSTORDER
//graph CONTINUELONG
//graph SWITCHLONG
//graph CONTINUELONGINBAR
//graph SWITCHSHORT
//graph CONTINUESHORT
@SIMONIS, I would like to point out that using only UPPERCASE letters for variable names makes them less readable and a bit more difficult to understand and debug.
Mixing UpperCase and LowerCase letters would be beneficial to readers. Thank you.
Hi Robert,
Sure, next time I will take notice of this.
I am running the earlier mentioned script in demo since 13:00 CET and have very good results, see attachment (Russell 2000 timeframe 1 min)
93% winning trades
gain / loss ratio : 2.37
Doing good in short and long positions.
Take again for your help.
Greetings Hubert
@SIMONIS I made a few minor changes and I got attached on 10 sec TF at spread = 2 (trades times are daytime only).
Judging from the equity curve it needs some work doing on the sellshort and / or the exitshort?? See the red arrowheads for an example … the trade stayed short all through that rise in price.
Apologies if I screwed your code to get the results above?
For what it’s worth … attached is the .itf I used to get above curve.
Curve attached (using .itf attached) is even slightly better as I was using the capture above was with the Vonasi VRT Tester.
Hi GraHal,
Thanks for your update.
From the updated script I can’t see the values your are using for A83 / A84 ? Can you clarify ?
Any reason for not using Trailing stop ? Performs much better.
Thanks
I can’t see the values your are using for A83 / A84
Aren’t values for A83 and A84 shown in the optimiser?
I wanted to get a feel for the levels of gain and loss that this System could provide so I ditched Trailing Stop and often trails don’t work as well anyway?
It’s a flexible System! 🙂 Here’s another version I’ve cocked up! 🙂
I also VRT tested it … 3rd image attached