Optimization moving average crossing strategy

Viewing 15 posts - 61 through 75 (of 186 total)
  • Author
    Posts
  • #126008 quote
    rsd001
    Participant
    New

    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

    #126034 quote
    GraHal
    Participant
    Master

    Can 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

    #126054 quote
    nonetheless
    Participant
    Master

    Hi @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.

    rsd001 and SILVERFOX29N thanked this post
    #126738 quote
    rsd001
    Participant
    New

    I 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?

    #126739 quote
    GraHal
    Participant
    Master

    its 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.

    #129233 quote
    ViSi0nZ
    Participant
    Junior

    Hi 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.

    GBPAUD-Equity-Curve.png GBPAUD-Equity-Curve.png
    #129235 quote
    ViSi0nZ
    Participant
    Junior

    For some odd reason, the first attachment isn’t readily seen on my previous post, therefore I am posting it here.

    Apologies in advance.

    GBPAUD-Strat.png GBPAUD-Strat.png
    #129251 quote
    GraHal
    Participant
    Master

    Does 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??

    #129290 quote
    nonetheless
    Participant
    Master

    how 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.

    wAFR = exponentialaverage[30](AFR)  ///for smoothing the AFR, to reduce market noice
    wAFRv2 = exponentialaverage[30](AFRv2)  ///for smoothing the AFRv2, to reduce market noice

    In 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.

    #129651 quote
    Sebastian Arsjo
    Participant
    Junior

    Something 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

    DAX-MOVA.jpg DAX-MOVA.jpg DAX-1H-24H.itf
    #129657 quote
    nonetheless
    Participant
    Master

    Here’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.

    Sebastian Arsjo thanked this post
    DJ-5m-Corona-OTD-WF.jpg DJ-5m-Corona-OTD-WF.jpg DJ-5m-Corona-OTD-bcd.jpg DJ-5m-Corona-OTD-bcd.jpg Corona-OTD.itf
    #129662 quote
    nonetheless
    Participant
    Master
    #129667 quote
    nonetheless
    Participant
    Master

    And I know you like micro-trend TFs, so @GraHal, this one’s for you (not OTD)

    eckaw, GraHal and swedshare thanked this post
    DJ-10s-Corona.itf DJ-10s-Corona.jpg DJ-10s-Corona.jpg
    #129674 quote
    nonetheless
    Participant
    Master

    Here’s the code I added

    Ctime = time >=080000 and time <100000
    
    ONCE MAType = MAType
    ONCE MATypeV2 = MATypeV2
    once Period = 15  //period1
    once Period2 = 15 // period2
    Series = (open+high+low+Close)/4  // close type = Total
    Seriesv2 = (open+high+low+Close)/4 // close type = Total
    OTD = Barindex - TradeIndex(1) > IntradayBarIndex  // Add OTD to entry conditions for One Trade per Day
    
    TIMEFRAME(x minutes)// typically 2x or 3x default TF
    ST1 = 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 OPTIMIZE
    lengthRSI = 14 //RSI period
    lengthStoch = 14 //Stochastic period
    smoothK = 10 //Smooth signal of stochastic RSI
    smoothD = 3 //Smooth signal of smoothed stochastic RSI
    myRSI = RSI[lengthRSI](close)
    MinRSI = lowest[lengthStoch](myrsi)
    MaxRSI = highest[lengthStoch](myrsi)
    StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)
    K2 = average[smoothK](stochrsi)*100
    D2 = average[smoothD](K2)
    cnd7 = K2>D2
    cnd8 = K2<D2
    
    mx2 = average[mc, mc2](close)
    cnd9 = mx2 > mx2[1]
    cnd10 = mx2 < mx2[1]
    
    CndB = cnd1 and cnd3 and cnd5 and cnd7 and cnd9
    CndS = cnd2 and cnd4 and cnd6 and cnd8 and cnd10
    
    //Profit and Loss
    SL = sl  // % STOP LOSS
    TP = tp   //% TARGET PROFIT
    TST = tst //%trailing start
    ST = st   //% trailing step
    
    #129701 quote
    bertrandpinoy
    Participant
    Veteran

    it is not necessary to insert the values : mb; mb2; mc; mc2?
    inside the code?

Viewing 15 posts - 61 through 75 (of 186 total)
  • You must be logged in to reply to this topic.

Optimization moving average crossing strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 185 replies,
has 11 voices, and was last updated by slevinkelevra
3 years, 12 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/20/2020
Status: Active
Attachments: 66 files
Logo Logo
Loading...