@Dave.
Results seems to be very good. And maybe too good to be true. How many 0 bars when the position close in this backtest ?
Could you insert the code so we can try to understand if results are realistic.
DaveParticipant
Senior
@enzo, done simply with a 50 trailing stop. As humans we always try to make things complex!. 🙂
@sofitech, as you can see in the image, no 0 bars.maybe it is too good to be true given my more than basic programming skills!. I’m mobile so can’t post the code yet for fear of reprimand from @nicolas who has to keep correcting:-)… Maybe later from PC.
Dave
Hey!
Can someone upload the file? I cant get it to work if I copy the code?
DaveParticipant
Senior
Ok, here it is for you to try. Be kind enough to feedback how it performs longer term as I don’t have any historic data to work with. If it performs well then maybe I’ll get some fame if @Nicolas considers it for the library?. Any ideas for improvement are also welcome although I would probably need help to implement it!.
Dave
(Test was done on DAX daily – I read on here recently “why does everybody trade DAX” – Simple = Volatility!)
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
//DEFPARAM FLATBEFORE = 080000
//DEFPARAM FLATAFTER = 180000
//takeprofit = 50 //takeprofit in points
//stoploss = 100 //stoploss in points
fastma = ExponentialAverage[75](close)
slowma = ExponentialAverage[195](close)
//fastma bullish and bearish conditions
fastbullish = fastma>fastma[1] and fastma[1]<fastma[3] and fastma>slowma
fastbearish = fastma<fastma[1] and fastma[1]>fastma[3] and fastma<slowma
//conditions for long = fast ma ABOVE slow ma and turning in agreement with slow ma trend
if not longonmarket and fastbullish then
buy 10 share at market
endif
//conditions for short = fast ma BELOW slow ma and in agreement with slow ma trend
if not shortonmarket and fastbearish then
sellshort 10 share at market
endif
//set target pprofit takeprofit
//set stop ploss stoploss
set stop ptrailing 50
HI GUYS, I DID NOT BACKTEST ABOUT STRATEGY, JUST I FOUND THE RIGHT SETTING ABOUT PRINCIPAL TREND WITH THE CROSSES OF 2 EMA (75 AND 195) (NOT GREEN AND RED ) THEN I WONTED ANOTHER MOVING AVERAGE FOR TO GO ONLY SHORT WHEN PRINCIPAL TREND WAS DOWN AND GO LONG WHEN PRINCIPAL TREND WAS UP.
DAVE DID ANOTHER SYSTEM THAT WORKS GREAT ….
I THINK FOR IMPROVED THE RESULT TO DO A POSITION SIZE TOO ABOUT 2% OF CAPITAL
I TRAIED THE TS..BUT SEEM DOES NOT WORK..
Thanks Dave
This is how it looks when I backtest it with v10.3 live. Dosen´t seem to work…
DaveParticipant
Senior
I’m on 10.2 whether that has an effect on it, I’m not sure?.As you can see the code is pretty simple so cannot explain it.
Dave
DaveParticipant
Senior
@Enzo,sofitech,joachim.
Now I’m on 10.3 I’ve had a look at the code and got it working. As predicted, the results are not favourable, on one test only making £300/10yrs! and most of the others negative. I think beacause the large ma’s are so flat it could not initiate a trade without increasing lookback. Fast ma’s with little lag perform much better with the code as they need to reflect PA on whichever timeframe your using. Dave