avatarShunyu (Andy) Tang

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

9937

Abstract

ers now, they can be. If I had to give an example, algorithmic trading has solved a lot of these emotional and cognitive biases. Even human errors could be a form of cognitive bias, which is, let’s say you’ve made an error on your position sizing and you ended up trading ten times more than what you wanted and you lost ten times more. So trading really must be framed so that these biases have limited strength to hurt your whole process.</p><p id="4f6f">SHUNYU: Right. So essentially you’re saying you want to eliminate the bias when you’re trading, and going with the bias, there’s also the emotion. You mentioned that you want to be emotionless when you’re trading.</p><p id="d88a">SOFIEN: Exactly.</p><p id="ea8c">SHUNYU: How does emotion impact your trading?</p><p id="bb6c">SOFIEN: Basically, emotion will push you towards, let’s say, ending the trade a little sooner than expected or a little later than expected. Sooner than expected when you are approaching your target that you have initially set, and then you will gain, let’s say, slightly less money than expected. This will hurt your risk-reward ratio, and similarly, when the trade is out of your favor, you will wait a little more before stopping out and then you will lose a little bit more money than you would have lost if you respected the initial stop-loss. So the risk-reward ratio will quickly degrade, and this is mostly the impact of emotions on trading. After all, it’s your money. You are stressed, you don’t want to lose money. This is a game of money is always important and you don’t want to risk and lose that because it also hurts your ego, not just your portfolio.</p><p id="a3bc">SHUNYU: Yeah, yeah. So as you’re trading in the stock market, how do you obtain your information, like what stocks to trade, and what active stocks are there? How do you get that information?</p><p id="f699">SOFIEN: I mainly use a screener. I mean as I said, I’m mostly in currency trading more than stocks but I just use a technical screener for certain configurations that I like and of course, I keep and I always look at my favorite markets for certain patterns that I like that I try to detect manually, but of course, with the help of algorithms, it’s much more efficient now. You get your alerts, you get your configuration that you have backtested, and you trust, so that all you have to do is just validate the trade. You enter it and then you just wait and let’s say you take care of the risk management part more than just manually checking every market every day and then choosing the one that fits you better. This is also the power of algorithms which help you gain a lot of time by automating these processes.</p><p id="2263">SHUNYU: Yeah, so could you mention more about the algorithms that help you find which stocks to trade? Because that seems really interesting.</p><p id="0596">SOFIEN: Absolutely. For example, my latest algorithm that I use, it’s just a simple technical indicator that I’ve coded, which has shown a lot of promise considering support/resistance zones that come from technical analysis. This algorithm just simply takes a few simple rules that use pivot points, that uses a bit of volatility, a bit of supply/demand zone, and of course outputs a message saying: Okay, hey, this is a support. The market is probably showing bottomish configuration or topish configuration, and then when you look at that, you will say: Okay, this is the first step. What do I do next? I check the other technical indicators. I check the timing indicators. I check everything that I want to see in a trade, and then, of course, I check the risk, I check my fundamental bias, the sentiment bias, and of course, entering into a trade takes a lot of time. It’s not really directly put, but of course, by time, it becomes quicker, and these things, you have them in your head. Fundamental bias, you already have it. You’re not going to start from scratch every time you look at a chart and say: Okay, Japan has this balance of trade, blah, blah, blah, blah. All of these things are already in your head and you’re just mainly checking for these new configurations that you want to combine with your techniques and hope that the trade goes in your side and you will manage the trade accordingly when it’s in progress.</p><p id="5f38">SHUNYU: Yeah. And these algorithms are coded inside of TradingView?</p><p id="0935">SOFIEN: Well, TradingView, I share them in TradingView because I code them in py scripts so that I can share them with everyone. But mostly I code them personally in Python so that I can see them. In TradingView, I just share them so that everyone can see them. But I’m just aware that in TradingView, you can actually code the alerts so that even people who can look at these indicators get these alerts. Soon, I will code these alerts for everyone so that they can get these alerts also, because, at the moment, I’m the only one who gets them because they are in Python and in my computer. But I’m hoping that I will code the alerts soon in TradingView so that everyone gets a chance to see these algorithms in action.</p><p id="1592">SHUNYU: Yeah, thanks. That’s nice. So here we have another moderation, another</p><p id="6e10">SOFIEN: Yeah.</p><p id="b343">SHUNYU: A person that wants to speak with us. I’ll approve that. And if you look in the questions, there are also some questions in the chat, and since it’s been 15 minutes, we can start by looking at the questions as well. For example, one of them says: Please elaborate on the positioning strategies you mentioned during scaling in and out.</p><p id="1c44">SOFIEN: Can you repeat? Sorry.</p><p id="6890">SHUNYU: Please elaborate on the positioning strategies you mentioned during scaling in and out.</p><p id="8af9">SOFIEN: Ah, sure. Well, I assume you’re talking about the position sizing.</p><p id="abb9">SHUNYU: Yeah.</p><p id="86cd">SOFIEN: So, for example, one technique that I personally use, of course, the other ones are also good, like Kelly criterion and the fractional portfolio. One technique that I like to use is to reward the winning streak and to, let’s say, penalize the losing streak. For example, I take a small normal function which increases my trading positions by a small factor or let’s say medium factor every time I win, meaning that when I’m on a winning streak, for example, if I’m, let’s say, trading a currency pair, it’s going good because my strategies work well in a ranging configuration. This currency pair continues to be in a sideways configuration, so I’m winning, winning, winning, winning, and as I win, this position sizing algorithm will take into account and say: Okay, this is a ranging structure. The strategy likes this, so I’m going to increase a little bit so that the position sizing increases as the trading occurs during the sideway configuration so that I can profit more from this configuration. But the moment, of course, I start losing because let’s say, for example, the currency starts trending, this algorithm will penalize and say: Okay, this is a trending configuration. Now maybe let’s reduce it as we are losing on let’s say five of the last eight trades. So it will penalize whenever the market regime isn’t in tandem with my trading strategy and it will reward it and try to maximize the profit because really these trading windows are short and you know market regimes do not last for long, and so if you can maximize your profit during these configurations it would be best, and of course, if you minimize your losses during, let’s say bad market condition, it would be good. But of course, this comes with a lagging factor that you have to admit. Personally, the lagging factor is not that damaging and I’m seeing that it’s doing more good than harm considering that I’ve tested the other strategies like Kelly criterion or the fractional portfolio, which is really a simple one. It’s just a percentage of your portfolio as it goes down or up.</p><p id="5d21">SHUNYU: Nice explanation. The next question is: Can you expand on how you track smart money?</p><p id="5ac1">SOFIEN: Yes. That’s a really good question. I was hoping someone asks that. So smart money is basically another way of saying let’s say hedge funds or big asset management pouring in the market from their own pockets, and tracking this smart money can be done. My preferred way is to use the Commitment of Traders report. I take, for example, if I want to, let’s say, I don’t know, let’s say the Sterling, so the GBP, I want to track if the smart money is pouring a lot of GBP, let’s say buying a lot of GBP, meaning that it will increase in value. I will take the Commitment of Traders report. I will apply some strategies such as normalizing the report between 0 and 100 and see when it’s too low, and when it’s too high. I also look at the trends. I also separate this Commitment of Traders report into, let’s say, producers/consumers, because even though it’s a bit complicated, this report, but really, you can simplify it because it’s composed of huge speculators, producers, consumers, and if you can understand where they’re putting their money and where they are pivoting, then you can actually start getting these trends as early as possible. Another way of using this COT report or the Commitment of Traders report is actually by time series analysis because these reports, these values of reports, because they are just values updated every week, they are stationary, meaning that you can apply time series analysis on these reports here and actually get a lot of interesting signals because I also apply pattern recognition on these COT values and get nice signals which could actually sometimes be market tops and market bottoms. So the COT is one of the smart money finders. I also use the put-call ratio. I use the Gamma Exposure Index. So this is a very good equity sentiment indicator. And to conclude, I also use the mayb

