double top and double bottom detector – M&W patterns

double top and double bottom detector – M&W patterns

Hi all,

I create an algorithm that detects local minimums and local maximums in the proximity were two crossing moving average are located.

Base on this information, then simple mathematics is use for detect and draw a triangle where a double top is located.

Please check it, improve the algorithm and share your luck!

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. swapping • 10/25/2017 #

    Very good Leo, thank for this detector

  2. yuzer • 10/25/2017 #

    Thank you so much my friend

  3. Alai-n • 10/25/2017 #

    Très intéressant Merci…

  4. Leo • 10/25/2017 #

    Popular post of the week! what an honour!
    We all are developing a system for trading double top or double bottoms here

  5. Francesco78 • 10/25/2017 #

    great job! I will try to test it to see if I can find a nice robust strategy around it.

  6. lokbuscas • 10/25/2017 #

    Hi the signals that paint are fantástic. But I have one doubt. Does the indicator repaint? ? In the past marks very well ups and bottoms But in the present I haven’t any stock that the indicator shows the signals thank you

  7. proreal82 • 10/25/2017 #

    Take this indicator on the second timeframe, and you will see that it ”repaints’ the top and bottom. Maybe useful on a bigger timeframe, but not on the smaller ones.

    • Nicolas • 10/25/2017 #

      I don’t feel that this indicator “repaint” the way you think about. It gives signals afterwards, but it should not delete a signal given once bar is closed.

  8. lokbuscas • 10/25/2017 #

    Ok Nicolas
    Then is it posible programme a screener to look for stocks in daily for examine? ?

  9. lokbuscas • 10/25/2017 #

    Thanks proreal82

  10. Leo • 10/25/2017 #

    Screener done (waiting to be approved), with many improvements in the system

  11. lokbuscas • 10/25/2017 #

    Thanks leo

  12. bolsatonimora2 • 10/25/2017 #

    Please Leo, let us know when screener be approved!! 😉 many thanks!!

  13. sally31120 • 10/25/2017 #

    Merci à Léo!
    Le code est trop ardu pour mes connaissance, pourrait-on avoir un screener à partit du code de cet indicateur ?
    Un screener qui indique le passage de LMA de positif en négatif confirmé sur 3 barres (soit signal en zéro confirmation en 1 et 2, Achat ou vente en 3).
    Merci aux bonnes volontés.

  14. Leo • 10/25/2017 #

    Hi Sally, we have already a screener, maybe is what you Need

  15. Sofitech • 10/25/2017 #

    Hi Leo. You code is very interesting (Indi+Screener). To use it in my trading i think i will maybe modify it to match the way i trade. I have a very simple question : arrows to spot the local maximums and local minimums are real time ? I mean they appear in real time where they are spotted or they appear few candles after ? Thanks

  16. Leo • 10/25/2017 #

    Hi Sofitech.
    You never know what then Price will do in the future. That why These gray arrows appears after a while ( when we know that, the specific Price was in reallity a local Minimum or local Maximum)
    I do not know if I expleain myself correct

  17. brendab180 • 10/25/2017 #

    How do you get the indicator on the chart and not in a frame below? Sorry new to this software

    • Nicolas • 10/25/2017 #

      Add it on the price chart with the wrench at the left upper side of your chart.

  18. rama • 10/25/2017 #

    how to read the this triangle? I have set up the indicator, little confusing when to buy when to sell

  19. Leo • 10/25/2017 #

    Hi Rama, that’s the issue with trading… where and when to trade. If you figure it out, please share 😉

  20. century • 10/25/2017 #

    i have to thank you for this great piece of code
    works like a charm and very useful

    • Leo • 10/25/2017 #

      Nice to know! 😉

  21. Nick FX Junkie • 10/25/2017 #

    Hi Leo, Amazing indicators! Can you please advise if there is a way to utilize your indicator in a automated trading strategy.

    Can you suggest a code for an automated sell order or buy order when the arrows appear on your indicator. Cheers Nick.

  22. abhay • 10/25/2017 #

    can this indicator be converted in a way that it can be called in screener and return 1 or -1 for doubletop or double bottom formation

  23. bertrandpinoy • 10/25/2017 #

    bonjour je ne parvient pas a l installer sur PRT. erreur de syntaxe… et vous il fonctionne?

    • Nicolas • 10/25/2017 #

      Il vaut toujours mieux télécharger le fichier .itf et l’importer directement dans la plateforme plutôt que de faire des copier/coller.

  24. Breeze • 10/25/2017 #

    I am using an online trading platform in South Africa, I don’t know how to code, how would I run this code given the data that they supply me with?

    • Nicolas • 10/25/2017 #

      All codes on our website is made to be used with the ProRealTime trading software, you can try it for free there:

  25. zen83 • 10/25/2017 #

    Many thanks Leo for your masterpiece indicator, I took the liberty of plugging into it Fibonnacci levels
    at the very end insert
    F236=resistance -difrs*0.236
    F382=resistance -difrs*0.382
    and return them into the very last line
    … very amazing results

  26. antitrust56 • 10/25/2017 #

    Hi Leo,
    how to set up an audible alert to be notified of a doubletop or doublebottom detection ?
    Thanks for your answer

  27. parthapersonal • 10/25/2017 #

    Great job Leo.
    Dear Zen83, how do you, “return them into the very last line”?

  28. steve_ • 10/25/2017 #


    This thread is quite old, but let’s try…

    I’m new with Prorealcode and I’ve just disvovered “Double top and double bottom” indicator.

    It seems to be a very nice piece of code, nice work Leo !

    But I have a question about the associated screener.

    Would it be possible to sreen only recent bottoms ?

    For exemple, bottoms that appeared in the last x days ? (x as a parameter)

    Thanks !

  29. steve_ • 10/25/2017 #

    I’ve created a topic in french (translatable with Google function) here :

    I’ve developped a prototype of screener using Leo’s indicator.
    Please check it and give your opinion.

