Automated Rayner Teo Bollinger Bands Strategy Optimized For High Return

  Рет қаралды 25,098

CodeTrading

CodeTrading

Күн бұрын

Пікірлер: 79
@MuhammadSRaniYah
@MuhammadSRaniYah 2 жыл бұрын
I can only say “I love you and your videos!”
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thank you for your support 😊
@JuanLopez-xe5vf
@JuanLopez-xe5vf 2 жыл бұрын
Nice video, I’ve been building something similar in backtrader. You could increase your trades by running over a larger set of symbols. Ie all futures, cryptos, ftse etc. it’s actually quite interesting to see the differences between markets. I forward test in 12 month intervals to validate robustness of parameters to minimise overfitting. Anyway just some ideas, keep up the good work.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thanks for sharing, yes the best is to decrease risk and test on different markets. Good luck!
@trimaz77
@trimaz77 2 жыл бұрын
Hi. I just watched all (38) CodeTrading videos. Very good presentation of the idea of ​​various strategies and their implementation in Python code. But the optimization in these presentations is all about manually sizing the parameters. Could you please present how to automate the process of searching for the optimal size of parameters.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi, thank you for your support! true I didn't automate it, for 2 reasons ... Sometimes it's time consuming computing wise when you have more than 4 parameters... Second it only leads to overfiting meaning the algo finds the perfect combination that works for past data but unfortunately not for future data and this is really disappointing. Best is to find a set of parameters that 'makes sense' with some kind of logic behind. At least it's my experience.
@TUFGM
@TUFGM 2 жыл бұрын
Seria possível fazer uma (IA) que analisasse o gráfico e pudesse prever a continuidade do movimento?
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi I did something close to your description it's a video about channel detection you can do it by checking the slope of the fits
@jroche1832
@jroche1832 7 ай бұрын
excellent video thank you. Question, how do you buy on margin? I know you need a margin account but how do you enter a trade with specific margin like 1:5?
@CodeTradingCafe
@CodeTradingCafe 7 ай бұрын
Hi, actually when you setup your account you need to specify the account leverage or margin, then it's fixed for all the trades you open through that account. This is why in the backtest it's a constant parameter in the function of the backtester.
@MM88HI
@MM88HI Жыл бұрын
Thank you for your hard work! Is it possible to show how to change the index that Backtrading uses from integer to date. It would be helpful to line up what Backtrading executed to actual dates.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you for your support, I actually did it in one of my previous videos, but shame on me I am not able to remember which one, I only remember I did it so we can compute the Sharpe ratio for the backtesting.
@MM88HI
@MM88HI Жыл бұрын
@@CodeTradingCafe thanks! Lol I guess I need to catch up with you other videos then. Looking forward to watching more of them today.
@jimparsons6803
@jimparsons6803 Жыл бұрын
My thanks for the clip. I don't recall whether or not which version of Python is used? Just started learning Python a few days back. The differences from one edition to another can be a little surprising and unexpected.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, thank you for your support. I have 3 python versions on my system I don't recap which one I used, I usually hover between 3.8 and 3.10, I don't think it makes any difference for the content shown in this video. Good luck!
@henson2k
@henson2k 2 жыл бұрын
Thank you for videos! How would you define choppy market?
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Good question ! Probably fitting a line on the last N candles the slope has to be close to zero and the ATR above a fixed limit, the parameters will depend on the asset and the timeframe.
@Ravi-ln7hy
@Ravi-ln7hy 2 жыл бұрын
Nice video... Is there a automated way to plot HH, HL, LL, LH with python...?
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thank you for your support, yes there is a way to select points/values and plot these, if I understand your question correctly, this video might be helpful kzbin.info/www/bejne/ppncZmp6j7R8rcU Good luck
@Ravi-ln7hy
@Ravi-ln7hy 2 жыл бұрын
@@CodeTradingCafe yes it's somewhat closer... I am looking to create something like this... I am not sure if it is correct... # fig.add_trace(go.Scatter(x=dfpl.index, y=dfpl.HH, mode='lines', name='HH')) # fig.add_trace(go.Scatter(x=dfpl.index, y=dfpl.LL, mode='lines', name='LL')) # fig.add_trace(go.Scatter(x=dfpl.index, y=dfpl.LH, mode='lines', name='LH')) # fig.add_trace(go.Scatter(x=dfpl.index, y=dfpl.LL, mode='lines', name='LL')) something like this... forexbee.co/wp-content/uploads/2022/01/Screenshot-572-1-760x417.png
@jdf2159
@jdf2159 2 жыл бұрын
Can I change the timeframe from daily chart to 1 minute chart?
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi I don't think it's going to work, that's huge difference!
@ZeroNonesense
@ZeroNonesense 2 жыл бұрын
Something is off, tried running on AAPL for 2015-01-01 until 2023-01-21 and the return % is negative. The strategy needs further optimization.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi, thank you for your feedback, did you use the daily timeframe?
@ZeroNonesense
@ZeroNonesense 2 жыл бұрын
@@CodeTradingCafe Yes, daily. Did not modify your code at all. I have my own version with some minor changes, however the win ratio is a little higher than 50%. By the way, I made a trading bot that works with Robinhood API, but after running it for about a month last year, I decided to switch it off, the results were 50/50. So now I am looking for different strategies, and came across your videos.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
There are many winning strategies but you have to find a low commissions broker/type of account. And yes I think the parameters should be optimized for the strategy in the video
@crystalwatertherapy
@crystalwatertherapy Жыл бұрын
inspiring videos, BRAVO
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Glad you like them! thank you!
@easwaraero7888
@easwaraero7888 2 жыл бұрын
hai sir , can you do robo for IQ OPTION / OLYMP TRADE like binary option concepts?
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi you can directly adapt this code for any market you desire. Good luck! Edit: check my last video for building a trading bot.
@easwaraero7888
@easwaraero7888 2 жыл бұрын
@@CodeTradingCafe can i contact you sir? please
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi, unfortunately I can't take any developments at the moment, lots of projects going on. But you can make it just walk through the videos.
@easwaraero7888
@easwaraero7888 2 жыл бұрын
@@CodeTradingCafe any other developers can u recommend,
@easwaraero7888
@easwaraero7888 2 жыл бұрын
@@CodeTradingCafe thanks for your responce
@Krisler12
@Krisler12 2 жыл бұрын
Drawdown of -95% or -45% or even -20-25% is inacceptable. Imagine you put $100.000 cash and after a while suddenly you see -$50.000, even -$20.000 it's a lot. Of course it gives to you +30.000% but this is just because you tested it on index funds or stocks and these have mostly an uptrend. Try to see how it works when there is a lot of variation and volatility like Forex scalping or anything thing else that is not mostly in uptrend.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Yes it's only shown for demo purpose only. First I would decrease leverage and have a steady curve up. Actually have you seen the first video of the Bollinger bands strategy? It has no drawdown. Let me know what you think.
@Krisler12
@Krisler12 2 жыл бұрын
I have seen all your videos already but I have just seen once more that one you are talking about. -28% drawdown is HUGE. Second, it is wrong to optimize parameters because it will find best settings for already known data but it will fail on new data because it is like AI it is optimized for what it already knows and trying to predict the future based on past data is wrong just because data doesn't repeat, it is different, the future data is different than the past data, that's why it is not working. Also, just two or three trades it is not enough, it must be more than 500 trades let's say at minimum because in real life it will do a lot of trades. Also, index funds or stocks have mostly uptrends and very few downtrends which means that there is no variation, no volatility and it will fail big when the economic situation is bad, in fact when it meets the real fluctuations and volatility. You should choose for testing assets with very high volatility and fluctuations which are very hard to predict and to trade and where there isn't any clear trend up or down. For this I think 1 minute data is very good which also allows you to do a lot of trades to see how it works in real life and in hard to predict conditions because these conditions appears even in a clear trend and bland situation and when they appear they will destroy your strategy if it is not prepared for them. Also, try to add a trailing stop to see how it works. Expecting a new vide from you on the subject! 🤗
@sChaikovsky
@sChaikovsky 2 жыл бұрын
@@Krisler12 you said that using past data to predict future is wrong because the future will not repeat. So my question to you is, what is the best strategy to trade? Where can I get profitable trading strategy? Or what can I do to trade profitably if this kind of approach or AI do not work.
@Krisler12
@Krisler12 2 жыл бұрын
I don't know. If someone will find the best way to solve this problem he or she will be a billionaire and the richest man in the world. I think just using a more general strategy that could work on many assets and a trailing stop and also a good money management strategy could somehow give a good strategy.
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
@@Krisler12 in my experience Real algos achieve 8% to 15% max per year, we're not talking leverage because it's not a good idea to increase risk. Some years returns are higher but that's just luck, normal automated systems are around 10% a year on average. I have discussed this with a real trading and investment company and this is the reality. Now other trading forms like high frequency or having access to restricted data can bring more power to the algorithm and this is where it gets interesting, but the data is restricted by law and money (have to be a certain type of registered company to ask access to advanced market data and you pay a lot for it annually). That being said it's still fun to try algos around, I tried recurrent neural networks recently I will post the code in a video... soon
@michaelmcnaughton1535
@michaelmcnaughton1535 8 ай бұрын
Yes but does it translate forward on the data not seen by the training/optimization. Don’t believe so.
@CodeTradingCafe
@CodeTradingCafe 8 ай бұрын
It's harder to make it work for low timeframes, but for some reason every strategy I tried on the daily time frame worked well but it's slow, one trade per month so we need to run on more assets ... so more money is needed in the account.
@melstadevosyan
@melstadevosyan Жыл бұрын
so basically you gain money when trend is going up and losing when its going down, if we find some way to not los money (buy when its still down trend) we will have higher wr for sure
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, thanks for sharing. As it is, yes you are right for the algo deals well with one trend direction. You can also have another algo tuned for downtrends and the 2 algos running together might be a good hybrid solution.
@thinketh2408
@thinketh2408 2 жыл бұрын
thanks
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thank you for your support
@jroche1832
@jroche1832 7 ай бұрын
What is interesting is that this model relies on margin without which you under perform B&H. With margin you expose yourself to a roller coaster of panic as every dollar loss is multiplied. Few can withstand that kind of pain.
@CodeTradingCafe
@CodeTradingCafe 7 ай бұрын
I agree it's not realistically tradable, on the B and H matter, it's really hard to find a strategy that beats BH for long term uptrending stocks like apple, amazon, microsoft, gold ... however BH is easily discarded on ranging or downtrending assets.
@daveb4446
@daveb4446 Жыл бұрын
15:1 margins and no fees included. So it’s purely hypothetical and not using real world conditions
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
I agree it's not an absolute estimate but it allows me to compare strategies and indicators together at some point we can retest a strategy if it looks promising adding commissions. Also trade management is very simple here it can be improved as well (this part I find fascinating)
@newbienoob1
@newbienoob1 2 жыл бұрын
Thank you sir the problem is u r using large timr data we want to get rich fast while sleeping hh😂😅 (as you said in 9ne of your videos )
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
I must make a video about this becoming rich fast issue 🙂 I get this question a lot as well.
@newbienoob1
@newbienoob1 2 жыл бұрын
@@CodeTradingCafe we know sir hhh just jocking make a video about getting rich while sleeping 😂😂😂
@newbienoob1
@newbienoob1 2 жыл бұрын
Getting rich in our dreams maybe 😂😂😂
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Well you can still make money while sleeping but not enough to be rich... Rich like buying a hotel a boat and a supercar, trading makes 20 percent return per year so it's limited. But again you can make some money out of it.
@1ndraNugraha
@1ndraNugraha Жыл бұрын
where is the code for mt5?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Sorry coding only in python these days.
@arunavadatta7734
@arunavadatta7734 2 жыл бұрын
it's just in a theory ..............practical case is totally different
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Yes this one is not advised for real trading, just a python exercise
@btoiscool
@btoiscool 3 ай бұрын
Are we just going to slide right past that drawdown 😂
@CodeTradingCafe
@CodeTradingCafe 3 ай бұрын
yep :) this is mainly what happens when greed pushes leverage up.
@kadourkadouri3505
@kadourkadouri3505 2 жыл бұрын
Unsurprisingly, the strat lost money during COVID outbreak (black swan event).
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
I didn't notice the link, might be true! Thank you for your comment
@Seeker_of_sense
@Seeker_of_sense Жыл бұрын
Very misleading. This market is already in a strong uptrend. It's hard not to make money.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
It's not misleading if you already know the strategy works in trending markets, other strategies work in ranging markets... there is no single strategy that works in all types of markets. But yes I understand that it can't be applied blindly to all circumstances, it simply wouldn't work. However the Bollinger entry trick does bring an advantage in most cases.
@geeamuza2375
@geeamuza2375 2 жыл бұрын
Hi @codetrading can you show how to use it on Crypto exchange like coinbase or other please. thank you for the videos
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Hi it's possible only if the platform has python API, like binance for example for the rest I have to check
@geeamuza2375
@geeamuza2375 2 жыл бұрын
@@CodeTradingCafe Thank you do have video to show how to use on binance please. Much appreciated
@1cBoris
@1cBoris 2 жыл бұрын
Hi you can use ccxt library
@lennard4454
@lennard4454 9 ай бұрын
4:15 this isn't good practise. one should not use python lists and slow for loops but perform the operations directly on the dataframe: df['EMA_SIG'] = np.nan df.loc[df.EMA_1 < df.EMA_2, 'EMA_SIG'] = SIG_BEAR df.loc[df.EMA_1 > df.EMA_2, 'EMA_SIG'] = SIG_BULL
@CodeTradingCafe
@CodeTradingCafe 9 ай бұрын
Hi, thank you, I agree vectorized approach is more efficient.
@sspmetal
@sspmetal 2 жыл бұрын
Try this code on h1 timeframe
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Someone did they told me it's highly profitable!
Rayner Teo Bollinger Bands Strategy Backtest In Python High Return
23:29
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Automated Price Break Out Detection: Algorithmic Trading In Python
16:34
Live Trading Bot Strategy In Python
14:57
CodeTrading
Рет қаралды 74 М.
TOP 5 Bollinger Bands SECRETS (MUST SEE!)
15:29
Fractal Flow - Pro Trading Strategies
Рет қаралды 337 М.
GPT: KAMA Scalping Strategy in Python Makes 795%
21:00
Algo-trading with Saleh
Рет қаралды 33 М.
Bollinger Bands Trading Strategy: How to Trade it Like a PRO
8:56
Mastering SUPPORT & RESISTANCES using Python!
11:42
Algovibes
Рет қаралды 26 М.
LSTM Top Mistake In Price Movement Predictions For Trading
9:48
CodeTrading
Рет қаралды 110 М.