Options

e it’s not really considered as a sentiment indicator, it’s both fundamental and sentiment, but I use the ISM PMI indicator and try to detect tops and bottoms because this economic indicator is greatly correlated to the US GDP, so really it’s correlated also with the equity market, so there’s a lot of interesting stuff to be done with these types of indicator. But definitely my favorite one and the one that I use every week is the COT report.</p><p id="d6e5">SHUNYU: Thanks. COT report. Okay. The next question is something I also wanted to ask, and it’s about: When you say long term, how long are you referring to? What is the certainty of a strategy working now to change X years down the road?</p><p id="859a">SOFIEN: Well, long term, personally long term, when I say long term it means between, let’s say six to twelve months, even though long term could actually mean five to ten years. But I say long term because I want to let these monthly or weekly indicators do their own, let’s say, magic and lead the way for the market to do its thing also. So if I say long term, I would say six to twelve months. And to answer your other question: What’s the certainty of a strategy working now to change X years down the road? I would say as long as you keep seeing in real life, you know, approximately the same results as what you backtested, of course, it will never be the same because backtesting results are mostly either biased or not exactly accurate, but as long as you keep seeing adequate results, let’s say during a certain standard deviation between the expected results, you can probably do a small statistical analysis that tells you whether you are in the normality of your previous results. I think you’re good. But of course, down the years, a lot of strategies stop working and this is why you have always to keep discovering new strategies, improving the current ones, and updating their parameters, since the markets are quite chaotic and a lot of new variables: fundamental, technical, quantitative variables enter into the equation. So you always have to update these strategies once you see, of course, a change in the results, that is a bit outside of this normality that you have set for yourself.</p><p id="4bc3">SHUNYU: Yeah, so essentially you’re talking about the model drift.</p><p id="73c4">SOFIEN: Yeah.</p><p id="6d7d">SHUNYU: Like in AI, you have to retrain the model every now and then to</p><p id="2938">SOFIEN: Exactly.</p><p id="ce42">SHUNYU: match up with the market. The next question is: Of all the technical indicators and authors you have studied, which ones would you recommend?</p><p id="5b9a">SOFIEN: Ah, nice question. I would recommend two people. First of all, Tom DeMark. Tom DeMark has a really good indicator that really shaped my timing and pattern recognition indicators. It was really the basis of it all. It’s called the TD Sequential and the TD Combo of Tom DeMark. and I highly recommend you take a look at these two indicators, study them, backtest them, and of course, improve them. They are used to time market tops and bottoms. Of course, nothing works in perfection and you have to work from these indicators and, of course, try to develop a strategy that leverages them. But they’re really good, and I highly recommend Tom DeMark’s indicators. The second one would be Scott Carney because he also shaped my price action trading when I started reading his books, let’s say, a few years ago. And it’s definitely harmonic patterns, such as the 5–0 pattern. It’s my favorite pattern. I constantly use this pattern. It’s really good. And I highly recommend you take a look at the 5–0 harmonic pattern. This is Scott Carney’s discovery, and it’s a really interesting pattern, especially when combined with other technical indicators.</p><p id="94b5">SHUNYU: Great. Next, we have a final question, and then there are also some speakers that want to join us. We’ll ask this question first.</p><p id="5d52">SOFIEN: Sure.</p><p id="00fd">SHUNYU: What charting program do you use?</p><p id="1bb4">SOFIEN: I use a lot of charting programs, which is not exactly the optimal thing to do. I use a lot of TradingView. I use an in-house charting software at work. I also use MetaTrader 5. So basically I use, let’s say, three charting softwares, and sometimes when I’m on Bloomberg, I use their charting platform there, even though it’s not the best. But if I had to choose, it would be TradingView. Why? Because there’s a lot of markets. There are a lot of indicators. You can code your own indicators. Of course, you can do that in MetaTrader 5 as well, but the coding language in TradingView is much more user-friendly, so it’s easier for you to quickly pick up on it and start coding your own technical indicators. You definitely don’t have to be a coding wizard to be able to code something in TradingView.</p><p id="1073">SHUNYU: Yeah, definitely. Alright, so now we have some people in the moderation tab, so I will approve this first. Yeah so if you want to speak with us, you can speak with us. And also, time seems to be running out. We have, like, three minutes left. Hello.</p><p id="7d02">SOFIEN: I think she’s on mute. Alright, should we continue? You have two minutes left if you have any other questions.</p><p id="b5c4">SHUNYU: Yeah, yeah. Do you have any memorable trading experiences that you want to share?</p><p id="eb0f">SOFIEN: Yeah, a big fat finger trade that I did when I started trading, I think it was two weeks into trading. This was back in 2016 or 2015. I traded ten times, the lot I was supposed to do, and I freaked out, and I didn’t know what I was supposed to do, so I let it, which was a huge mistake, of course. Should have closed it directly, but after 15 minutes, by miracle, it was on breakeven, so I closed it. And then the view actually went in my favor, so I could have gained a lot of money. But of course, there’s absolutely no regret. I was extremely lucky that I didn’t really lose it all, and from there, I started reading up on cognitive biases, and really these types of mistakes are what shape your trading.</p><p id="c827">SHUNYU: Yeah, so you want to avoid losses</p><p id="acbb">SOFIEN: Yeah.</p><p id="ee61">SHUNYU: to be a profitable trader. Yeah. Another thing is: What initially sparked your interest into trading?</p><p id="7de4">SOFIEN: I like analysis and I like challenges, so we can agree that financial time series exhibit a lot of randomness in them, so actually analyzing them is a challenge. And when you write, you’re quite happy with it, and it gives you the opportunity to make money or to make people make money. So that’s basically the main attraction, which is data analysis of a semi-random, really tough-to-predict system, and of course, you have the opportunity to make money out of your ideas, out of your creations, and of course, you can also help people make money or make money together.</p><p id="7637">SHUNYU: Yeah, so you want to share knowledge</p><p id="0626">SOFIEN: Yes.</p><p id="6be1">SHUNYU: and help people.</p><p id="8199">SOFIEN: Exactly.</p><p id="e1f8">SHUNYU: Great.</p><p id="c721">SOFIEN: I just want to say thank you, Matt Mathai, for your kind words, and Ed Corack also, thank you for what you said.</p><p id="26b4">SHUNYU: Yeah. Okay, it seems like we are out of time, and I apologize if you wanted to speak and you couldn’t speak. Might be, like, a software glitch or something.</p><p id="9369">SOFIEN: Yeah, for the moderators, maybe. Well, I think it’s working now.</p><p id="4367">SHUNYU: Hello?</p><p id="244b">SOFIEN: Nah, no.</p><p id="e4d1">SHUNYU: Aw, unfortunate.</p><p id="9a58">SOFIEN: Alright, well, thank you very much, Andy.</p><p id="aac7">SHUNYU: Yep.</p><p id="aa87">SOFIEN: It was a pleasure meeting you. Good.</p><p id="b1f3">SHUNYU: Thank you, everyone, for your attendance, and we really appreciated your comments, and if you haven’t done so already, please check out my website, <a href="https://daytradewithai.com/"><i>DayTradeWithAI.com</i></a>, and sign up for the mailing list so you get notified when the book is released in August. And also check out one of Sofien’s latest books, <a href="https://www.amazon.com/Mastering-Financial-Pattern-Recognition-Sofien-ebook-dp-B0BJNQ13QN/dp/B0BJNQ13QN?_encoding=UTF8&amp;me=&amp;qid=&amp;linkCode=sl1&amp;tag=sofien-20&amp;linkId=6ed782c3a05addb60c17c5423a0a2695&amp;language=en_US&amp;ref_=as_li_ss_tl"><b><i>Mastering Financial Pattern Recognition</i></b></a>. It’s a really nice book.</p><p id="a933">SOFIEN: I’m looking forward to your book, Andy. Thank you very much.</p><p id="eb06">SHUNYU: Thank you all for coming, and we hope you enjoy your next session.</p><p id="773d">SOFIEN: Bye, everyone.</p><p id="15bf">Subscribe to DDIntel <a href="https://ddintel.datadriveninvestor.com/">Here</a>.</p><p id="8a0f"><a href="https://ddintel.datadriveninvestor.com/"><i>DDIntel</i> </a>captures the more notable pieces from our <a href="https://www.datadriveninvestor.com/"><i>main site</i></a> and our popular <a href="https://medium.datadriveninvestor.com/"><i>DDI Medium publication</i></a>. Check us out for more insightful work from our community.</p><p id="6e52"><a href="https://www.aitoolverse.com/register">Register </a>on AItoolverse (alpha) to get 50 DDINs</p><p id="d7da">Support DDI AI Art Series: <a href="https://heartq.net/collections/ddi-ai-art-series">https://heartq.net/collections/ddi-ai-art-series</a></p><p id="9b9d">Join our network here: <a href="https://datadriveninvestor.com/collaborate">https://datadriveninvestor.com/collaborate</a></p><p id="08c2">Follow us on <a href="https://www.linkedin.com/company/data-driven-investor"><i>LinkedIn</i></a>, <a href="https://twitter.com/@DDInvestorHQ"><i>Twitter</i></a>, <a href="https://www.youtube.com/c/datadriveninvestor"><i>YouTube</i></a>, and <a href="https://www.facebook.com/datadriveninvestor"><i>Facebook</i></a>.</p></article></body>