Register or


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

+27 more likes

Related users ' posts
bibifricotin Je pense avoir compris dans la première colonne exemple 92 le 9 indique la période et le 2 ...
Leo_da_Pisa It seems to work very well. Good for confirmation. Thanks for sharing Vivien.
joguemon Buenas, he instalado el screener pero no me aparecen los números que indicas...tengo que mon...
enriquem Hola, No, los numeros no aparecen, Proscreener no permite rotular, Lo que devuelve el sc...
PeytoLake Hi Enriquem, How do I change the timeframe from 'Daily' to "5 min"? Thank you.
quibe56 Bonjour, à priori les couleurs pour le Katana ne fonctionnent pas ( départ haussier ou élan...
swapping Bonjour quibe56, n'ayant pas rencontré ce défaut je continu néanmoins à structurer le code p...
ckat55 Thank you Nicolas, is there any way that an alert can be set for when the dot appears?
Nicolas yes, change the last line with: RETURN wrb,qh and set an alarm with the alert tool for ea...
ckat55 Thank you Nicolas, I will try it.
JohnScher After a small error crept in, a correct itf.file has been uploaded.
dougie80 Great Indicator, Is there a way to use this as an alert ?
JohnScher I created the screener with some help here from PRT. It is surely somewhere in one of the fo...
Nicolas Screeners dont plot anything on charts.
jobswaps Hola puedes agragar marcos temporales como minimo y maximo en temporalidad del triangulo par...
p3sc4d0r c3 = Average[40](close*volume) > 3000000 Hi to everyone. I need some help with this co...
Vonasi Thanks for your thanks Real Pro and yes everyone should import the itf file to make sure tha...
Pepsmile Good job, which could be applied for a spectrum of another indicators.
Pepsmile As to better understand which parameters are better for an indicators in a specific period (...
Bard I was talking to a Machine Learning coder today who's algos have apparently managed to get 7...
Bard Hi Violet, Thanks so much for making this screener. Bulkowski's work is thorough. I though...
Gregg Hi all, is there anyone who is using this pattern? It's been 3 days I'm trying it and I'm ...
Violet Hi Gregg, TP and SL? There are no variables by those names. The signal appears/disapp...
Marcus Quartus Aurius Thanks great job !
sally31120 Bonjour, J’ai deux questions concernant Double top and double bottom detector – M&W pat...
Dadoo Incredible workLeo. Thankyou to share you time and knowledge
tommygtb what does the criteria mean in the box on the screen is it the time frame the screener sear...
4example excellent, thank you
Anonymous Sorry I mean vertical red / green line
Anonymous Found: just remove "T coloured(r,g,b) as "Top", Bo coloured(r,g,b) as "Bottom"... after return
darbes Hi I tried to use indicator in a strategy code. But backtesting is asking to define Signalb...
simonsanchezj How do you modify this for a 7-10 day period? Thanks
gabri I am not sure I understand what you mean?
andreag76 Thank you Francesco78 !
juanj What happened after August 21?
jpgcreatestrading Hi Manel, i have found this same issue, some strategies (but not all) that are written with ...
Ciccio As written some posts above, there is an update here
Mrmamps079 Hi Admin, I can't plug this indicator on my metatrader 4 on my laptop. When I add it on my i...
Nicolas Sorry but we do not provide any help for mt4 users. Our website is dedicated to ProRealTime ...
Maxime Leleux Nice screener but the 2 candelsticks around the doji should be long sticks (red and green). ...
Nicolas EDIT: identifying pattern number in the ProScreener window:
pyhrus Nicolas ,       Could you communicate to us the indicator you have used to draw patterns ...
Nicolas Description of falling/rising wedges: