How I Achieved a 74% Profit Using Michael Harris’s Trading Pattern in Python | Full Backtest

Поделиться
HTML-код
  • Опубликовано: 15 дек 2024
  • In this video, I walk you through how I achieved a 74% profit using one of Michael Harris’s trading patterns. I’ll show you exactly how I coded the backtest in Python, step-by-step, and applied algorithmic trading logic to both the QQQ (Nasdaq-100) and S&P 500 historical data. You’ll see how I implemented the pattern recognition, set stop-loss and take-profit targets, and verified the results through a full algorithmic backtest. By the end, you’ll have the knowledge and code to replicate this strategy for your own trading experiments.
    📘 Book available on Amazon (Algorithmic Trading Hands-On Approach Using Python):
    a.co/d/6woMBHt
    Discount Vouchers for my Algorithmic Trading and Python courses:
    💲 Algorithmic Trading: bit.ly/CouponA...
    💲 Data Analysis with Numpy and Pandas: bit.ly/CouponD...
    💲 Machine Learning Methods In Algorithmic Trading: bit.ly/CouponM...
    💲 Python Beginner Course With Solved Exercises: bit.ly/CouponP...
    💲 Object Oriented Programming in Python: bit.ly/CouponOOP
    Grab the Python code here, and the data files as well:
    drive.google.c...
    Good luck Guys! Enjoy coding in Python :)