The State of Algorithmic Trading

My 1:1 Interview with Sofien Kaabar, CFA from Medium Day 2023

Below is a transcript of my 1:1 interview with Sofien Kaabar, CFA from Medium Day on August 12, 2023. You can watch the video below.

SOFIEN: Alright.

SHUNYU: Hello everyone, welcome to our session. My name is Shunyu Tang. I go by Andy. I’m a Medium writer who writes at the intersection of trading and data science. And currently, I’m wrapping up my book called Day Trade With AI, and that’s expected to come out this month. And today, I have the pleasure of interviewing Sofien Kaabar, CFA. Sofien, would you like to introduce yourself?

SOFIEN: Sure, thank you, Andy. My name is Sofien Kaabar. I have been writing for Medium since 2020 and I’m an institutional technical analyst. So my job is all about technical analysis, quantitative trading, and everything related to financial markets.

SHUNYU: Nice. So for the audience here, our session will be broken up into two parts. In the first 15 minutes, Sofien and I will discuss some prepared topics and in the last 15 minutes, we’ll open up the talk to questions from the audience. So leave your comments in the Q&A box, please. So, to begin, I’d like to start by discussing the title of our talk: Unveiling the Paradox: When Modern Finance Theory Meets Modern Data Science. We all know that making money in the stock market is no easy task. Modern finance theory says that the market is efficient and there is no arbitrage. But if the market is efficient and the price falls a random walk, how can we convince ourselves that the algorithmic models developed by data science techniques have detected the arbitrage opportunities? Well Sofien, what are your thoughts on this paradox?

