Wing’s Resistance Breacher (DAX-30m)

Wing’s Resistance Breacher (DAX-30m)

This is a system I made over 6 months ago and have been running live on the DAX 30m. It is based on identifying tops or bottoms in the price. When a breakout from these levels occur it tries to capture the movement, in either direction. It averages 1.55 trades/day and is flat overnight. It employs some simple filters and varied position sizes.

Important things to know:

  • The system is heavily optimized, in that there are many moving parts, but it has performed out of sample since Nov 2, 2016. You may want to optimize it again if you plan on running it.
  • System is backtested on a spread of 1, but 1.3 or so may be more accurate.
  • I have also used similar systems on lower timeframe DAX (10m and 15m), and it can be optimized for other markets.
  • If you do optimize, run an OOS or live demo test before trying to run it live. I take no responsibility what you do with the code (unless you make a profit of course).
  • This system is in many ways a guide on how to NOT program a strategy, but I only want to share systems that I have run live for a long time and trusted with my own money.

I can answer your questions in the comments.

Strategy code:

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Francesco78 • 06/12/2017 #

    Thanks Wing great strategy, I like your position sizing , did you try with other assets?
     

    • Wing • 06/12/2017 #

      Yes, I have tried to trade gold using a strategy like this. It worked, but the spread is not as favorable. FX I have not tried at all.

  2. Francesco78 • 06/12/2017 #

    Thanks, Ill try to check some ccy pairs then.
    Have a nice day

  3. noisette • 06/12/2017 #

    Thanks,
    Very interesting.

  4. Kenneth Kvistad • 06/12/2017 #

    Is it still running good?

    • Wing • 06/12/2017 #

      As it says in description, it has been running live since Nov 2016. Everything after Nov 2 is out of sample, and shows performance so far, which is decent. If it works tomorrow or a year from now? No idea.

  5. torkelab • 06/12/2017 #

    Hi, how many contracts for max/min size? How big should the account size be?

    • Wing • 06/12/2017 #

      The system trades 1 to 3 contracts, and 5 under extreme circumstances. If trading the DAX 1 euro/point then I suggest you have at least 2000 or 3000 euro in your account, considering the system’s past drawdown.

  6. Stefanb • 06/12/2017 #

    Wing
    Can i find you on Twitter?

  7. Toto le Heros • 06/12/2017 #

    Hi Wing,
    Your code looks quite interresting.
    I was wondering if you could develop a bit more on :

    how the system “decides” to trade 1 or 2 or 3 contracts as the code looks a bit complex to me, please
    and if the fact that you are using previous performance positions in it means that your system should be the only one to work on a dedicated instrument
    finally I am not sure I understand the “21h53” exit condition that will execute anyway at 22h00 if I m not mistaken (as the TF is 30 minutes)

    Thanks again and for the time you will take to give answer.

    • stockdemon • 06/12/2017 #

      The larger than sign (>) means that it will trigger at 54 or later, i.e. also 22:00.

  8. Pietro Fontana • 06/12/2017 #

    Hi Wings, i did not found a forum thread for this interesting system so i post my comment here.

    I’m running it live in demo account since 12 july without touching optimization, and so far it gained 455 euros. It seems pretty good, but i’ve got a big backslash of bad trading from 14 july to 26 july, 7 consecutive loss for 1k of losses. Maybe this can be avoided by optimization.

    Stats are:
    16 Trades: 6 win, 10 loss
    1.32 Gains / Losses
    Max DD: 864,60
    Max consecutives lossing trade: 7
    Max Runup: 878,50
    Max consecutives winning trade: 2
    Time on Market: 46,7%

    Good work anyway.

  9. raphaelopilski • 06/12/2017 #

    Hi Wing, nice work!!!
    question: could you put a trailing stop in it? like: after profit of points x start trailing stop with a trailing step?
    like this: trailingstart = 25 //trailing will start @trailinstart points profit
    trailingstep = 30 //trailing step to move the “stoploss

  10. Karl_Wikland • 06/12/2017 #

    Seems like it always closes position at 22:00:0X time?

  11. Wing • 06/12/2017 #

    Sorry for not responding to a lot of you. System seems to still be going strong.

    Yes, position will close at 22:00:0X, since execution/calculation is not always immediate.

    I can’t put a trailing stop in it, but you can.

    Not posting my Twitter for certain reasons.

  12. Francesco78 • 06/12/2017 #

    Hi Wing, I have been using your code and it has been quite profitable until now indeed! So first of all thank you very much for sharing it. I am wondering as there are many variables, which one would you choose in case you wanted to reoptimize it? Thank you!!!

    • Wing • 06/12/2017 #

      Thank you. I also run it so I am glad it has worked. To optimize I would prioritise the SL and TP. The other variables are filters and not as important. Notably, the short SL is greater than short TP, which is unusual.

  13. Toto le Heros • 06/12/2017 #

    Hi Wing, First of all : bravo ! Your strategy is great. Anyway in demo, it looks like October 2017 (which is not over yet) is quite poor. The worst performing month since you started it live if I am not mistaken. Anyway, overall, strategy is great.
    Would it be worth to backtest it in Walk Forward ? (can’t do it myself).
    Thanks again.

  14. JohnScher • 06/12/2017 #

    I ran a test with the code, in demo account, since 06/24/17
    71 Trades
    thereof 34 profit
    thereof 37 loss
    Profit: 1.838 Euro
    max drawdown 416 Euro
    max Runup 520 Euro

    Ich habe einen Test laufen lassen mit dem Code , im Demo-Account, seit 24.06.17
    71 Trades
    davon 34 Gewinn
    davon 37 Verlust
    Gewinn: 1.838 Euro
    max Drawdown 416 Euro
    max Runup 520 Euro

    Demnächst werde ich den Backtest für diesen Zeitraum drüber laufen lassen und die Ergebnisse vergleichen. Bin gespannt. Wenn die Ergebnisse einigermaßen identisch sind, werde ich versuchen mit 2,3 Oszillatoren das Ergebnis zu verbessern.

    Liebe Grüße
    JohnScher

  15. verdi55 • 06/12/2017 #

    Interesting system. I tried to understand the method to determine new highs and lows, and I think there is a logical error in lines 125-128. I think these lines are supposed to mean : When close is below one of the averages (close<average[yy] or close0 (close>MaBotzy), ALTHOUGH there is NO uptrend.

    For the short positions, I think this is correctly coded. Lines 108-111 mean that there is no downtrend anymore, and both the low of the downtrend MaBot and the threshold for short positions MaBotz are set to 0. In line 83, this means, that in the following bar, a short position can NEVER be opened, because close cannot be smaller than 0 (value of MaBotz). This is correct, because there is no downtrend (close is above one of the averages) and therefore no short positions can be opened.

    I think that “in principle”, in order to make the decisions for long and short orders equivalent, the values of MaBoty and MaBotzy should be set to a very large value in lines 126 and 127, for example MaBoty=1000000000, and MaBotzy=1000000000. Then, in the next bar, a long position will also NEVER be opened in line 76, because there is no uptrend.

    Am I wrong, or did I understand something in the wrong way ?

  16. verdi55 • 06/12/2017 #

    I try once again. Part of my previous post disappeared, and it is therefore unintelligible.

    Interesting system. I tried to understand the method to determine new highs and lows, and I think there is a logical error in lines 125-128. I think these lines are supposed to mean : When close is below one of the averages (close<average[yy] or close0 (close > MaBotzy) is always true, a new long position can ALWAYS be opened in the next bar, although there is no uptrend.

    For the short positions, I think this is correctly coded. Lines 108-111 mean that there is no downtrend anymore, and both the low of the downtrend MaBot and the threshold for short positions MaBotz are set to 0. In line 83, this means, that in the following bar, a short position can NEVER be opened, because close cannot be smaller than 0 (value of MaBotz). This is correct, because there is no downtrend (close is above one of the averages) and therefore no short positions can be opened.

    I think that “in principle”, in order to make the decisions for long and short orders equivalent, the values of MaBoty and MaBotzy should be set to a very large value in lines 126 and 127, for example MaBoty=1000000000, and MaBotzy=1000000000. Then, in the next bar, a long position will also NEVER be opened in line 76, because there is no uptrend.

    Am I wrong, or did I understand something in the wrong way ?

  17. verdi55 • 06/12/2017 #

    Same thing again. Post was truncated. Once again the lost remarks :

    I think there is a logical error in lines 125-128. I think these lines are supposed to mean : When close is below one of the averages (close<average or close0 (close > MaBotzy) is always true, a new long position can ALWAYS be opened in the next bar, although there is no uptrend.

  18. verdi55 • 06/12/2017 #

    Does not work. Sorry, not my fault.

  19. verdi55 • 06/12/2017 #

    Only MaBotzy in line 127 should be set to a large value, for example MaBotzy = 10000000. MaBoty must be set to 0 in line 126, this is correctly coded. When MaBotzy is 0, in line 76 this would mean that the threshold above which a new long position can be opened is 0, i.e. a long position could always be opened.

    • ET • 06/12/2017 #

      I agree with verdi55. As it is now, the code will only test for a breakout on the upside (lines 113 to 128) when the close is above the MA and EMA. But, when the close is below the MA and EMA the system will still trade long because the condition for this is close > mabotzy and mabotzy = 0. Therefore it is entering long positions, without actually testing for a breakout, whenever the close is below the MA and EMA.
      I also agree with his other comment that this will be fine as long as you are in a long-term uptrend, but when a long downtrend comes along it will hurt.

  20. verdi55 • 06/12/2017 #

    The system greatly favors long over short positions, because MaBotzy=0 in line 127 and MaBotz=0 in line 110. This means it will work fine in long-term upward trends, but probably not so well in long-term downward trends, i.e. in a traditional baisse.

  21. traderfred • 06/12/2017 #

    Hello Verdi,
    I’m not sure to understand what you mean..Did you tried to test with your correction?

  22. JohnScher • 06/12/2017 #

    Does anyone trade the program real and in a live account?
    I have it running in demo account, see attachment.

  23. JohnScher • 06/12/2017 #

    http://prntscr.com/hzhvfx

  24. JohnScher • 06/12/2017 #

    http://prntscr.com/hzhvzh

  25. JohnScher • 06/12/2017 #

    http://prntscr.com/hzhwcc

  26. stockdemon • 06/12/2017 #

    I’ve been running it live since 26th of september with MM, P/L is 1.08 and total gain is about €288. Not too great considering I’m running the dynamic position code which takes more than one contract at a time.

  27. dkinse • 06/12/2017 #

    Hi,

    I’ve had this strategy running for a month now. But during this period, it has not made any trade. But in a backtest it should have done it. What am I doing wrong?

    Have I installed the code incorrectly? Have enough money on your account so it can not be that!

    Thanks for your help :))

    /////////////////////////////////////

    defparam cumulateorders=false
    DEFPARAM PRELOADBARS = 150

    stoch=Stochastic[8,3](close)
    mm2=exponentialaverage[8]

    // Position size module, 2 is the default. Can be adapted to scale with the profits
    /////////////////////////////////////////////////////////////////////////

    positionsize=2//+2*round((strategyprofit*2)/10000)
    maybe= positionperf(1)<0
    losses = positionperf(1)<0 and positionperf(2)<0

    if losses then
    PositionSize = 3//+3*round((strategyprofit*2)/10000)
    elsif not losses then
    PositionSize = 2//+2*round((strategyprofit*2)/10000)
    Endif
    if maybe and not losses then
    positionsize=3//+3*round((strategyprofit*2)/10000)
    endif
    if positionperf(1)<0 and positionperf(2)<0 and positionperf(3)0 and positionperf(2)>0 then
    positionsize=1//+1*round((strategyprofit*2)/10000)
    endif

    if positionperf(1)<0 and positionperf(2)<0 and positionperf(3)<0 and positionperf(4)<0 and positionperf(5)<0 and positionperf(6)0 and positionperf(2)>0 and positionperf(3)>0 and positionperf(4)>0 and positionperf(5)>0 and positionperf(6)>0 then
    positionsize=1
    endif

    ///////////////////////////////////////////////////////////////////////////////////

    // Optimization variables
    ////////////////////////////////////////////////////////////////////////////////
    bul=3.5 //long, SL
    but=12 // long, PT
    shl=6.5 // Short, SL
    sht=3.5 // Short PT

    lowt=65 // stochastic filter
    test=45 //stochastic filter
    mmlean=1.0002 // Moving average lean filter
    mmlean2=1.0005 // Moving average lean filter

    // moving averages
    yy=47
    tt=53

    ////////////////////////////////////////////////////////////////////////////////

    minSL=20 // minimum SL
    lasttime=210000 // last time to open position
    which=10 // Parameter of the ATR for SL/TP

    once mabot=0
    once mabotz=0
    once maboty=0
    once mabotzy=0

    if time080000 and dayofweek>1 and stoch>test and mm2[1]*mmlean minSL and go=1 and mm2[1]*mmlean2>mm2 and close>MaBotzy and onmarket=0 then
    buy PositionSize lot at market
    mystop=averagetruerange[which]*bul
    myprofit=averagetruerange[which]*but
    go=0
    endif

    if time>080000 and stoch<Lowt and mm2*mmleanmm2[1] and averagetruerange[which]*shl>minSL and close<MaBotz and onmarket=0 then
    sellshort PositionSize lot at market
    mystop=averagetruerange[which]*shl
    myprofit=averagetruerange[which]*sht
    go=0
    endif
    endif

    // Identifying tops/bottoms in price
    //////////////////////////////////////////////////////////////////////

    if close<average[yy] and close<exponentialaverage[tt] and MaBot=0 then
    MaBot=close
    go=1
    endif
    if close<average[yy] and close0 and close<MaBot then
    mabot=close
    endif

    if close<average[yy] and close0 and close>MaBot then
    MaBotz=MaBot
    endif

    if close>average[yy] or close>exponentialaverage[tt] then
    MaBot=0
    MaBotz=0
    endif

    if close>average[yy] and close>exponentialaverage[tt] and MaBoty=0 then
    MaBoty=close
    go=1
    endif
    if close>average[yy] and close>exponentialaverage[tt] and Maboty>0 and close>MaBoty then
    maboty=close
    endif

    if close>average[yy] and close>exponentialaverage[tt] and Maboty>0 and close<MaBoty then
    MaBotzy=MaBoty
    endif

    if close<average[yy] or close215300 then
    exitshort at market
    sell at market
    endif

    // Earlier friday exit. Insurance against accidental holding over weekends

    if dayofweek=5 and time>212300 then
    exitshort at market
    sell at market
    endif

    set target profit myprofit
    set stop loss mystop

  28. Wing • 06/12/2017 #

    I do not run this strategy myself, currently. As for why it is not taking trades live: Do you have it running the correct timeframe? Have you put a position limit too low? Even if you get no trades going through, do you see any rejected orders?

    • dkinse • 06/12/2017 #

      Hey,

      Yes it´s running in 30 m timeframe. I had it running and it made two trads in january. Then I thought I needed to add (PRELOADBARS = 150) but that has not helped! Strange that it made two trads and then no more.

      How do I know if position limit is too low?

      No rejected orders!

      Can I ask you why you do not have the strategy running?

      Big thanks for your help, I’m quite new to this so happy for all the help I can get. Finds this super interesting :))

  29. Wing • 06/12/2017 #

    There’s a few threads on the forum about backtest and live trades being different at times. I suggest looking in them for reasons.

    I run 0 automated strategies at the moment, but that’s just me being picky with running suitable systems and not distracting myself from manual trading (which I do a lot).

  30. Philipjonasson • 06/12/2017 #

    are u still active Wing?

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+20 more likes

