Automated Rayner Teo Bollinger Bands Strategy Optimized For High Return

  Рет қаралды 23,149

CodeTrading

CodeTrading

Күн бұрын

Пікірлер: 77
@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
@kadourkadouri3505
@kadourkadouri3505 Жыл бұрын
Unsurprisingly, the strat lost money during COVID outbreak (black swan event).
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
I didn't notice the link, might be true! Thank you for your comment
@jacekmikolajczyk6661
@jacekmikolajczyk6661 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.
@lennard4454
@lennard4454 5 ай бұрын
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 5 ай бұрын
Hi, thank you, I agree vectorized approach is more efficient.
@MuhammadSRaniYah
@MuhammadSRaniYah 2 жыл бұрын
I can only say “I love you and your videos!”
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thank you for your support 😊
@arunavadatta7734
@arunavadatta7734 Жыл бұрын
it's just in a theory ..............practical case is totally different
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Yes this one is not advised for real trading, just a python exercise
@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!
@TUFGM
@TUFGM Жыл бұрын
Seria possível fazer uma (IA) que analisasse o gráfico e pudesse prever a continuidade do movimento?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
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
@ZeroNonesense
@ZeroNonesense Жыл бұрын
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 Жыл бұрын
Hi, thank you for your feedback, did you use the daily timeframe?
@ZeroNonesense
@ZeroNonesense Жыл бұрын
@@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 Жыл бұрын
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
@1ndraNugraha
@1ndraNugraha 10 ай бұрын
where is the code for mt5?
@CodeTradingCafe
@CodeTradingCafe 10 ай бұрын
Sorry coding only in python these days.
@jdf2159
@jdf2159 Жыл бұрын
Can I change the timeframe from daily chart to 1 minute chart?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi I don't think it's going to work, that's huge difference!
@henson2k
@henson2k Жыл бұрын
Thank you for videos! How would you define choppy market?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
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.
@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.
@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
@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.
@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)
@jroche1832
@jroche1832 3 ай бұрын
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 3 ай бұрын
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.
@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.
@michaelmcnaughton1535
@michaelmcnaughton1535 4 ай бұрын
Yes but does it translate forward on the data not seen by the training/optimization. Don’t believe so.
@CodeTradingCafe
@CodeTradingCafe 4 ай бұрын
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.
@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!
@easwaraero7888
@easwaraero7888 Жыл бұрын
hai sir , can you do robo for IQ OPTION / OLYMP TRADE like binary option concepts?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
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 Жыл бұрын
@@CodeTradingCafe can i contact you sir? please
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
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 Жыл бұрын
@@CodeTradingCafe any other developers can u recommend,
@easwaraero7888
@easwaraero7888 Жыл бұрын
@@CodeTradingCafe thanks for your responce
@sspmetal
@sspmetal 2 жыл бұрын
Try this code on h1 timeframe
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Someone did they told me it's highly profitable!
@thinketh2408
@thinketh2408 2 жыл бұрын
thanks
@CodeTradingCafe
@CodeTradingCafe 2 жыл бұрын
Thank you for your support
@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.
@jroche1832
@jroche1832 3 ай бұрын
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 3 ай бұрын
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.
@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
@crystalwatertherapy
@crystalwatertherapy Жыл бұрын
inspiring videos, BRAVO
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Glad you like them! thank you!
Rayner Teo Bollinger Bands Strategy Backtest In Python High Return
23:29
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 24 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 16 МЛН
How Trading Changed My Life (THE TRUTH)
17:49
Rayner Teo
Рет қаралды 55 М.
The Right Way to Trade Bollinger Bands
4:20
MoneyShow
Рет қаралды 148 М.
Automated RSI Scalping Strategy Tested In Python
33:32
CodeTrading
Рет қаралды 15 М.
Swing Trading Strategy | Bollinger Band | Siddharth Bhanushali
21:10
SIDDHARTH BHANUSHALI
Рет қаралды 77 М.
Build a Bollinger Bands and RSI Trading Strategy Using Python
26:52
Computer Science
Рет қаралды 13 М.
Automated Price Action Trading Strategy In Python
32:48
CodeTrading
Рет қаралды 48 М.
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 24 МЛН