Algorithmic Trading Strategy [Mean Reversion] in Python using Bollinger Bands/RSI !BEGINNER FRIENDLY

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ต.ค. 2024

ความคิดเห็น • 60

  • @int2str
    @int2str 2 ปีที่แล้ว +9

    When the trading is restricted to one active trade at a time, the algorithm becomes extremely starting point sensitive. Basically you'll select which shares to buy simply based on when you set the starting date for the algorithm. I think that basically makes it random.
    Would be great to see a video where you code up a way to take an algorithm like this and programmatically check starting point sensitivity.

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว +3

      Thanks a lot for sharing your thoughts Andre. I have already covered to tackle that "problem" by e.g. splitting in some previous videos but will also cover that in future videos.

  • @sweealamak628
    @sweealamak628 2 ปีที่แล้ว +1

    Very elegant way to create the 'signal' column. 👍

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Glad that you think so :) thanks for watching!

  • @ramshankarmukherjee1364
    @ramshankarmukherjee1364 2 ปีที่แล้ว +3

    I think if you add sma20 like above in buy and below in sell the result will be better as it will follow trend . Thanks for sharing knowledge 🙏🙏🙏 .

  • @bryan-9742
    @bryan-9742 2 ปีที่แล้ว +8

    whats really helpful, and tricky, is taking your videos and turning them into Classes. so tricky sometimes.

    • @aricanto1764
      @aricanto1764 2 ปีที่แล้ว +2

      Facts. Surely a bunch of commenters start a git if his videos with python classes lol

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Will do so in the next video! :-)

  • @kevanotrades8488
    @kevanotrades8488 2 ปีที่แล้ว +1

    Awesome analysis and great to see this all done in Python, I've only really done things in Tradingview Pine Script :)

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thanks mate, happy to read :-) Be invited to check out my other stuff!

  • @flydr2
    @flydr2 2 ปีที่แล้ว +2

    As usual... great info and very well explained... I really love your channel, it's extremely helpful

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thanks a lot Marc. Appreciate your kindness!

  • @refaamoe
    @refaamoe 2 ปีที่แล้ว +2

    I swear I love this channel 😍

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thank you so much! Channel loves you too ❤️

  • @itayhilel2168
    @itayhilel2168 2 ปีที่แล้ว +4

    nice, lets test it on crypto!!

  • @gianfrancosilvestri2155
    @gianfrancosilvestri2155 ปีที่แล้ว +1

    Simple and effective as usual. Bravo! A humble proposal : what about to use a correlated couple of futures, such as ES and NQ and to trade their spread ? Instead of a single equity?

    • @Algovibes
      @Algovibes  ปีที่แล้ว

      Thanks a ton! Also great suggestion, thank you

  • @toddroloff93
    @toddroloff93 7 หลายเดือนก่อน +1

    Great Video. You The Man!!❤‍🔥

    • @Algovibes
      @Algovibes  7 หลายเดือนก่อน

      Thx boss

  • @Мансур-п7ы
    @Мансур-п7ы 2 ปีที่แล้ว +2

    Thanks for sharing! Nice job! I like the way you do experiments. Could you make videos on risk management of assets when, for example, they cointegrate? Or other types when we need to care about risks. Thank you and good luck!

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thanks a lot Mansur! Did some videos on that already (e.g. VaR). Is that what you are looking for?

  • @voravitrakwong
    @voravitrakwong 9 หลายเดือนก่อน +2

    Good vdo.

    • @Algovibes
      @Algovibes  9 หลายเดือนก่อน

      thanks buddy. appreciate your comment!

  • @gianlucamessina2231
    @gianlucamessina2231 2 ปีที่แล้ว +1

    thanks for the video mate, interesting stuff!

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Glad you think so Gianluca, thanks a ton!

    • @gianlucamessina2231
      @gianlucamessina2231 2 ปีที่แล้ว

      Seems difficult to test properly and avoid overfitting though given these strategies don't do many trades

  • @sz8558
    @sz8558 2 ปีที่แล้ว +1

    Great vid thank you...Would be cool to plot the cumulative sum of the returns to see how stable returns are and drawdowns....

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thanks mate. You can just take the cumulative prod (cumprod()) instead of the prod and then plot it.

  • @TexasTrucker-nx8dd
    @TexasTrucker-nx8dd 9 หลายเดือนก่อน

    Mean reversion and trend following are two opposing trading methodologies. You need to separate the trending market from the range bound market. Only then will you be able to make this better.

  • @Tomydispik
    @Tomydispik 9 หลายเดือนก่อน

    He might have shifted to the second day close to account for a position draw down. There were buy signal clusters and if you look at the close of first to second you have a large draw down. Look at first to third signal you have an even larger draw down. You would be stopped out with a major loss entering the first two signals

  • @felipetradeenergia
    @felipetradeenergia 2 ปีที่แล้ว +1

    great video, thank you very much

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Very welcome! Thanks a lot for watching and leaving a comment :-)

  • @DenisBelleau
    @DenisBelleau 2 ปีที่แล้ว +1

    Very interesting as always :)

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thanks a lot Dennis 🙂

  • @cemsekerci6345
    @cemsekerci6345 2 ปีที่แล้ว +1

    I couldn't understand the part where the position variable set equal to False and in the loop after that we use "if not position" argument which actually turns the argument to true. So in the beginning of the loop we say "if we are in a position and signal is buy....".

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว +1

      Hey Cem,
      no in the beginning we say "if we are NOT in a position AND we have a buying signal" -> Buy!

  • @traderbsas
    @traderbsas 2 ปีที่แล้ว +1

    Shared code

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Sure! You get access to the Code by becoming a Tier-2 channel member here:
      th-cam.com/channels/87aeHqMrlR6ED0w2SVi5nw.htmljoin
      Looking forward to welcome you! :-)

  • @gauravpainuly1800
    @gauravpainuly1800 2 ปีที่แล้ว +1

    Nice

  • @kleberpython2063
    @kleberpython2063 2 ปีที่แล้ว +1

    I am surprised to see GME yielding a 126% return if you start the strategy from beginning of this year. I used a 5% stop loss

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Yea, that's quite interesting indeed.

  • @whemmakatatt5311
    @whemmakatatt5311 2 ปีที่แล้ว +1

    Ty good video

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thanks for watching mate

  • @k2icc
    @k2icc 2 ปีที่แล้ว +3

    Maybe an MA or something to filter the larger fall at the end?

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Probably not a bad idea! Thx for watching :-)

    • @k2icc
      @k2icc 2 ปีที่แล้ว

      @@Algovibes Well, I was using the Pinbar rejection indicator from TradingView, which is almost an identical plot as the Bollinger Bands middle line, and it catches that big downside move on the chart. Tanks.

  • @TheEcherriman
    @TheEcherriman 9 หลายเดือนก่อน +1

    Thanks for this. I am using finta TA and the RSI differs from yours - which one are you using please ?

    • @Algovibes
      @Algovibes  9 หลายเดือนก่อน

      Welcome mate! Using the RSI from the library here. Has a default lookback of 14. Cheers

  • @bryan-9742
    @bryan-9742 2 ปีที่แล้ว

    Why don't you just make the stop losses part of the selling conditions? I'm having trouble understanding why you would put them in the loop? I could only understand that in my mind if they were trailin stop losses.
    Your thoughts are appreciated.

  • @its_code
    @its_code 2 ปีที่แล้ว +1

    Very interesting 😍😍😊😘😘🤩💕💕❤️

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว +1

      thanks buddy

    • @its_code
      @its_code 2 ปีที่แล้ว +1

      @@Algovibes💕💕❤️❤️❤️❤️🤩

  • @armanyaseen213
    @armanyaseen213 2 ปีที่แล้ว +1

    Is there any way to set the symbol with a variable so that i can just change the symbol on the top once and it hut run and runs everything for that new symbol

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Hey Arman,
      Yes! Will exactly show how to do that in the next video :-) stay tuned

  • @emmank3710
    @emmank3710 2 ปีที่แล้ว +1

    please how do you take profit

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      You mean like instead of the Stop Loss add a Target Profit?

  • @wenling3487
    @wenling3487 ปีที่แล้ว

    Is there a python package which can read the raw data of ninjiatrader?

  • @easyxpress
    @easyxpress ปีที่แล้ว

    When using the panda.ta (instead of ta) for the RSI, there are only 4 buy dates instead of 10+ as in the video. I am not sure why there is the discrephencies. Any idea?

  • @wickedgummybear3104
    @wickedgummybear3104 2 ปีที่แล้ว

    All strategies perform nice to very nice when there's a bull market. Unless you can start accounting for/predicting the market bull-bear-wise, all strategies will always fail.