Related users ' posts
frenqle Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
carpentier Joffrey Bonjour à tous, Avant tout merci pour ce travail, cependant je suis bloqué quand je l'insta...
carpentier Joffrey Re, C'est ok, j'ai trouvé mon erreur... Cependant sur quel base peut on calculer son CALC...
Aragorna Hi Nicolas, How is it possible to use it in a higher timeframe plotted on a lower timeframe?...
FXmike hey my friends, thank you for this great code. my problem is he make no trade open. backtest...
FXmike Can i put a Action that my start contract is smaller than 1 ? 0.3 or 0.5 ? In wich Position...
phoentzs I wrote the code for M15 back then and also variants in H1 and M1. Everything works so far....
Nicolas
4 years ago
KDJ
KDJ
3
Indicators
fireleg79 Bonsoir Nicolas. Merci pour tout ton travail. Quand tu auras le temps pourras-tu jeter un oe...
Sejibi Bonsoir, En remplaçant percentJ = 3 * percentD - 2 * percentK par percentJ = 3 * perc...
JMARTY Bonjour, A la recherche d'un indicateur détectant les divergences sur DMI, je tombe sur ce...
Jan Wind Thanks for sharing ! The Gain/Loss ratio is a bit low, 1,16, hardly offset the risks take...
drive whats the period ?
Lucas0000 Hola. estoy buscando un programador en proorder, para hacer un programa basado en el Q-trend...
Ludwig Bonjour Merci pour le code, je souhaite intégrer un break even et mette en place un réinves...
superfalcio hello, this strategy is pretty interesting, anyway on index after diferent suggestion and im...
Fralex Hello everyone I optimized the original “LongOnly-DAX-4H-TMA-Channel” algorithm over a pe...
Alps007 Hi Nicolas. Happy New Year. Can you please program me several MACD divergence screeners ...
Arlei Zanin Hello Nicolas, would it be possible to convert the Cloud to Pascal language? Thank you.
ashee i want it in MT4
Marie-Eve Vergoz Bonsoir - Voici l'erreur qui est signalée lorsque je souhaite utiliser cet indicateur : il...
Sapo Thank you very much. as always your indicators are extremely effective. kind regards Vonasi.
mitsu21 Hi, it looks nice. I'll try it tomorrow thank you for your share kind regards bruno
kj1988 Thank you Vonasi for sharing this indicator. Very useful as a comfirmation to the price act...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Vonasi Sure that is possible. I will code it and make a post in the English ProBuilder forum and pu...
Vonasi Vama v2 with Hull moving average included can be found here: https://www.prorealcode.com/top...
JMat45 Thank you, Vonasi.
Nicolas
5 years ago
LRMA
LRMA
0
Indicators
Vinks_o_7 Thanks again Vonasi !
Bard Thank you, this is a great tool @Vonasi, especially for those that used to like shorting Ind...
Aragorna Hi Vonasi, is there a reason why it does not work anymore in new version ePRT Platform? tha...
YvesRobert @robertogozzi. It's done. Thank you
YvesRobert Hello Roberto, some questions about your strategy. 1 - Do the 2 lines SET TARGET pPROFIT T...
robertogozzi 1. The 2 lines SET TARGET pPROFIT TP and SET STOP pLOSS SL are always executed, each bar. Bu...
sycomore Ça ne fonctionne sur aucune valeur, je dois être trop con...
Nicolas il faut appliquer l'indicateur sur le prix.
AntoGH Je crains de ne pas comprendre... Cela indique la probabilité de la prochaine bougie ou donn...
michaelben Bonjour Nicolas . Je cherche une strategie pour faire du trading automatisé. J'ai essaye ave...
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
Alexander9 This can for amibroker ? . Thanks
avatar
Anonymous Hi robertogozzi - thank you very much for sharing this strategy. I have performed various ...
robertogozzi Thank you samsampop.
Dotan Hello guys I really appreciate this coding effort but can I use this code for Mt5 Forex Trad...
Gubben So far so good. After a long drawdown it was winning four times in five weeks. Since 24 jul...
pat95162 Salut Pourquoi je n'ai pas les même résultats que vous
UkCoopDownUnder Any hints for us, on which variables we should be optimising ? As of November 2020, the cu...

Top