I’ve made and back tested pseudo random strategies like this as a hobby for around five years. This is one of my favourite “recipe bases” for a strategy. And then all you need to do is change the random entry direction condition to something less random; choosing long or short based on the phases of the moon is a good variation, more profitable. 😂
Hi, commissions are taken into account in the backtest, check the backtester function there is a parameter "commission" you can increase and change the values for experimentation. ... also the daily timeframe is not usually affected by fees, because the range of the price is wide enough to easily cover up for trading costs, on lower timeframes however this becomes problematic.
@@CodeTradingCafe yea true but you got spread as well to factor in which changes throughout the day. In the daily timeframe I can see it working. I tried out the formula and threw it into high frequency bot so gains were small obviously. What's your tp/sl set at?
@@maxnator but your spread cost definitely increases as you increase lotsize and commission may depending on your plan with the broker. So yea I what you're saying. Are you running this code?
The intro mentions 14 stocks, 7 years of data, and a random entry. Stocks have postivite drift. Do your tests include a comparison to simply buying & holding these same stocks? (I bookmarked the video to finsh watching later :)
Yes, the random entries would indeed produce a random result. I think it's the trailing stop in a long term trending market that results in an average positive result. If this is true, the buy trades should outperform the sell trades.
But keep in mind that short trades are less common but usually more profitable, since they have shorter term duration but the price moves quicker that in longer term. In some stocks such for instance Tesla this strategy may work pretty nice. I'll give it a try with highly volatile stocks.
If you type in the tickers you'll see lot of them are not stocks, example QQQ is nasdaq index, JNK is junk bond etf etc.... Still a lot of American stocks in there which we know outperformed the world with hindsight bias.
@@Ricky_Micky_Dicky Yeah, instead of stocks I should have said 'equities'. Thats what happens when I reply before my morning coffee, lol. QQQ is an equity ETF, so in terms of positive drift it's the same as a stock (unless the stock is Enron, lol). A bond ETF should be okay, though I'm not sure about junk bonds. I do see Gold and Silver in there, so that's cool. All I'm saying is I've seen another vid on this channel bring up the subject of positive drift, so in other vids Forex and/or other non-equity assets were included in the tests. I was just wondering about this particular vid. Any decent test should IMO compare results against buy & hold. Love this channel so far. :)
Hi, New sub here. Your channel is great! I love watching these and running the code. I've noticed that I often don't get the same results as you. E.G., when I run this code with this data set, I get the following for the results: Aggregated Returns: 50.31% Number of Trades: 468 Maximum Drawdown: -6.63% Average Drawdown: -0.32% Win Rate: 49.14% Best Trade: 194.88% Worst Trade: -56.79% Average Trade: 2.19% Am I missing something? Thanks and please keep it up!!
Hi thank you for joining. I actually experiment a lot on the parameters before during and after the video recording, so the code is the same but sometimes parameters might be slightly different with different results, it must be a parameter changed at some point that influences the results, if you experiment a bit you might get same or even better results then those I share in videos.
Thanks for all your work, I have learned so much from you. I have an idea for a stock scanner that finds negatively correlated stocks in order to have an edge. I don't know if this is possible to code, but it is something different and food for thought.
Hi, thank you for your support! it's actually a cool idea, requires a bit more work than usual, but I will definitely add it to my list and think about it. Thanks again!
Suppose you opened Long trade and it hit Stop Loss, you ended the trade. Then your next immediate random signal is also Buy. Wouldn't make much sense, would it? If you filter that out should become better?
That’s definitely a solid approach! Pre-market scanners can be great for spotting high-volatility small caps, especially if they have fresh news catalysts. Liquidity and spreads can be tricky, though, so risk management is key. Have you tried this strategy before? Would love to hear if you did (also automating news analysis is... actually not that hard using OpenAI API, now I am thinking about this)
Definetly interesting, worth try on other emea markets. but the thing is how could be more succesful than the “predicting market direction” strategies? I guess random walk effect is highly stronger than we expect. I am losing faith in indicators 😂 I will share my results after testing them. Thank you for all code styling and approach 🙏💪🏻
Hi, thank you. Actually this video doesn't show that random is better than predicting the market. But it shows that risk management is crucial and it can make a strategy profitable even if you didn't guess the market right. I mean honestly this is not new but to see it in numbers is good. In my opinion the best would be combining both, a good indicator/confirmation and risk management together.
Can your backtest open positions on margin? Does your backtest count with the possibility of account liquidation? Do you count in the overnight consts and margin costs?
Yes, backtesting.py can simulate margin trading, No, by default, backtesting.py does not directly simulate account liquidation, only when the account is empty the simulation stops prematurely. By default, backtesting.py does not include overnight financing costs or margin interest. These are not natively built into the library. However, we can simulate these costs later after the backtest by accessing the trades list and modifying according to the history of each trade (time opened and so...).
I could but in order not to make you wait... support resistance and candles patterns on the daily timeframe yield the best systematic results, Bollinger bands on daily can also help squeezing a good entry point.
it shows max_drawdown = min([r["Max. Drawdown [%]" for r in results]) in both the vid and the code from the download link. shouldn't it be max_drawdown = max... instead? thanks
Hi I really enjoy your videos and I am thinking about making my own backtesting programs. Are you using these methods yourself and making money with some of them? And which programs work to place trades with python?
Hi thank you for your support! I use a combination of similar indicators/programs to send me alerts for trading opportunities, you can make money realistically around 10%-20% per year.
@@CodeTradingCafe Okay it makes sense that you don't automate the trades. Also, how is the profit percentage so much lower than in your videos. Is it only because of fees that feels wrong. Is it due to the fact that you inflate the win rate by brute forcing the best stop loss strategy in the past, which doesn't align with the future?
Commissions are set to 0.0002 (as per the recommendation of Backtesting documentation but this is for forex spread) I tried to increase to 0.0005 results don't change because daily timeframe has wide price range and so trades wins cover easily for spread and commissions, the problem becomes challenging if you are trying lower timframes.
This is a fantastic video, great job! Keep up the amazing work! It’s truly unfortunate that some people leave scam comments under such a valuable and well-crafted video. Your content deserves nothing but admiration and respect!
Hi, nice video as always but Im wondering if you ever put these ideas to work in a live market, It would be nice to see some theory applied to a real capital (nowadays there are platform that allows to start with small things). It seems to me that all these ideas work in the code but the actual environment would be totally different (especially in the downside). But keep up the good work!
Hi, definitely worth it, I can tell you out of experience, usually strategies on daily timeframe have higher chances to continue working on live data, however lower timeframes are more challenging mainly profits are eaten by fees, slippage and spread.
Hey I am trying to build a machine learning python trade signal bot that will try to predict if the market will move up or down for the next minute. But I am so new to this and don't literally know what to do. Is there any advice you can give me or a source that could teach me?
Sources plenty, but my advise is to learn for the long term, give yourself a year of learning then progress to coding strategies otherwise it might be frustrating and you risk dropping your projects.
@@CodeTradingCafe I’m finding it difficult deploying it bc my bot fetch live data from mt5 for the analysis . So mt5 needs to be always on before the bot can work. The brokers available in my location doesn’t have api functionality
Good 😊 can you make a futures trading strategy for the price action or any other way to do a very short timeframe scalping like for 1min 3min 5min or last 15min
If risk management was a thing that could be followed - one would have been out of the market soon after a 20% drawdown and never entered back again! No matter you start with 1% or 0.1% when you are losing more than winning your capital will start drawing down no matter what
Risk and trade management are the most important factors that can keep the odds on your side. 20% drawdown is because the leverage is high so the risk is high and it's not as managed as it should be, it's just presented here as an experiment.
@@CodeTradingCafe Look-ahead bias generally occurs when the timeframe of the indicators is larger than the timeframe of the orders. In general, what you're doing has no place in the real world, even if it is unfortunately the norm in the bizarre world of (wannabe) trading. There is no such thing as "signals" in the sense that entering at a certain time rather than another gives you an edge or increases either the "win rate" or the average trade profit. I suggest you actually trade with real money, starting small if you truly want to make your way into trading. These backtesting fantasies, where the strategy quickly curve-fits the data, will ultimately represent only a huge waste of time. If one day you do trade based on this approach (which I would not recommend), you will see firsthand what I mean.💞
Thanks again, but my question was about the look-ahead, it's a technical term used in data science for a specific case (time series analysis), where exactly did you spot a look-ahead in my code? The point of this video is taking a strategy (that is not mine by the way) and backtesting it on historical data instead of putting faith in the authors shared knowledge, I am not sure how this is a bad practice, the recipe is simple someone or somewhere a strategy is published I can code it and test it to assess its potential. Regarding me trading real money I have been doing this more than 15 years and I definitely don't trade all the strategies I publish on this channel simultaneously systematically and blindly :) Edit: I am checking again regarding your look-ahead answer related to using the indicators timeframe, the whole simulation was carried out on the same timeframe using only one simple random indicator, I am not sure what you mean, could it be your comment is meant for another video?
This works if you consider the market as totally random and can't be predicted. Actually this is nothing new and I really think could be the Holly Grial since profesional gamblers use an risk management approximation instead of looking for the perfect entry. There is plenty of "progression" strategies based on this concept to get the most from winning streaks when keep the loses under control. 👍🏼
Once again the code you provide is broken and not the code you run. I like your premise and the video is nice - but please provide the code you finally run to save me hours correcting your code. FYI, when I run your code I get the same error shown on your screen at the 7:50 mark. You have clearly corrected it before continuing recording. I also have corrected it but I get dramatically different results than you. My correction is likely not the same as yours. I have applied the code you show in the video which is substantially different to that provided btw. Not being able to replicate your results puts a BIG shadow on your reputation.
Dear David for the sake of my reputation :) I just downloaded the files from the link retested and everything is running well I got the results I was getting while making the video (the error you are referring to at 7:50 was solved by commenting the line "#tp_sl_ratio=[i for i in range(2, 3)]," but this was already corrected in the uploaded version). I suggest you redownload the code and run it as is the first time without any modifications just to make sure it's working. Concerning the results these are affected by the lot size (0.02 meaning 2%, you can increase up to 0.04 and the margin I suggest keeping 1/5 to limit the drawdown/risk) it should work. Here are the results of my backtest with the redownloaded files (and a lot size of 0.04): Aggregated Returns: 147.27% Number of Trades: 360 Maximum Drawdown: -20.40% Average Drawdown: -2.34% Win Rate: 44.22% Best Trade: 207.90% Worst Trade: -35.21% Average Trade: 1.44%
@@CodeTradingCafe when I take the code from the link and paste it in it says error and yes your code does look different from the code provided down below in the comments
Phenomenal idea. Random entry strategies are used as a referecnce for tresting real value strategies. But I would like to suggest that you try the effect of scaling in and scaling out of position size, because these are often missed parts of risk management. In particular scaling-in actually works like noise canceling headphones because scaling-in effectively amplifies signals and leaves noise un-amplified. I know that scaling-in and out is bit hard to code, but it would be very interesting to see the outcome.
Hi, thank you for sharing I think scaling is a great idea (I missed it in this video). We did code scaling out in previous videos (ua-cam.com/video/HClxCVvfXDM/v-deo.html at time 19:00) but not scaling in actually I find it more advanced somehow, mainly coding the decision when to scale in and by how much. I will probably make a video about this, wasn't really detailed on my channel so far. Thanks again!
@@CodeTradingCafe What I would say is that, for the benefit of completness, a video would be done where scalling-in and scalling-out should be done in the same video, just to make it easier to compare them and do pros and conns. Another very important thing is that in hte same video one should separately test scalling-in and scaling-out on breakout and meaan reversal strategies. Although one can guess it, but in the interest of testing rigour all x4 combinations should be done. This knowledge will pay off in spades when implemented in strategies developed in the near future. I'm guessing here but scalling in should have less impact on reversal strategies, while scaling-out will perform worst with breakout strategies because breakout strategies usually have low win rates, so scalling-out will accumulate large losses. But for the sake of the educational value for viewers this shoudl be proven with a tests.
@@CodeTradingCafe It is hard, but videos like this are worth the effort because they tend to rise your authority amongst your audience and they get lots of likes and comments so YT algo loves them. I get all your videos withing few minutes from release because of that.
Hi, honestly I code day and night, I grew up writing code since my teens almost 30 years ago an first I enjoy it... but then 10 years ago I also started making money from this, my question is why would I stop ? :)
I’ve made and back tested pseudo random strategies like this as a hobby for around five years. This is one of my favourite “recipe bases” for a strategy. And then all you need to do is change the random entry direction condition to something less random; choosing long or short based on the phases of the moon is a good variation, more profitable. 😂
actually I've heard about it before :) there is a whole "theory" around how the moon affects traders :) (I am not a follower just to be clear...)
Dude the issue is you're essentially building a hfts and back testing it without accounting for platform fees or spreads
You can just multiply the profits by a factor based on lotsize to account for commissions and spreads.
Hi, commissions are taken into account in the backtest, check the backtester function there is a parameter "commission" you can increase and change the values for experimentation.
... also the daily timeframe is not usually affected by fees, because the range of the price is wide enough to easily cover up for trading costs, on lower timeframes however this becomes problematic.
@@CodeTradingCafe yea true but you got spread as well to factor in which changes throughout the day. In the daily timeframe I can see it working. I tried out the formula and threw it into high frequency bot so gains were small obviously. What's your tp/sl set at?
@@maxnator but your spread cost definitely increases as you increase lotsize and commission may depending on your plan with the broker. So yea I what you're saying. Are you running this code?
Did you seriously call Daily chart hft?
Once again, thank you for your expertise and generosity
So nice of you, thank you for your support!
The intro mentions 14 stocks, 7 years of data, and a random entry. Stocks have postivite drift. Do your tests include a comparison to simply buying & holding these same stocks? (I bookmarked the video to finsh watching later :)
Yes, the random entries would indeed produce a random result. I think it's the trailing stop in a long term trending market that results in an average positive result. If this is true, the buy trades should outperform the sell trades.
But keep in mind that short trades are less common but usually more profitable, since they have shorter term duration but the price moves quicker that in longer term. In some stocks such for instance Tesla this strategy may work pretty nice. I'll give it a try with highly volatile stocks.
If you type in the tickers you'll see lot of them are not stocks, example QQQ is nasdaq index, JNK is junk bond etf etc.... Still a lot of American stocks in there which we know outperformed the world with hindsight bias.
@@gvidalcantavella shorts are generally more profitable in a shorter time frame on a per trade basis but over the long term not so much.
@@Ricky_Micky_Dicky Yeah, instead of stocks I should have said 'equities'. Thats what happens when I reply before my morning coffee, lol. QQQ is an equity ETF, so in terms of positive drift it's the same as a stock (unless the stock is Enron, lol). A bond ETF should be okay, though I'm not sure about junk bonds. I do see Gold and Silver in there, so that's cool. All I'm saying is I've seen another vid on this channel bring up the subject of positive drift, so in other vids Forex and/or other non-equity assets were included in the tests. I was just wondering about this particular vid. Any decent test should IMO compare results against buy & hold. Love this channel so far. :)
my goat is back with the educational content
Thank you lol :)
i really like your videos - so high in quality and clean in insight and code!
Happy to hear that! I appreciate your support.
Hi, New sub here. Your channel is great! I love watching these and running the code. I've noticed that I often don't get the same results as you. E.G., when I run this code with this data set, I get the following for the results:
Aggregated Returns: 50.31%
Number of Trades: 468
Maximum Drawdown: -6.63%
Average Drawdown: -0.32%
Win Rate: 49.14%
Best Trade: 194.88%
Worst Trade: -56.79%
Average Trade: 2.19%
Am I missing something?
Thanks and please keep it up!!
Hi thank you for joining. I actually experiment a lot on the parameters before during and after the video recording, so the code is the same but sometimes parameters might be slightly different with different results, it must be a parameter changed at some point that influences the results, if you experiment a bit you might get same or even better results then those I share in videos.
Thanks for all your work, I have learned so much from you.
I have an idea for a stock scanner that finds negatively correlated stocks in order to have an edge.
I don't know if this is possible to code, but it is something different and food for thought.
Hi, thank you for your support! it's actually a cool idea, requires a bit more work than usual, but I will definitely add it to my list and think about it. Thanks again!
I absolutely love this.
me too actually :) Thank you for your comment!
Suppose you opened Long trade and it hit Stop Loss, you ended the trade. Then your next immediate random signal is also Buy. Wouldn't make much sense, would it? If you filter that out should become better?
It makes sense what you are saying, but the purpose was to focus on the trade management rather than the strategy itself just to test the potential.
What about using runner ups higher volatile small caps on scanners pre market even check on to see if equity has news. Be worth a try.
That’s definitely a solid approach! Pre-market scanners can be great for spotting high-volatility small caps, especially if they have fresh news catalysts. Liquidity and spreads can be tricky, though, so risk management is key. Have you tried this strategy before? Would love to hear if you did (also automating news analysis is... actually not that hard using OpenAI API, now I am thinking about this)
did you use the algorithm in the real world trading? I wonder how is the performance.
I haven't this is not a full strategy it's just showing the importance of risk management
can you provide a code which work in tradingview.thanks
Hi, tradingview use pinescript language which I am not familiar with, you can translate some of my codes using chatGPT maybe it might be of help.
yea and tradingview doesn't have intra-bar entry/exit, so not good at backtesting this strategy
Definetly interesting, worth try on other emea markets. but the thing is how could be more succesful than the “predicting market direction” strategies? I guess random walk effect is highly stronger than we expect. I am losing faith in indicators 😂 I will share my results after testing them. Thank you for all code styling and approach 🙏💪🏻
Hi, thank you. Actually this video doesn't show that random is better than predicting the market. But it shows that risk management is crucial and it can make a strategy profitable even if you didn't guess the market right. I mean honestly this is not new but to see it in numbers is good. In my opinion the best would be combining both, a good indicator/confirmation and risk management together.
Can your backtest open positions on margin?
Does your backtest count with the possibility of account liquidation?
Do you count in the overnight consts and margin costs?
Yes, backtesting.py can simulate margin trading,
No, by default, backtesting.py does not directly simulate account liquidation, only when the account is empty the simulation stops prematurely.
By default, backtesting.py does not include overnight financing costs or margin interest. These are not natively built into the library. However, we can simulate these costs later after the backtest by accessing the trades list and modifying according to the history of each trade (time opened and so...).
Can you make a video on the top 3 most profitable strategies you’ve tested?
I could but in order not to make you wait... support resistance and candles patterns on the daily timeframe yield the best systematic results, Bollinger bands on daily can also help squeezing a good entry point.
it shows max_drawdown = min([r["Max. Drawdown [%]" for r in results]) in both the vid and the code from the download link. shouldn't it be max_drawdown = max... instead? thanks
Hi, well spotted, but no actually because drawdown is a negative number so we need to get its minimum value (its most negative value).
Hi I really enjoy your videos and I am thinking about making my own backtesting programs. Are you using these methods yourself and making money with some of them? And which programs work to place trades with python?
Hi thank you for your support! I use a combination of similar indicators/programs to send me alerts for trading opportunities, you can make money realistically around 10%-20% per year.
@@CodeTradingCafe Okay it makes sense that you don't automate the trades.
Also, how is the profit percentage so much lower than in your videos. Is it only because of fees that feels wrong. Is it due to the fact that you inflate the win rate by brute forcing the best stop loss strategy in the past, which doesn't align with the future?
It's mainly that I dare to increase the risk (leverage, trade size, ...) in the simulation but not in real trading hence the difference.
Sir can you make a video about binary option strategy
I will add it to my list but I will need time, lots of nice ideas in here :) thank you!
Great video, thanks!!
Glad you liked it! Thank you for your support.
How many trades and commissions?
Commissions are set to 0.0002 (as per the recommendation of Backtesting documentation but this is for forex spread) I tried to increase to 0.0005 results don't change because daily timeframe has wide price range and so trades wins cover easily for spread and commissions, the problem becomes challenging if you are trying lower timframes.
It's been some time since I watched your videos. I think I have a big list to recap. Hahaha!
I really enjoyed them.
Welcome back! Actually I remember last time you left a detailed technical comment that I still kept a copy of in my documents :)
@@CodeTradingCafe
Which trading is best ?
Depends on your style, for me daily timeframe is safest.
This is a fantastic video, great job! Keep up the amazing work! It’s truly unfortunate that some people leave scam comments under such a valuable and well-crafted video. Your content deserves nothing but admiration and respect!
Thank you so much for your support!
Similer to NNFX Trade Management. Cool stuff.
trade management is usually left aside by beginners but it's half of the trading effort.
Hi, nice video as always but Im wondering if you ever put these ideas to work in a live market, It would be nice to see some theory applied to a real capital (nowadays there are platform that allows to start with small things). It seems to me that all these ideas work in the code but the actual environment would be totally different (especially in the downside). But keep up the good work!
Hi, definitely worth it, I can tell you out of experience, usually strategies on daily timeframe have higher chances to continue working on live data, however lower timeframes are more challenging mainly profits are eaten by fees, slippage and spread.
Best platform ?
Trading
@NeeshaGaikwad forex fx
@Simran_Patel_123then you can try winprofx
It depends on your geolocation, try asking around you for this, it's better.
Thanks
Thank you for your support!
Hey I am trying to build a machine learning python trade signal bot that will try to predict if the market will move up or down for the next minute. But I am so new to this and don't literally know what to do. Is there any advice you can give me or a source that could teach me?
Sources plenty, but my advise is to learn for the long term, give yourself a year of learning then progress to coding strategies otherwise it might be frustrating and you risk dropping your projects.
Great Video
Glad you enjoyed it, thank you for your support!
Heres an idea try a strategy based on breadth indicators
Will check it out, thank you :)
I always appreciate the way you explain codes.
Thank you, it's really good to know.
Thanks for your videos. Pls can you make a full video from writing and backtesting a bot like this to deployment on cloud?
It might be a very long video, but also it depends on your geolocation because some brokers have different types of accounts depending on local laws.
@@CodeTradingCafe okay. Thank you
@@CodeTradingCafe I’m finding it difficult deploying it bc my bot fetch live data from mt5 for the analysis . So mt5 needs to be always on before the bot can work. The brokers available in my location doesn’t have api functionality
I see did you mean a bot in python that also uses mt5 ?
@@CodeTradingCafe yes. But can it be deployed?
Can you run demo account mt5 platform at least next vide with this strategy
Hi sorry I don't use mt5 nor mql5 not anymore :)
@CodeTradingCafe then which pllatfoam you use
@@CodeTradingCafe then your platform?
Python for signals and the rest it depends if I am at my desk or phone (Phone is just for monitoring not trading)
Good 😊 can you make a futures trading strategy for the price action or any other way to do a very short timeframe scalping like for 1min 3min 5min or last 15min
Hi, future trading yes, but I am not good in minutes timeframes, I could try.
@@CodeTradingCafe you can do it 💪❤
pls cover CRP & pivot points Franklin O. Ochoa
I will add it to my list, hopefully it's a good one :)
If risk management was a thing that could be followed - one would have been out of the market soon after a 20% drawdown and never entered back again!
No matter you start with 1% or 0.1% when you are losing more than winning your capital will start drawing down no matter what
Risk and trade management are the most important factors that can keep the odds on your side. 20% drawdown is because the leverage is high so the risk is high and it's not as managed as it should be, it's just presented here as an experiment.
new video, nice )
Thanks for the visit :)
It's called curve fitting and look-ahead, and only works as a fantasy in backtest 🤣
Thank you, can you please point out where exactly the look-ahead is happening? I would be grateful :)
@@CodeTradingCafe Look-ahead bias generally occurs when the timeframe of the indicators is larger than the timeframe of the orders. In general, what you're doing has no place in the real world, even if it is unfortunately the norm in the bizarre world of (wannabe) trading. There is no such thing as "signals" in the sense that entering at a certain time rather than another gives you an edge or increases either the "win rate" or the average trade profit. I suggest you actually trade with real money, starting small if you truly want to make your way into trading. These backtesting fantasies, where the strategy quickly curve-fits the data, will ultimately represent only a huge waste of time. If one day you do trade based on this approach (which I would not recommend), you will see firsthand what I mean.💞
Thanks again, but my question was about the look-ahead, it's a technical term used in data science for a specific case (time series analysis), where exactly did you spot a look-ahead in my code?
The point of this video is taking a strategy (that is not mine by the way) and backtesting it on historical data instead of putting faith in the authors shared knowledge, I am not sure how this is a bad practice, the recipe is simple someone or somewhere a strategy is published I can code it and test it to assess its potential.
Regarding me trading real money I have been doing this more than 15 years and I definitely don't trade all the strategies I publish on this channel simultaneously systematically and blindly :)
Edit: I am checking again regarding your look-ahead answer related to using the indicators timeframe, the whole simulation was carried out on the same timeframe using only one simple random indicator, I am not sure what you mean, could it be your comment is meant for another video?
I waitied until the end to see the equity curve, lol
Sorry and it wasn't as impressive :)
@@CodeTradingCafe Well after all it’s random entry. Just to prove solid MM foundation and exits.
This works if you consider the market as totally random and can't be predicted. Actually this is nothing new and I really think could be the Holly Grial since profesional gamblers use an risk management approximation instead of looking for the perfect entry. There is plenty of "progression" strategies based on this concept to get the most from winning streaks when keep the loses under control. 👍🏼
I agree this is not new, all trading books emphasize trade and risk management. This video only shows it a bit in numbers, straight experiment.
Once again the code you provide is broken and not the code you run. I like your premise and the video is nice - but please provide the code you finally run to save me hours correcting your code.
FYI, when I run your code I get the same error shown on your screen at the 7:50 mark. You have clearly corrected it before continuing recording. I also have corrected it but I get dramatically different results than you. My correction is likely not the same as yours. I have applied the code you show in the video which is substantially different to that provided btw. Not being able to replicate your results puts a BIG shadow on your reputation.
Dear David for the sake of my reputation :)
I just downloaded the files from the link retested and everything is running well I got the results I was getting while making the video (the error you are referring to at 7:50 was solved by commenting the line "#tp_sl_ratio=[i for i in range(2, 3)]," but this was already corrected in the uploaded version).
I suggest you redownload the code and run it as is the first time without any modifications just to make sure it's working.
Concerning the results these are affected by the lot size (0.02 meaning 2%, you can increase up to 0.04 and the margin I suggest keeping 1/5 to limit the drawdown/risk) it should work.
Here are the results of my backtest with the redownloaded files (and a lot size of 0.04):
Aggregated Returns: 147.27%
Number of Trades: 360
Maximum Drawdown: -20.40%
Average Drawdown: -2.34%
Win Rate: 44.22%
Best Trade: 207.90%
Worst Trade: -35.21%
Average Trade: 1.44%
@@CodeTradingCafe when I take the code from the link and paste it in it says error and yes your code does look different from the code provided down below in the comments
Great topic, thanks 👍
Glad you liked it!
Cool!
Thanks
mind blowing
Thank you for your comment :)
Phenomenal idea. Random entry strategies are used as a referecnce for tresting real value strategies.
But I would like to suggest that you try the effect of scaling in and scaling out of position size, because these are often missed parts of risk management. In particular scaling-in actually works like noise canceling headphones because scaling-in effectively amplifies signals and leaves noise un-amplified.
I know that scaling-in and out is bit hard to code, but it would be very interesting to see the outcome.
Hi, thank you for sharing I think scaling is a great idea (I missed it in this video). We did code scaling out in previous videos (ua-cam.com/video/HClxCVvfXDM/v-deo.html at time 19:00) but not scaling in actually I find it more advanced somehow, mainly coding the decision when to scale in and by how much.
I will probably make a video about this, wasn't really detailed on my channel so far. Thanks again!
@@CodeTradingCafe What I would say is that, for the benefit of completness, a video would be done where scalling-in and scalling-out should be done in the same video, just to make it easier to compare them and do pros and conns. Another very important thing is that in hte same video one should separately test scalling-in and scaling-out on breakout and meaan reversal strategies. Although one can guess it, but in the interest of testing rigour all x4 combinations should be done. This knowledge will pay off in spades when implemented in strategies developed in the near future.
I'm guessing here but scalling in should have less impact on reversal strategies, while scaling-out will perform worst with breakout strategies because breakout strategies usually have low win rates, so scalling-out will accumulate large losses. But for the sake of the educational value for viewers this shoudl be proven with a tests.
Will put this on my list although it's a lot of work to explain (the code is relatively simple, planning the video is more challenging)
@@CodeTradingCafe It is hard, but videos like this are worth the effort because they tend to rise your authority amongst your audience and they get lots of likes and comments so YT algo loves them. I get all your videos withing few minutes from release because of that.
It's on my list, hopefully I will free some time at some point.
Any forex trader here? Plz recommend me a reliable broker
WinprofFX is great 👍
You can give it a try
The best is to ask in your area because brokers have different platforms depending on you geolocation.
Exness
Why are you doing that? Seriously, is it some kind of weird hobby or you hope to magically make some money once day?
Hi, honestly I code day and night, I grew up writing code since my teens almost 30 years ago an first I enjoy it... but then 10 years ago I also started making money from this, my question is why would I stop ? :)
hey just curious if you got my email :)
I am getting so many emails really sorry if I drown :) afar