Комментарии • 57

  • @lorensaunders6034
    @lorensaunders6034 3 дня назад +4

    I love that you test all these ideas out so thoroughly. It always gives me more to add to my own strategies (or not add). Thank you.

    • @CodeTradingCafe
      @CodeTradingCafe  3 дня назад

      Thank you, makes total sense, the purpose here is not to present full strategies, but to test simple ideas/indicators/patterns that can be plugged or added into strategies with other indicators and filters.

  • @gvidalcantavella
    @gvidalcantavella 3 дня назад +7

    Nice video, thank you! I was just wondering why using fixed percentage instead of using the ATR like in different videos.

    • @CodeTradingCafe
      @CodeTradingCafe  3 дня назад +1

      Glad it was helpful! fixed percentage versus ATR no particular reason, actually all of these trade management methods are not the purpose of most of the videos testing indicators and patterns, these (indicators and patterns) are usually used for entry meaning to enter a position and open a trade, however the rest is how to manage the trade once it's opened and for that there are lots of approaches...

  • @simonescelsa
    @simonescelsa День назад +2

    Technical analysis Always work over a time frame with the underlying trending in one direction. Even a long short strategy stops working when the market starts trending downwards as the movements tend to be much faster on the way down and TA signals lag.

    • @CodeTradingCafe
      @CodeTradingCafe  2 часа назад

      I agree the uptrend pace is different than the downtrend especially for stocks, crashes happen fast, so it's better to split strategies into long only and short only strategies with different approaches.

  • @TheEcherriman
    @TheEcherriman 3 дня назад +2

    Great work again. Thank you

  • @More2lifee
    @More2lifee 3 дня назад +3

    Amazing..learnt new things!! Thanku

  • @cybern9ne
    @cybern9ne 3 дня назад +2

    New subscriber - Thank you!

  • @orlandonestoreulateandia864
    @orlandonestoreulateandia864 3 дня назад +2

    Excellent, a question where can I learn how to connect py code with Tradingview? Thank you very much

    • @WannaBeQuant_SUB
      @WannaBeQuant_SUB 3 дня назад +2

      U can't. Only data can exit trading view with webhooks in json format

    • @CodeTradingCafe
      @CodeTradingCafe  3 дня назад

      Not sure this is possible unless thay are selling an API which might not be a free option (if it exists)

  • @arnohmoins6661
    @arnohmoins6661 2 дня назад

    I haven’t done Python in many years. Great job on this work! Personally, I do the same in C# on NT8, focusing on futures markets (ES, NQ, YM), which have been heavily traded by retail traders in recent years thanks to access through prop firms. I haven’t watched all the videos yet. What is your favorite strategy among those you’ve backtested?

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Thanks for sharing! A full favorite strategy I don't have one, it depends on how the market looks (trending or sideways), but I do have favorite indicators (support and resistance levels along with candles patterns on the daily timeframe).

  • @MrRahul15937
    @MrRahul15937 3 дня назад +2

    Among all these strategies which one is your favourite

    • @CodeTradingCafe
      @CodeTradingCafe  3 дня назад +1

      daily timeframe, support resistance with rejection candles happening around key levels, this the entry study but then comes the trade management or exit decision and that's much harder.

    • @tramesh007
      @tramesh007 2 дня назад +1

      @@CodeTradingCafe by any chance did you code the support & resistance with rejection candles?

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Not together here on YT but you can check these videos for some help: ruclips.net/video/MkecdbFPmFY/видео.html
      ruclips.net/video/xky3ZiCsEDs/видео.html
      ruclips.net/video/aJ8Og-iLaas/видео.html

  • @preetipics
    @preetipics 36 минут назад

    thanks very much as always.this one looks interesting. Is there any way I can reach you to see if you would be willing to backtest a really interesting forex strat that has been performing very well recently please?

  • @dorviignatusnunana2605
    @dorviignatusnunana2605 День назад

    Dear CodeTrading, where do you place your limit or entry during backtesting...Is it the same as the current_close

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Hi, yes once the pattern is confirmed the signal is at the end/close of the current/last candle.

  • @franciscotafur9079
    @franciscotafur9079 День назад

    would it be logical to optimize and find the best TP and SL parameters for short positions and do the same for long position, this way you dont use the same parameters for long and short posibly yielding better results? would this overfit the data?

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Actually I like your idea, especially for stocks they usually have different speed in climbing and dropping, so having 2 different sets of exit values makes total sense. Regrading overfitting... we are always overfitting somehow can't really totally get rid of it.

  • @AndreSilva-cb3tz
    @AndreSilva-cb3tz 3 дня назад +2

    Hi, how far are the strategies you present us in all your videos from being profitable in the "real world". I mean, if we create a bot to trade based on this strategy, for example, would it be profitable? If not what would be the next steps to take bebidos the o és you mentioned?

    • @CodeTradingCafe
      @CodeTradingCafe  3 дня назад

      Hi, I usually present and test single indicators or double indicators strategies, and I often neglect the trade management part. For a profitable real world strategy you need additional indicators for confirmation (they must be tested) and a looooot of work on the trade management (and risk management) part which in my opinion is the hardest. It's relatively easy to find a winning set of indicators but the trade and risk management are where the difference is made.

    • @AndreSilva-cb3tz
      @AndreSilva-cb3tz 2 дня назад

      @@CodeTradingCafe Thank you for answering! Do you have something on your list about going deeper on trade management? I think it would be interesting to share that knowledge with all of us. Keep your excellent work!

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      It's harder to put this into a video, I would say the best is to exit/manage the trade manually because this relies a lot on experience of the trader, experience is mainly reading patterns that are red flags the trades should be closed because the market might be reverting, for example opposite candle patterns, reaching a key level ... the issue is that there are lots of scenarios that are harder to cover in videos although I do include some from time to time in the backtests.

  • @differentone_p
    @differentone_p День назад +7

    okay now show the real money you got, account balance

    • @CodeTradingCafe
      @CodeTradingCafe  День назад +1

      It's slow 10 to 20 % yearly ... no get rich quick scheme sorry to disappoint.

  • @vincentg9570
    @vincentg9570 2 дня назад

    Very interesting thanx 🤩 Do you think it is possible for you to create a series of videos or even a masterclass to detail the process of generating robots through machine learning with Python, but the way the EA Studio or StrategyQuant apps do it? It is a matter of automatically creating robots from tests of combinations of indicators and money management rules, then filtering by certain criteria (number of trades, performance, minimum profit factor, minimum R-squared for equity, etc.), then setting up an automatic forward testing with filtering of the best robots, then a Monte Carlo testing with filtering of the best robots according to our criteria. All this data processing chain would be like a great funnel to automatically filter and select the best seeds. It would be great please 🙏

    • @CodeTradingCafe
      @CodeTradingCafe  День назад +1

      Hi, thank you for your support. Actually your idea is great, but it's a lot of work/time. I am not sure this is good for YT video :) maybe I will break it into fragments in the future.

    • @vincentg9570
      @vincentg9570 День назад

      @@CodeTradingCafe Oh thank you very much! Yes in small pieces, I'm sure other people would be interested

  • @hermesus6831
    @hermesus6831 3 дня назад +2

    Which time frame?

  • @ronaldhet4241
    @ronaldhet4241 14 часов назад

    Hi, I have a strategy but i don't know how to implement it. I have tested it but manually, it's in hour frame and it gives good result in daily frames. Also it gives good number of trades in a month (around 20). Can you give me a hand?

    • @CodeTradingCafe
      @CodeTradingCafe  2 часа назад

      If you really really tested it, then we can backtest it in python, send me the details by email codingntrading at gmail com

  • @christophafalg4294
    @christophafalg4294 3 дня назад +3

    Do you use tickdata?

    • @CodeTradingCafe
      @CodeTradingCafe  3 дня назад +1

      No need, just daily because the pattern is checked only when the last candle is closed.

  • @factoryofgaming5229
    @factoryofgaming5229 День назад

    I think there is data leakage here, but I could be mistaken. We don’t know what the current candle high will be before it closes, hence you have to shift the time series by 1. I am not sure if this will mean you can keep the current win rate and profitability :(

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Hi, there is no leakage as long as we run the test at the end of every candle meaning after the candle has closed, these are daily candles so at the end of every day we can test for the pattern occurrence.

  • @arremztife871
    @arremztife871 День назад

    Can I integrate MT5 ?

  • @yamitanomura
    @yamitanomura 2 дня назад +1

    I test this with bitcoin 1h data from 2018 to nov 2024.
    The result is very bad. :(

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Hi, these patterns only work on daily timeframe, any lower timeframe will NOT work for sure.

  • @edwinceriola1542
    @edwinceriola1542 2 дня назад

    Thats is a perfect chaos strategy ahah

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Well maybe, but someone (M Harris) made some buck out of it.

    • @simonescelsa
      @simonescelsa День назад

      ​@@CodeTradingCafeyes he made a buck by selling a book

    • @CodeTradingCafe
      @CodeTradingCafe  2 часа назад

      Traders do make make some money ... but much less than what people think, this is why they start selling books, also they get some exposure.

  • @tundedankano52
    @tundedankano52 2 дня назад

    Oh Gosh! These Stuffs are just too complicated for me.Could not make anything from what I have just watched.Is Trading this complicated?😮

    • @CodeTradingCafe
      @CodeTradingCafe  День назад

      Hi, no trading is not, it's the coding part. You can just check the videos for the input, the strategy and the results, skip the coding, if the results are good you can keep the idea for your manual trading.

  • @TheDoktorot
    @TheDoktorot 3 дня назад +3

    Anyone used this in their automated trading?

    • @CodeTradingCafe
      @CodeTradingCafe  3 дня назад

      From his book he probably used these for entry signals but the trade management (exit and risk management) are not be forgotten and these were not detailed in the book...

  • @Wotanhelm
    @Wotanhelm 3 дня назад +4

    Probably much easier to do this in MQL5 without all the dataframe and backtesting stuff. I mean you pretty much have to be a Python expert to use this code , but if you were a Python expert you probably won't be watching these videos.