SOFIEN: Well, there are a lot of schools and thoughts about this, but I think every opinion is valid. There are always opportunities in the market, be it arbitrage or even passive strategies that can outperform sometimes and add alpha, what we call value. So I think it depends always on the view of the person thinking about it or trying to discover it because basically a lot of people get mixed results, a lot of people get different results, and at the end of the day, what works for you is what fits your risk-reward profile, what fits your time horizon profile. So I think everything is valid as long as you make it fit into your profile and of course, if you respect a lot of, let’s say, basic risk management rules or anything that doesn’t ruin your capital.

SHUNYU: Yeah. So since you talked about risk management rules, what kind of risk management rules would apply to your trading strategies?

SOFIEN: I mean, to be quite honest basic risk management rules remain the best, even though there are certain of course, specificities about trading strategies. Personally, what I use is, of course, as every trader out there: stop-losses, trailing stops, and of course, target profits. But I also combine them with something that I really like: volatility management plus position sizing. And by volatility management I mean that of course, I can take, let’s say, an indicator that measures historical volatility like the average true range or even a simple measure of the standard deviation of closing prices or median, let’s say, between high and low prices. I take that and of course, I incorporate that into the stops and the targets because from time to time the trades or the price action that occurs is really a function of the recent volatility so that when you enter a trade and you take into account volatility, you will have reasonable stops and targets. And at the same time, if you size your positions accordingly, for example, according to your recent results or conviction or any other, let’s say, quantitative measure, you’ll be able to have that small edge that in the long term will improve your results. So, to conclude, it’s basic stop-losses, some volatility management mainly driven by the ATR short term, ATR long term, ATR whatever fits your profile and of course sizing the positions because equal position sizing is sometimes not the best, and there are a lot of ways to improve that, for example, the Kelly criterion, the Hit ratio method, or let’s say the fractional position sizing of your portfolio.

