Optimization moving average crossing strategy
Forums › ProRealTime English forum › ProOrder support › Optimization moving average crossing strategy
- This topic has 185 replies, 11 voices, and was last updated 2 years ago by
slevinkelevra.
-
-
04/14/2020 at 1:00 AM #126008
hi Nonetheless,
I have been back tested your 69 cross over strategy for the last week or so and its great.
I have decider to try automated trading and was setting up for th coming week and the program has asked me to remove all variables in the protback test section.
Can you help with this?
Thanks
04/14/2020 at 8:50 AM #126034Can you help with this?
Please don’t go Live with any strategies until you are familiar with everything?
Have you checked under Help on the top menu bar?
Watch the video on the link below, it may answer your questions?
https://www.prorealtime.com/en/videos_tutorial/142_trading_system_backtest_optimization
Also read the PRT Manual on the link below …
https://www.prorealtime.com/en/help-manual/create-trading-systems
04/14/2020 at 10:28 AM #126054Hi @rsd001
A few things to mention: first, I didn’t build this system, I only made some minor modifications and started the discussion. You have @Jan and before him @Laurenzo to thank for doing all the heavy lifting.
Second, as @Grahal says, not a good idea to jump in too fast unless you mean to start running it in demo mode; that’s always a good place to start til you get a feel for how it behaves.
As for removing the variables, that means inserting the values from the optimization window into the body of the code. For example, you need to have (or to find, if it already exists) a couple of lines that say
MAType =
MATypeV2 =
where you put the corresponding numbers that the optimization found for you. Then you have to delete everything from the opt window before you click Prepare for Automatic Trading. Hope that helps.
2 users thanked author for this post.
04/18/2020 at 1:54 PM #126738I appreciate the help.
Im till back testing, and managing to learn slowly.
Im struggling with one area, on my EMA Cossings, Ive got it to work, but for example a 10 mms time frame, its opening on an ema cross over which occurred at 8.00 at 8.20, is there anyway I can get this to happen on the same candle or at least the next one instead of missing the second 10 min candle?
04/18/2020 at 2:08 PM #126739its opening on an ema cross over which occurred at 8.00 at 8.20
Best you provide screen shots of above as otherwise we’ll be guessing what may be the cause?
If you post the exact code that produces what you say above then I would run it for you on my platform and see if I get the same problem?
Others may also spot an issue in the code if you post the code.
05/01/2020 at 3:17 PM #129233Hi Jan / Everyone.
I am new to ProRealTime and the forum, so with this being my first post. Please forgive me.
Great indicator btw, love it.
I found an awesome MA cross on GBPAUD after countless testing on various TF’s etc. I found this by doing the walk forward method which gave me above 50%. After doing some further extensive testing with the periods etc I came to a conclusion with the set up. Ran this set up and it gave me different results. I noticed that this must be down to the EMA which filters noise.
I was wondering how the EMA plays a part in this whole strategy and how it filters out the noise exactly? Does the strategy only enter when the cross happens above the 30EMA or below? How is it playing a part so I can incorporate this into my strategy.
I have attached 3 screenshots.
The first is the comparison between the 2 results.
The left being my current setup which has no EMA incorporated, performs pretty poorly in my honest opinion.
The right is the performance based upon YOUR strategy, with minor tweaks.. such as period change, and a DEFINITIVE set type of EMA’s.
Looking at these you can see that my version is in and out the market more, where as your version is more conservative, presumably down to the EMA playing a part.
Also the timing seems to be off.. with the entries. Both are set to the same time and exit points, but seem to be entering at different times.
One version (e.g. Mine enters sometimes at 8:00, your’s waits and enters at 10:00)Both set to start the backtest at 1st May 2015 however your strategy doesn’t enter it’s first trade until a month later.. on 4th June 2015
Hopefully I have given you enough information to help, and that it’s not too overwhelming.
Many thanks.
05/01/2020 at 3:20 PM #12923505/01/2020 at 4:14 PM #129251Does the lower curve use a ‘crosses over or under’ condition?
Reason I ask : if other conditions are combined with ‘crosses over / under’ then a trade can be a long time coming.
Also I note that while the equity curve was flat so also was the price curve and then it went down and then back up … so this may have given a crosses over trigger?
Both Systems appear to have good performance overall per quarter … judging from the white histo bars??
05/01/2020 at 6:08 PM #129290how the EMA plays a part in this whole strategy and how it filters out the noise exactly?
There is no EMA 30 as such, it’s a 30 period exponential applied to the AFR – ie it averages the selected MAType.
12wAFR = exponentialaverage[30](AFR) ///for smoothing the AFR, to reduce market noicewAFRv2 = exponentialaverage[30](AFRv2) ///for smoothing the AFRv2, to reduce market noiceIn the above code, the brackets are the period and the parenthesis is what it is applied to. A standard EMA would be exponentialaverage[30](close) or (typicalprice).
Looking at your results, there’s a few things that stand out. Like, one shows 11k profit and the other shows 213k. That’s quite a difference, or is MM applied to the second? Also, 66 trades in 5 years seems v low, 1 per month.
05/03/2020 at 9:46 PM #129651Something i found playing around with DAX 1H and Jan’s excellent algo
MiniPos size 2
You can play around and change the time to stop taking trades from 21.00 to lets say 14.00 or change the stop loss from 2% to 2,50% or 1,80 %
It will mostly just affect the number of trades taken but the overall profitability will still be roughly the same. i like it when a change in variables wont brake the entire strategy
I am very new to this so it is probably curve fitted , not back tested in any meaningful way. and it runs very flat for long periods of time so be kind and dont use it LIVE
But maybe someone who is better then me at this things can make something out of it
I like it when people share their work so i mostly just wanted to share something back even if it is not great
05/03/2020 at 9:59 PM #129657Here’s a variation I’ve been working on, adds some of my go-to indicators and another TF. I tried lots of other stuff as well – smooth stochastic, Parabolic SAR etc but this is the best combination I could find. All suggestions welcome.
It keeps @Jan’s excellent OTD idea … but expands it to OTD in multiple time slots. So, you’re looking for 1 trade between 08 – 10, 1 trade 10-12 etc etc. with a different crossing pair for each. I have tried to keep the other variables to a minimum; Supertrend and StochasticRSI stay at their defaults, SL and TP stay at 1% and 2%. The only things I optimise are the 2 MAs (period,type) and the trailing stop although this is optional.
This was designed primarily for short TFs. I’m using it mostly at 5m with 15m in the upper TF but if you don’t mind shorter back tests then 2m/6m and 1m/5m also give good results. Should get you ~90% wins on almost anything you point it at, often higher.
A word of warning: these tend to do very well in WF analysis but v poor in VRT. I don’t know why that is. Maybe it doesn’t work to randomise something that’s only doing one trade per day? After all, if it finds the entry conditions, that’s the trade you’re going to get that day, end of story. Trades are rarely still open the next day. Whatever the reasons, it’s something to be aware of. If you’re hooked on VRT results then this is prob not for you.
Best of luck with it.
1 user thanked author for this post.
05/03/2020 at 10:02 PM #129662Here’s the DJ 5m itfs
1 user thanked author for this post.
05/03/2020 at 10:07 PM #12966705/03/2020 at 10:24 PM #129674Here’s the code I added
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950Ctime = time >=080000 and time <100000ONCE MAType = MATypeONCE MATypeV2 = MATypeV2once Period = 15 //period1once Period2 = 15 // period2Series = (open+high+low+Close)/4 // close type = TotalSeriesv2 = (open+high+low+Close)/4 // close type = TotalOTD = Barindex - TradeIndex(1) > IntradayBarIndex // Add OTD to entry conditions for One Trade per DayTIMEFRAME(x minutes)// typically 2x or 3x default TFST1 = SuperTrend[3,10]//for TF<1m try [2,7]cnd1 = (close > ST1)cnd2 = (close < ST1)mx1 = average[mb, mb2](close)cnd3 = mx1 > mx1[1]cnd4 = mx1 < mx1[1]TIMEFRAME(default)ST2 = SuperTrend[3,10]//for TF<1m try [2,7]cnd5 = (close > ST2)cnd6 = (close < ST2)//Stochastic RSI | indicator // DO NOT OPTIMIZElengthRSI = 14 //RSI periodlengthStoch = 14 //Stochastic periodsmoothK = 10 //Smooth signal of stochastic RSIsmoothD = 3 //Smooth signal of smoothed stochastic RSImyRSI = RSI[lengthRSI](close)MinRSI = lowest[lengthStoch](myrsi)MaxRSI = highest[lengthStoch](myrsi)StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)K2 = average[smoothK](stochrsi)*100D2 = average[smoothD](K2)cnd7 = K2>D2cnd8 = K2<D2mx2 = average[mc, mc2](close)cnd9 = mx2 > mx2[1]cnd10 = mx2 < mx2[1]CndB = cnd1 and cnd3 and cnd5 and cnd7 and cnd9CndS = cnd2 and cnd4 and cnd6 and cnd8 and cnd10//Profit and LossSL = sl // % STOP LOSSTP = tp //% TARGET PROFITTST = tst //%trailing startST = st //% trailing step05/04/2020 at 7:30 AM #129701it is not necessary to insert the values : mb; mb2; mc; mc2?
inside the code? -
AuthorPosts
Find exclusive trading pro-tools on