long-short when Moving average changed color
Forums › ProRealTime English forum › ProOrder support › long-short when Moving average changed color
- This topic has 23 replies, 5 voices, and was last updated 7 years ago by Dave.
-
-
02/02/2017 at 2:20 PM #2360702/02/2017 at 5:20 PM #23642
@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
02/02/2017 at 8:26 PM #23688Hey!
Can someone upload the file? I cant get it to work if I copy the code?
02/03/2017 at 8:32 AM #23727Ok, 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!)
12345678910111213141516171819202122232425262728DEFPARAM CumulateOrders = False // Cumulating positions deactivated//DEFPARAM FLATBEFORE = 080000//DEFPARAM FLATAFTER = 180000//takeprofit = 50 //takeprofit in points//stoploss = 100 //stoploss in pointsfastma = ExponentialAverage[75](close)slowma = ExponentialAverage[195](close)//fastma bullish and bearish conditionsfastbullish = fastma>fastma[1] and fastma[1]<fastma[3] and fastma>slowmafastbearish = 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 trendif not longonmarket and fastbullish thenbuy 10 share at marketendif//conditions for short = fast ma BELOW slow ma and in agreement with slow ma trendif not shortonmarket and fastbearish thensellshort 10 share at marketendif//set target pprofit takeprofit//set stop ploss stoplossset stop ptrailing 5002/03/2017 at 10:51 AM #23751HI 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
02/03/2017 at 11:08 AM #2375202/03/2017 at 1:23 PM #23775Thanks Dave
This is how it looks when I backtest it with v10.3 live. Dosen´t seem to work…
02/03/2017 at 1:31 PM #2377803/01/2017 at 8:45 AM #26758@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
-
AuthorPosts
Find exclusive trading pro-tools on