SHUNYU: Right. So I see in the moderation there’s someone who wants to join us, so let’s approve that.

SOFIEN: Alright.

SHUNYU: So I know we’re aware that different stocks have different kinds of volatilities. There are low floats and high floats. In your trading strategies, what kind of stocks do they apply to?

SOFIEN: I mean, I’m mostly into currency pairs, but if I have to take stocks, the strategy I use, it’s mostly 80% contrarian strategies. So I would most likely take stocks that are mean reverting. And when I say mean reverting, I don’t mean the nonstationary properties of the prices, but of course the bigger picture of the ranging nature of a certain stock. We know that mostly in the long term stocks do trend. This is why my strategies are mostly applied to currency pairs, which are more, let’s say, range in nature. This is why I fit these volatility indicators to my strategies so that they are better suited toward sideways configurations or let’s say ranging markets.

SHUNYU: Yeah, nice. All right, so we have Sriram. Do you have anything to tell us? Oh, okay. Alright, next. So many people think that trading and gambling are really similar. So what do you think separates these two kinds of disciplines?

SOFIEN: I have three points that I follow consistently so that there’s a fine line between trading and gambling. First of all, it’s the one that we just discussed: risk management, meaning that when you trade you have to take into account these basic and advanced risk management tools so that you have that slight edge, which over the long term will give you more confidence and of course will prevent your capital from collapsing. The second point is that fundamental bias you have when you take into account, for example, your trades, because personally, I don’t really intraday trade, mostly swing or even like, let’s say, multi-week trading. This is why fundamental bias is quite important. You have to know what you are trading. You have to know, for example, if the market drivers, if the true market drivers, like fundamentals, are really going to push this trade into the expected direction, then you have that fundamental edge you have to always keep by your side. The third point, which is kind of my favorite point, it’s the sentiment edge. And basically, this is like following the smart money, trying to understand where the smart money is pouring their funds into. So you have to really be on that side because eventually that’s what will drive the market’s price, and of course, the other two would definitely help in the long term. So, three points: risk management, sentiment analysis, and fundamental edge.

SHUNYU: Nice. Yeah, I agree. Sriram looks to be back.

SOFIEN: I think he’s on mute.

SHUNYU: Yeah.

SHUNYU: Well, we can continue on with the gambling and trading kind of thing. So you mentioned a lot recently, I noticed your articles mentioned psychology, and psychology plays a big part in trading. So could you explain how psychology plays its part compared to gambling?

SOFIEN: Well, after all, we’re all humans and we have certain emotional or cognitive biases that could eventually hurt our trading. Basically, by time we will learn how to understand these biases and control them, even though some do require a bit of help from the algorithms. If I had to give a simple example, we have loss aversions, meaning that we really don’t want to lose. Sometimes when we see a position going out of our favor, so let’s say we are about to get stopped, we tend to, let’s say, okay, I’m going to wait a while for this one because I’m sure it’ll pick up, but of course, eventually it probably never will and then I will lose much more money than I’ve expected initially. But of course, by computers and algorithms, setting automatic stop-loss could help shape, let’s say could help limit these losses. There are a lot of biases that are there to stop us from making money, for example, confirmation bias: when you really are looking for these, look everywhere for signs that confirm your trade. Let’s say if you buy Apple, you will only look at and consider positive information about Apple and you will disregard anything that may hinder this position. So these biases have to be really tamed and of course, with the help of computers now, they can be. If I had to give an example, algorithmic trading has solved a lot of these emotional and cognitive biases. Even human errors could be a form of cognitive bias, which is, let’s say you’ve made an error on your position sizing and you ended up trading ten times more than what you wanted and you lost ten times more. So trading really must be framed so that these biases have limited strength to hurt your whole process.

