Engulfing Price Action Patterns Automated in Python

Поделиться
HTML-код
  • Опубликовано: 7 июн 2024
  • This video describes the Engulfing Candlestick Patterns, bullish and bearish engulfing candles and statistics are carried out in python to check if these patterns are a significant indicator or not. Algorithmic trading relies on statistics, and candlestick patterns are considered a strong indicator of market price change. Statistics are carried out on historical data from 2003 till 2019. Hope you will like this video! Enjoy it!
    🍓 If you want to follow structured courses with more details and practice exercises check my "About" page for Discount Coupons on my Udemy courses covering: Python basics, Object Oriented Programming and Data Analysis with NumPy and Pandas, ... more courses are on the way drop me a message if you have a particular interesting topic! Good luck!
    The Jupyter notebook file is available for download:
    drive.google.com/file/d/112PG...
    The data file is available at:
    drive.google.com/file/d/1qnYy...
    00:00 Engulfing Candles Introduction
    04:20 Python Code For Engulfing Candles
    11:50 Price Target Function In Python
    14:30 Prediction Precision For Engulfing Price Action Patterns
    #trading #python #algotrading

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

  • @lgbpinho
    @lgbpinho Год назад +6

    Don't you like the vectorized pandas and the stockstats module? Stockstats saves me a LOT of time. You can calculate differences between the closing prices from different candles rather easily with it. Code gets very short, but usualy there is an annoying step to remove the intermediate rows used to build the signal and clean up the df. Congratz on the channel, this is so useful.

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад

      Thank you for your comment I will check stockstats out!

  • @bostjan.gajsler
    @bostjan.gajsler 5 месяцев назад

    Excellent work and excellent videos. Thank you!

    • @CodeTradingCafe
      @CodeTradingCafe  5 месяцев назад

      Glad you like them! Thank you so much for your support!

  • @ngonibenjamin5955
    @ngonibenjamin5955 2 года назад +1

    Great tutorial MANY THANKS FOR THIS ONE! Where do u get your CSV market data from? Yfinance doesn't seem to have the same field formatting as your CSV in this video

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      Thank you for your support 😊 yfinance and you adapt it through pandas or you can create a dukascopy account (you have more control over data format there). Good luck!

    • @ngonibenjamin5955
      @ngonibenjamin5955 2 года назад +1

      @@CodeTradingCafe amazing. Will stay tuned for more Tuts. I love your content bro 👊🏼

  • @DiscoveringWithVanah
    @DiscoveringWithVanah 8 месяцев назад +1

    The discussion on the bullish and bearish seamed to have been mixed up at 8:00. The first part of the for loop seems to be referring to the DOWN candle and the else condition seemed to be referring to the UP candle.

    • @CodeTradingCafe
      @CodeTradingCafe  8 месяцев назад

      Hi, thank you for the heads up, it's very possible I get things mixed like this sometimes.

  • @ndumisolushaba2403
    @ndumisolushaba2403 2 года назад +3

    hey man great vid as always!, I'm trying develop a code where i backtest trades with the engulfing candle stick pattern off a significant support/resistance level. could you do a video maybe trying this out yourself ? I'm struggling with defining what a significant level would be ?

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      Hi thanks for your comment. Actually yes I will check how to numerically define a support/resistance level, I might need some time to make the video ... The list is getting bigger

    • @ndumisolushaba2403
      @ndumisolushaba2403 2 года назад +1

      @@CodeTradingCafe great looking forward to your upcoming content mate.

  • @Kopchani
    @Kopchani 2 года назад +1

    Please make a video on combination of price action and t.i
    signals powered by lstm to make trade better decisions. You are doing an amazing work with these tutorials 👏 🙌

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +2

      Thank you for your comment. I tried lstm models/combinations in many different ways, surprisingly results were very bad and completely useless (that's why I didn't do a video). Sometimes simpler models yield better results.

    • @wingsoftechnology5302
      @wingsoftechnology5302 2 года назад +2

      @@CodeTradingCafe Bro.... as per you Experience... Which Strategy whould be more Promising for real life Trading Buy-Sell signals ???
      1) Via ML models like XGboost, KNN , & all
      2) Via Neural Networks like LSTM, FBProphet, and all
      3) Just using Doji's, Engulfings.... & Slopes of different Indicators & Support Resistance level
      &,
      This strategies will be mostly effective in Intraday or Swing Trading ???
      & that too in EQUITY or CURRENCY/CRYPTO ???
      If you knew this answers... Please let me know bro.... I'm really getting Confused in all these 🤕🤕
      It would be Great for me.... as you have alot of Re-enforcement learnings from Past Years...& I'm currently learning this stuff
      So...I'm curious about it.
      Hope you'll guide....me about this bro🙂

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      @@wingsoftechnology5302 Hi, out of experience the simpler the better, Machine learning doesn't work for this type of data unfortunately. Best prediction are based on price movement and candles patterns with support and resistance levels in mind.
      Hope this helps

    • @wingsoftechnology5302
      @wingsoftechnology5302 2 года назад +1

      @@CodeTradingCafe Okay... Thanks... I'll Work accordingly

  • @Jimmy_Kemmel_is_a_pedo
    @Jimmy_Kemmel_is_a_pedo 2 года назад +1

    Well presented

  • @delhitepawan5804
    @delhitepawan5804 2 года назад +1

    Excellent work. Request you to please try scalping using python and backtesting that. Thanks

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      Hi, thank you for your comment, yes scalping is on the list... a bit more difficult though :)

  • @user-qt6ju1hc9x
    @user-qt6ju1hc9x 2 года назад +1

    Hello sir, great information indeed! just have a question does this data help with ML to be more accurate with price prediction?

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      Hi, not really ML is not that powerful for such problems unfortunately or I haven't discovered the way yet... Check this video
      ruclips.net/video/q_0rvwPbIqg/видео.html
      Next I will try neural networks

  • @ventiladorbueno1846
    @ventiladorbueno1846 2 года назад +1

    Thank you

  • @rosspainting9499
    @rosspainting9499 Год назад +1

    I am new to the whole programming world. I was wondering how can I integrate my codes in my meta trader or trading view to give me alert whenever the criteria are met.

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад +1

      Hey meta trader is kind of easy based on c++ but you will have to invest couple of months learning the language (mql5) it's worth it if you already have a winning strategy.

  • @byob801
    @byob801 7 дней назад

    Great video, I got a few of your Udemy classes, very good with lots of resources. Interesting to see the stats on the engulfing candles, I use them in my discretionary trading as a warning sign but I want to see a large candle that engulfs a few days to consider it a true signal, for this to happen you need a basing pattern lead up. (indecision) They don't come often but when they do they are powerful.

    • @CodeTradingCafe
      @CodeTradingCafe  7 дней назад +1

      Hi, thank you for your support, glad the courses were helpful. I agree engulfing candles can be used in different ways entry or exit signals, actually there are also some variations where 2 candles can engulf the previous for example and so on, maybe it's good to list all of these variation in a video (I will check this out, might be interesting to see, stats in between)

    • @byob801
      @byob801 7 дней назад +1

      @@CodeTradingCafe Yes, that sounds like an interesting idea, then maybe a follow-up testing added signal smoothers, that try to eliminate the false triggers. Yet maybe you did that already and I just have not seen it yet.

  • @jinghaoliu
    @jinghaoliu 2 года назад +1

    Thank you for the video, but at 8:45, "+0e-5" equals to 0, is this a typo?
    Did you mean "+1e-5", which equals to 0.00001?

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      Hello, no actually it's how I wanted to keep it, so in case you need to modify it instead of 0 it will be something e-5 let's say a difference of 5e-5 for example depending on how selective you want to be in the filtering

    • @jinghaoliu
      @jinghaoliu 2 года назад +1

      @@CodeTradingCafe Got it, thanks! : )

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      @@jinghaoliu good luck 🙂

  • @eliotharreau7627
    @eliotharreau7627 2 года назад +1

    Hi men Excellent videos, can you make videos with exit point and calculation of fees ?? Thnx.👍

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      Hi, thanks, fees might vary depending on broker and type of account. My purpose was to compare different technical methods to see which is best. Exit points are added in future videos when possible but it's the most difficult to guess.

  • @muayda9675
    @muayda9675 2 года назад +1

    Thank you my friend for the quick response to a question and I hope that the new bot will work for the binance platform

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      Good luck to you too

    • @ahmetenesozturk1902
      @ahmetenesozturk1902 2 года назад +1

      Hey may we talk about winrate

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      Yes sure... What about it exactly?

    • @ahmetenesozturk1902
      @ahmetenesozturk1902 2 года назад +1

      @@CodeTradingCafe is engulfing cdl based trade worth ?

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      @@ahmetenesozturk1902 well at the moment it's the best indicator I found if you combine it with support and resistance levels, I have to try it on lower time frames and see what it gives

  • @harsh159357
    @harsh159357 2 года назад +2

    How about statistics on lower time frame like 15 minutes, 30 minutes, 1 hour etc for an year. Also if you are really into bot technologies have you tried coding MT4/MT5 bots using mql.

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      Lower time frames are more noisy in my opinion it will be more difficult to assess, however might be worth a try to see.
      I have coded on mql for 8 years moved to Python because it gives access to machine learning and neural networks methods. The only advantage of mql is an easier integrated backtesting (but also tricky and comes with its traps). In brief haven't found any fully automated system (mql) that would provide more than 8 percent profit per year, can push this up to 15percent with increased risk, in my opinion ain't worth it.

    • @harsh159357
      @harsh159357 2 года назад +1

      @@CodeTradingCafe Makes total sense IMO. MT5 can bring a lot of benefit compare to MT4, but still needs some kind of add-ons for it to work properly. Meanwhile there is a one interesting discord group you can join w.r.t algo trading stuff. discord.gg/rDWUJBbg.If you have your pls share that one too.

    • @saidfehers8607
      @saidfehers8607 2 года назад +1

      @@CodeTradingCafe Thanks for that hint , I had been on circle of doom lately to choose between mql and python, but my instinct told me to choose python which I saw it got more freedom on analyzing trading ideas . what do you think should I continue this path aka trading with python.

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      @@saidfehers8607 I would say go for both, python first because even if your bot is not perfect you would have one more language to add on your CV... who knows might be useful and python is widely used now. Then go for mql it is not much of a difference from the algorithmic point of view, loops and functions, variables and ... So after python I think it will fast with mql.
      Good luck

  • @negadan77
    @negadan77 11 месяцев назад +1

    🔥nice, Can you do a video for choch startegy too?

    • @CodeTradingCafe
      @CodeTradingCafe  11 месяцев назад +1

      Hi, thank you CHOCH is a good idea I will add it to my list, in the meantime check this video it provides an idea on the methodology ruclips.net/video/Mxk8PP3vbuA/видео.html

  • @user-pz7tj9dp6m
    @user-pz7tj9dp6m 2 года назад +1

    I would love to see how to use these signals in automate trading

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +3

      I personally wouldn't advise fully automated trading, I prefer algorithmic trading where if the program detects an opportunity it will send an email or a message somehow and it's up to the trader to take the final decision. I believe you have better chances of winning this way.

  • @piwetshombe4684
    @piwetshombe4684 2 года назад +1

    I’m a beginner coder and getting zero signals for my Revsignal1 function. 🙈
    I’m using 5min data going back to 2020. I’ve made no amendments to your code except to read_csv my own 😬
    I’m also getting a runtime warning in the line where it should output my percentage. “invalid value encountered in long_scalars.”

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      Hi the parameters have to be adapted to your timeframe and the currency you are testing. It might be challenging if you have no programming background, you need at least some basic knowledge. It might take some time but it's worth it.

    • @piwetshombe4684
      @piwetshombe4684 2 года назад +1

      @@CodeTradingCafe The currency pair is EURUSD, so I think the pip values should be fine.
      I’ll have to check what other parameters need adjusting.

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      Good luck!

    • @piwetshombe4684
      @piwetshombe4684 2 года назад +1

      @@CodeTradingCafe My 30pips bodydiffmin exclusion was too much for my timeframe.
      But my stats are very low.
      For my 5 minute timeframe, I now exclude 3pips instead of your original 30pips - giving me about 540 bearish and 540 bullish signals.
      With even a 15pip target 5 bars ahead, I’m getting a success rate of 10% 🥺😅.
      I’m gonna take a closer look at my data and maybe even re-download it for good measure. I’ll also play around with different timeframes.

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      @@piwetshombe4684 lower timeframes are harder to trade in algotrading, the easiest is start daily, then decrease 4hours, 1 hour etc... See where you can get, and optimization is mandatory for each timeframe

  • @priyansh02chawda
    @priyansh02chawda 2 года назад +1

    Hi, great video, could you please help me to get the false positive output into .csv file ?

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      Hi thank you, yes you can put your false positives into a new dataframe then use to_csv function in pandas to write the dataframe into a csv file

    • @priyansh02chawda
      @priyansh02chawda 2 года назад +1

      @@CodeTradingCafe Hi Thanks for reply, It worked out... I was curious, If we change only the "Engulfing Candle Pattern" code Block with other Candle pattern block code and rest all the same, will it give the accuracy for that pattern?

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      This is good it's working, yes we can change the block for engulfing patterns and simply use only this in your test to get it's accuracy.

    • @priyansh02chawda
      @priyansh02chawda 2 года назад +1

      @@CodeTradingCafe Thanks for clearing the issue with quick responses.
      Thanks again, looking forward for more new content.

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад

      @@priyansh02chawda more is coming, I will try to bring scalping bots as next step

  • @levimor98
    @levimor98 Год назад +1

    Ossom... how to connected this to tradeingview demo?

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад

      Tradingview I don't think it is possible, but other platforms might be easier... Binance oanda...

    • @levimor98
      @levimor98 Год назад

      @@CodeTradingCafe tradestation? Can I copy the code to their bot system?

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад

      I don't know, I am not familiar with their platform

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад +1

      ... but dig around I am sure there is something in their documentation or on the internet.

    • @levimor98
      @levimor98 Год назад +1

      @@CodeTradingCafe sorry/ last q. how i chenge the code to check a future like NQ100 or ES500?

  • @muayda9675
    @muayda9675 2 года назад +1

    Hello my friend, thank you for providing the excellent information, but can you make a fully automated trading bot for the platform so that we can benefit from your experience, and thank you

    • @CodeTradingCafe
      @CodeTradingCafe  2 года назад +1

      It's in the process, however my main target here is provide educational content first, so everyone is able to understand what is the bot doing rather than simply running programs like a blackbox. Stay tuned more stuff are coming, and thank you for your comment.

  • @teenspirit1
    @teenspirit1 Год назад +1

    You need to analyze your strategies by backtesting them, not by doing highschool pandas exercises.
    Backtesting means consuming signals, entering long and short, adding spread, slippage and commissions, calculating PNL and sharpe ratios.
    Otherwise it's just a waste of everyone's time.

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад

      Unfortunately I don't agree on starting with the details, top down research is a well established approach, if skipping commissions doesn't provide a winning strategy then you already know it's better to move on to a different one without wasting time on commission, spread and slippage. According to your experience what are the odds slippage would affect a daily timeframe trading?

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад

      ... it's not a waste of time if people are learning how to build python programs

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад +2

      ... it's not a waste of time if people are learning how to build python programs

    • @gzthrive2741
      @gzthrive2741 Год назад

      @@CodeTradingCafe its a waste of time and dishonest when you add a huge "80%" in the thumbnail.

    • @CodeTradingCafe
      @CodeTradingCafe  Год назад +1

      @@gzthrive2741 on a daily timeframe how different the results would be in your opinion... The 80% isn't about the strategy returns it's the accuracy.