SHUNYU: Right. So essentially you’re saying you want to eliminate the bias when you’re trading, and going with the bias, there’s also the emotion. You mentioned that you want to be emotionless when you’re trading.

SOFIEN: Exactly.

SHUNYU: How does emotion impact your trading?

SOFIEN: Basically, emotion will push you towards, let’s say, ending the trade a little sooner than expected or a little later than expected. Sooner than expected when you are approaching your target that you have initially set, and then you will gain, let’s say, slightly less money than expected. This will hurt your risk-reward ratio, and similarly, when the trade is out of your favor, you will wait a little more before stopping out and then you will lose a little bit more money than you would have lost if you respected the initial stop-loss. So the risk-reward ratio will quickly degrade, and this is mostly the impact of emotions on trading. After all, it’s your money. You are stressed, you don’t want to lose money. This is a game of money is always important and you don’t want to risk and lose that because it also hurts your ego, not just your portfolio.

SHUNYU: Yeah, yeah. So as you’re trading in the stock market, how do you obtain your information, like what stocks to trade, and what active stocks are there? How do you get that information?

SOFIEN: I mainly use a screener. I mean as I said, I’m mostly in currency trading more than stocks but I just use a technical screener for certain configurations that I like and of course, I keep and I always look at my favorite markets for certain patterns that I like that I try to detect manually, but of course, with the help of algorithms, it’s much more efficient now. You get your alerts, you get your configuration that you have backtested, and you trust, so that all you have to do is just validate the trade. You enter it and then you just wait and let’s say you take care of the risk management part more than just manually checking every market every day and then choosing the one that fits you better. This is also the power of algorithms which help you gain a lot of time by automating these processes.

SHUNYU: Yeah, so could you mention more about the algorithms that help you find which stocks to trade? Because that seems really interesting.

SOFIEN: Absolutely. For example, my latest algorithm that I use, it’s just a simple technical indicator that I’ve coded, which has shown a lot of promise considering support/resistance zones that come from technical analysis. This algorithm just simply takes a few simple rules that use pivot points, that uses a bit of volatility, a bit of supply/demand zone, and of course outputs a message saying: Okay, hey, this is a support. The market is probably showing bottomish configuration or topish configuration, and then when you look at that, you will say: Okay, this is the first step. What do I do next? I check the other technical indicators. I check the timing indicators. I check everything that I want to see in a trade, and then, of course, I check the risk, I check my fundamental bias, the sentiment bias, and of course, entering into a trade takes a lot of time. It’s not really directly put, but of course, by time, it becomes quicker, and these things, you have them in your head. Fundamental bias, you already have it. You’re not going to start from scratch every time you look at a chart and say: Okay, Japan has this balance of trade, blah, blah, blah, blah. All of these things are already in your head and you’re just mainly checking for these new configurations that you want to combine with your techniques and hope that the trade goes in your side and you will manage the trade accordingly when it’s in progress.

SHUNYU: Yeah. And these algorithms are coded inside of TradingView?

SOFIEN: Well, TradingView, I share them in TradingView because I code them in py scripts so that I can share them with everyone. But mostly I code them personally in Python so that I can see them. In TradingView, I just share them so that everyone can see them. But I’m just aware that in TradingView, you can actually code the alerts so that even people who can look at these indicators get these alerts. Soon, I will code these alerts for everyone so that they can get these alerts also, because, at the moment, I’m the only one who gets them because they are in Python and in my computer. But I’m hoping that I will code the alerts soon in TradingView so that everyone gets a chance to see these algorithms in action.

SHUNYU: Yeah, thanks. That’s nice. So here we have another moderation, another

SOFIEN: Yeah.

SHUNYU: A person that wants to speak with us. I’ll approve that. And if you look in the questions, there are also some questions in the chat, and since it’s been 15 minutes, we can start by looking at the questions as well. For example, one of them says: Please elaborate on the positioning strategies you mentioned during scaling in and out.

SOFIEN: Can you repeat? Sorry.

SHUNYU: Please elaborate on the positioning strategies you mentioned during scaling in and out.

SOFIEN: Ah, sure. Well, I assume you’re talking about the position sizing.

SHUNYU: Yeah.

SOFIEN: So, for example, one technique that I personally use, of course, the other ones are also good, like Kelly criterion and the fractional portfolio. One technique that I like to use is to reward the winning streak and to, let’s say, penalize the losing streak. For example, I take a small normal function which increases my trading positions by a small factor or let’s say medium factor every time I win, meaning that when I’m on a winning streak, for example, if I’m, let’s say, trading a currency pair, it’s going good because my strategies work well in a ranging configuration. This currency pair continues to be in a sideways configuration, so I’m winning, winning, winning, winning, and as I win, this position sizing algorithm will take into account and say: Okay, this is a ranging structure. The strategy likes this, so I’m going to increase a little bit so that the position sizing increases as the trading occurs during the sideway configuration so that I can profit more from this configuration. But the moment, of course, I start losing because let’s say, for example, the currency starts trending, this algorithm will penalize and say: Okay, this is a trending configuration. Now maybe let’s reduce it as we are losing on let’s say five of the last eight trades. So it will penalize whenever the market regime isn’t in tandem with my trading strategy and it will reward it and try to maximize the profit because really these trading windows are short and you know market regimes do not last for long, and so if you can maximize your profit during these configurations it would be best, and of course, if you minimize your losses during, let’s say bad market condition, it would be good. But of course, this comes with a lagging factor that you have to admit. Personally, the lagging factor is not that damaging and I’m seeing that it’s doing more good than harm considering that I’ve tested the other strategies like Kelly criterion or the fractional portfolio, which is really a simple one. It’s just a percentage of your portfolio as it goes down or up.

SHUNYU: Nice explanation. The next question is: Can you expand on how you track smart money?

SOFIEN: Yes. That’s a really good question. I was hoping someone asks that. So smart money is basically another way of saying let’s say hedge funds or big asset management pouring in the market from their own pockets, and tracking this smart money can be done. My preferred way is to use the Commitment of Traders report. I take, for example, if I want to, let’s say, I don’t know, let’s say the Sterling, so the GBP, I want to track if the smart money is pouring a lot of GBP, let’s say buying a lot of GBP, meaning that it will increase in value. I will take the Commitment of Traders report. I will apply some strategies such as normalizing the report between 0 and 100 and see when it’s too low, and when it’s too high. I also look at the trends. I also separate this Commitment of Traders report into, let’s say, producers/consumers, because even though it’s a bit complicated, this report, but really, you can simplify it because it’s composed of huge speculators, producers, consumers, and if you can understand where they’re putting their money and where they are pivoting, then you can actually start getting these trends as early as possible. Another way of using this COT report or the Commitment of Traders report is actually by time series analysis because these reports, these values of reports, because they are just values updated every week, they are stationary, meaning that you can apply time series analysis on these reports here and actually get a lot of interesting signals because I also apply pattern recognition on these COT values and get nice signals which could actually sometimes be market tops and market bottoms. So the COT is one of the smart money finders. I also use the put-call ratio. I use the Gamma Exposure Index. So this is a very good equity sentiment indicator. And to conclude, I also use the maybe it’s not really considered as a sentiment indicator, it’s both fundamental and sentiment, but I use the ISM PMI indicator and try to detect tops and bottoms because this economic indicator is greatly correlated to the US GDP, so really it’s correlated also with the equity market, so there’s a lot of interesting stuff to be done with these types of indicator. But definitely my favorite one and the one that I use every week is the COT report.

SHUNYU: Thanks. COT report. Okay. The next question is something I also wanted to ask, and it’s about: When you say long term, how long are you referring to? What is the certainty of a strategy working now to change X years down the road?

SOFIEN: Well, long term, personally long term, when I say long term it means between, let’s say six to twelve months, even though long term could actually mean five to ten years. But I say long term because I want to let these monthly or weekly indicators do their own, let’s say, magic and lead the way for the market to do its thing also. So if I say long term, I would say six to twelve months. And to answer your other question: What’s the certainty of a strategy working now to change X years down the road? I would say as long as you keep seeing in real life, you know, approximately the same results as what you backtested, of course, it will never be the same because backtesting results are mostly either biased or not exactly accurate, but as long as you keep seeing adequate results, let’s say during a certain standard deviation between the expected results, you can probably do a small statistical analysis that tells you whether you are in the normality of your previous results. I think you’re good. But of course, down the years, a lot of strategies stop working and this is why you have always to keep discovering new strategies, improving the current ones, and updating their parameters, since the markets are quite chaotic and a lot of new variables: fundamental, technical, quantitative variables enter into the equation. So you always have to update these strategies once you see, of course, a change in the results, that is a bit outside of this normality that you have set for yourself.

SHUNYU: Yeah, so essentially you’re talking about the model drift.

SOFIEN: Yeah.

SHUNYU: Like in AI, you have to retrain the model every now and then to

SOFIEN: Exactly.

SHUNYU: match up with the market. The next question is: Of all the technical indicators and authors you have studied, which ones would you recommend?

SOFIEN: Ah, nice question. I would recommend two people. First of all, Tom DeMark. Tom DeMark has a really good indicator that really shaped my timing and pattern recognition indicators. It was really the basis of it all. It’s called the TD Sequential and the TD Combo of Tom DeMark. and I highly recommend you take a look at these two indicators, study them, backtest them, and of course, improve them. They are used to time market tops and bottoms. Of course, nothing works in perfection and you have to work from these indicators and, of course, try to develop a strategy that leverages them. But they’re really good, and I highly recommend Tom DeMark’s indicators. The second one would be Scott Carney because he also shaped my price action trading when I started reading his books, let’s say, a few years ago. And it’s definitely harmonic patterns, such as the 5–0 pattern. It’s my favorite pattern. I constantly use this pattern. It’s really good. And I highly recommend you take a look at the 5–0 harmonic pattern. This is Scott Carney’s discovery, and it’s a really interesting pattern, especially when combined with other technical indicators.

SHUNYU: Great. Next, we have a final question, and then there are also some speakers that want to join us. We’ll ask this question first.

SOFIEN: Sure.

SHUNYU: What charting program do you use?

SOFIEN: I use a lot of charting programs, which is not exactly the optimal thing to do. I use a lot of TradingView. I use an in-house charting software at work. I also use MetaTrader 5. So basically I use, let’s say, three charting softwares, and sometimes when I’m on Bloomberg, I use their charting platform there, even though it’s not the best. But if I had to choose, it would be TradingView. Why? Because there’s a lot of markets. There are a lot of indicators. You can code your own indicators. Of course, you can do that in MetaTrader 5 as well, but the coding language in TradingView is much more user-friendly, so it’s easier for you to quickly pick up on it and start coding your own technical indicators. You definitely don’t have to be a coding wizard to be able to code something in TradingView.

SHUNYU: Yeah, definitely. Alright, so now we have some people in the moderation tab, so I will approve this first. Yeah so if you want to speak with us, you can speak with us. And also, time seems to be running out. We have, like, three minutes left. Hello.

SOFIEN: I think she’s on mute. Alright, should we continue? You have two minutes left if you have any other questions.

SHUNYU: Yeah, yeah. Do you have any memorable trading experiences that you want to share?

SOFIEN: Yeah, a big fat finger trade that I did when I started trading, I think it was two weeks into trading. This was back in 2016 or 2015. I traded ten times, the lot I was supposed to do, and I freaked out, and I didn’t know what I was supposed to do, so I let it, which was a huge mistake, of course. Should have closed it directly, but after 15 minutes, by miracle, it was on breakeven, so I closed it. And then the view actually went in my favor, so I could have gained a lot of money. But of course, there’s absolutely no regret. I was extremely lucky that I didn’t really lose it all, and from there, I started reading up on cognitive biases, and really these types of mistakes are what shape your trading.

SHUNYU: Yeah, so you want to avoid losses

SOFIEN: Yeah.

SHUNYU: to be a profitable trader. Yeah. Another thing is: What initially sparked your interest into trading?

SOFIEN: I like analysis and I like challenges, so we can agree that financial time series exhibit a lot of randomness in them, so actually analyzing them is a challenge. And when you write, you’re quite happy with it, and it gives you the opportunity to make money or to make people make money. So that’s basically the main attraction, which is data analysis of a semi-random, really tough-to-predict system, and of course, you have the opportunity to make money out of your ideas, out of your creations, and of course, you can also help people make money or make money together.

SHUNYU: Yeah, so you want to share knowledge

SOFIEN: Yes.

SHUNYU: and help people.

SOFIEN: Exactly.

SHUNYU: Great.

SOFIEN: I just want to say thank you, Matt Mathai, for your kind words, and Ed Corack also, thank you for what you said.

SHUNYU: Yeah. Okay, it seems like we are out of time, and I apologize if you wanted to speak and you couldn’t speak. Might be, like, a software glitch or something.

SOFIEN: Yeah, for the moderators, maybe. Well, I think it’s working now.

SHUNYU: Hello?

SOFIEN: Nah, no.

SHUNYU: Aw, unfortunate.

SOFIEN: Alright, well, thank you very much, Andy.

SHUNYU: Yep.

SOFIEN: It was a pleasure meeting you. Good.

SHUNYU: Thank you, everyone, for your attendance, and we really appreciated your comments, and if you haven’t done so already, please check out my website, DayTradeWithAI.com, and sign up for the mailing list so you get notified when the book is released in August. And also check out one of Sofien’s latest books, Mastering Financial Pattern Recognition. It’s a really nice book.

SOFIEN: I’m looking forward to your book, Andy. Thank you very much.

SHUNYU: Thank you all for coming, and we hope you enjoy your next session.

SOFIEN: Bye, everyone.

Subscribe to DDIntel Here.

DDIntel captures the more notable pieces from our main site and our popular DDI Medium publication. Check us out for more insightful work from our community.

Register on AItoolverse (alpha) to get 50 DDINs

Support DDI AI Art Series: https://heartq.net/collections/ddi-ai-art-series

Join our network here: https://datadriveninvestor.com/collaborate

Follow us on LinkedIn, Twitter, YouTube, and Facebook.

Medium Day
Algorithmic Trading
Finance
Trading
Stock Market
Recommended from ReadMedium