Building an $MES $ES Futures Trading Bot for TradingView – Trading Bot Sessions (EP 001)

this is episode one of trading bot sessions where we talk with traders who have built automated trading strategies and trade everything from stocks and options to Futures and crypto John and I speak with Zach who goes by the Ice King in his trading Community smarter options and we cover Zach's story his road to learning Pine script for trading view his journey to building an automated trading strategy for micro e-mini S P 500 futures and finally how he's navigated through slippage scalping and data inconsistencies I trust you'll enjoy this kickoff episode of trading bot sessions with Zach all right so why don't we start with just the top question here why don't you tell us a little bit about yourself and how you got started with automated algo Trading yeah you know uh so my name is Zach uh on a small trading Community called smarter options you know been trading for over 20 years or about 20 years I suppose really had not pursued the algorithmic training uh just mainly because I couldn't find anywhere to do it you guys are really the first ones I mean trading view is this this great platform that they have out there there's all these tools and it's hard to get to take automation from there into a real life trading account that's how I found you guys and that's how I got into algorithm and trading do you have a do you have a process for developing and testing new trade ideas or do you have just a specific strategy that you're running at the moment a combination of strategies maybe you can talk to us a little bit about your approach to markets that you're trading and what you have running at the moment absolutely so I do have oh my gosh I have if you guys knew how many iterations of of algorithms I have it's definitely ridiculous um a very all over the place right I mean my mind's always running I'm always reading always getting ideas there's been times where I've been working like on three different algorithms at once um playing with different features and trying to add different you know little niches and necks into into the algorithm uh main thing I'm trading right now though is futures uh the reason I'm trading Futures you know that's Zola trading future is one because uh you know mes and Es are the two that I'm focusing on primarily one point for mes you know five dollars in your trading account yes fifty dollars your trading account for one point what's nice about that is not to say like scalping but I mean 10 15 20 point moves are rather significant compared to Trading trying to do it with stocks another problem with stocks that I found is is gaps I mean the market only traded six and a half hours regular trading hours right it's it's very hard to to adjust to something that can change overnight when the market wasn't open especially if you're trying to do options uh something that if if news comes out that alters it and you know things happen on pre-market things can go awry before you have a chance to fix it so Futures are nice because they they trade 23 hours a day you know five days a week it really helps with the algorithmic trading in my opinion doing Futures if you're going to do options which I'm just starting to alter some of my I'll go to try and work with that you just have to work on larger time frames and um you know further out targets that way you have time to let it happen but yeah so you know using client script I have never been a programmer before this last couple years I have watched so many YouTube videos I've pretty much taught myself how to find script to build these algorithms it can be frustrating but you know John has been a big help every time I have a question um not with necessary program but how how your guys's operation how you how you guys interpret the signals and stuff he's been very extremely helpful with that um and yeah it's uh my current strategy you know if I were to look at it here I currently have it set to trade um four it's it's trading or mes on this one particular strategy um you know this is the the back testing results but it's the one I'm running it's up it'd be up 9 300 for this month or for since September 1st um if I went back to August first on this particular strategy it would be at uh 15 465 up with a Max loss Max drawdown of a thousand dollars that's great good risk for work and that's actually that's a good point we just set out there right all about programming and risk to reward and you got to have have that built in were these strategies developed on a discretionary approach that you've taken in the past manually traded or have you started to find ways in which you can manage risk differently with a programmatic approach yeah it was you know that's that is the hardest thing is to try and programming how we actually trade right so I mean if I look at I'm looking at MES right now um yesterday right at the market close you know right when Futures closed at uh 5 PM Eastern I looked at it and thought okay go short right there but that's just from visually looking at it I mean I could see a ascending wedge and it looked like it was overextended and it needed to pull back my algorithm didn't pick it up until this morning right at uh at about 6 a.m Eastern and it went short but it went short a hole it uh my algorithm went short at 37.77 I would have personally gone short at 37.97 so it missed it by 20 points but it still did well um and then exited on the bounce and went long coming back up but yeah so to answer your question I don't know how to program in quite exactly what I see yet but that's what I'm working on every day trying to make what I'd really like to get into you know and if there's anybody out there that wants to reach out to me and collaborate or something but eventually what my goal was is to build something that can do um like a thought a thought process tree if this then that type of logic I'm just still learning on programming my script to get there more of a decision tree then yes yeah and so what what advantages or disadvantages have you found so far with Albert trading in futures so disadvantages being news driven events for sure right especially with the fields like the market makers I mean how many times have and I'm sure you guys have noticed it I've noticed it I mean I can't tell you how many times go to the news driven event they will spike it the other direction real quick before letting the real outcome come and it looks like it's uh possibly to fake out the opposite direction whether it's long or short or possibly to go up and hit a bunch of stop losses before letting it actually run down um so that's really that's probably the hard part the good part is it takes the emotion out of it you know it trades 24 or 23 hours a day I don't have to be awake or necessarily even watching it to to take these signals and that's probably the biggest advantage to algorithm trading is that what it's relying purely on the signals no emotion to it and that it trades you know how many times have you got looked at a chart you're like oh [ __ ] that looks so good I knew to take it there but I wasn't you know around at that exact moment when I would have seen that set up so that's the probably the biggest advantage to it would you say that turning on automated strategies has changed the way that you interact with the markets on a daily basis or do you still find yourself engaged highly engaged oh I'm still highly engaged I I love this stuff um this is not my this is Hobby passion cult what you will but you know I'm like I said a student for life I'm always reading always trying to learn more uh the market is so fascinating and fascinating with how it moves what caused it to move um I love every minute of it so you mentioned earlier that you spent a lot of time on on YouTube trying to learn Pine script can you tell us a little bit about some of the challenges you faced in in heading down that path and what resources you may have found that have been helpful yeah you know I don't really know what resource I I think the biggest resource that's been helpful is once I got through um kind of learning how to code a little bit is playing script there's a bunch of Open Source strategies out there and I started just looking through them and just kind of figuring out what things did what functions did what started teaching myself how to code um the current algorithm I'm running is 100 percent coded by me it's not not even a single piece of it comes from anywhere else but I did learn a lot of going through other strategies and other open source uh to try and figure out how they were coming up to certain things um one thing that I've done is I'm I'm trading on Lower time frames from higher frame signals and so one of my first mistakes was um repaint issues you know if you're trading off of a higher time frame you uh if it takes a signal but by the time that that future time frame closes if that signal is no longer there right it would repaint repainting is for anybody who doesn't know is when you get a signal and then it gets erased later because it you know in in that moment it was you know it was uh a valid signal but by the time the candle closed let's say I'm trying to find that chart but I'm getting signals off the hour chart you know if 10 minutes into the hour chart a signal goes long but by the end of the hour it closes it's no longer long it would repaint that that signal so I had to get through that um repainting was a big uh was a big one for me figuring out how to get past that and around it how long do you think it took you uh to have your first version of Something working and you know for for contacts that helps people understand a little bit about this journey of not only learning Pine script but really assembling an automated strategy I'm not sure you want that answer sure let's let's be realistic be realistic um literally I have uh I don't even know how long it quite took me um over over a month to I mean of learning to find description before I got something and then my first one was repainting and I didn't even realize it at first like it was probably several months before um black so I had zero coded knowledge so it took me a little bit longer let's just put it this way I have found out multiple times now that you can only have 75 000 characters on Pine script in a single script so I asked that question because we get a lot of Traders you know who have kind of improper expectations and just like anything in life you know whether you're programming for a professional job or maybe you work construction building houses like no one just picks up a hammer and all of a sudden they're an expert and it's no different with algorithmic trading or manual trading um and that's what we found is one of the most important things is kind of level set expectations and people need to expect that there's going to be an investment that needs to be made both in time and potentially money you know investing in resources buying resources um buying strategies to look at as examples to follow and you know paying the a friend of mine always calls calls it paying the stupid tax um you know you got to pay your dues in order to get through to the other side and most people give up before they can kind of get through to the underside yeah you know if you don't have the will I I agree with 100 what you just said um I we compare it kind of to we get a lot of traders that have come into and gone into our community and they think that options are just a you know get rich quick thing like it doesn't take you know anybody can do it and it's it's just like during coven when everybody thought they could be a day trader I mean it's oh it's so easy I watch this guy on YouTube and he he made a hundred thousand dollars a day it's so easy okay yeah it looks it's it's awesome I mean let me wrong it's a lot of fun I love it I'm addicted to it um having said that it's definitely not easy you gotta just like anything else Lottery's probably the only way to actually get rich not trying right I mean you don't just get rich by or get good at something just half-assing it or trying to watch someone else do it I mean you have to take the time to to learn and figure out what you're doing to make things happen but when you do it can be a game changer so you mentioned earlier that you spent you know roughly 20 years in markets and for all that time I assumed that was all manual trading maybe maybe a mix of investment Styles can you tell us a little bit about your journey as an investor and or Trader and how that's evolved over time uh sure you know just like everybody else I I imagine started off pretty simple Beginnings right investing in some stocks uh you get into options but you know the more you learn and you read and you get into options I mean you you can really it really changes the way that you think about trading um you know one of my things that I wouldn't recommend doing it right now because this Market is so choppy and uh I mean unless you're doing puts or something like that long term but you know when you buy options right if you're not the one of the options you have to go read about a little bit we're probably not going to get the I'm not going to teach everything about it right now but um you have intrinsic value and then you have time value right well as you buy deeper money if you ever watch options flow or you go to any of that stuff right you see a lot of big money buys options deep in the money and a lot of people don't understand why they do that the deeper you go in the money time value goes to almost zero so you can buy actually I mean I could go by leaps of stock about 50 in the money and I pay very very closely to what the stock is actually at the benefit of that is if the stock market uh every you know if you look at any 10-year span traditionally it's it's it's gone up 10 percent you know ten percent year-over-year average any any Spanish look at well if you were buying deeper the money options I could buy twice as much with the same amount of money buying leaks and get those same returns uh except 20 returns just by buying deep in the money options on the same on the same stocks now you also get dollar for a dollar you know you also get bigger losses when the market does correct but it's a longer term strategy um but yeah that's I mean that's I started doing that buying things that were were out actually you know what we had one of my old one of my Traders uh he kind of went off on his own now but um he turned uh he turned fifty thousand dollars he shorted a bunch of uh of Shopify when it was at 1800 bucks and he turned that into half a million dollars here this and like in six months because of the Fall that's the type of things you can do now he was patient he didn't take Pro I mean he sat there and he was trading off long-term signals and he just let it the puts sit there and and accumulate in value and and he's done very well and like I said he chose to to go off and do some other things with with the money that he had he had made himself but the more you learn it will definitely change the way you trade given that the history you've had with options can you uh what's the leap that you've made from options to Futures here with with the automated strategies is it really just a difference in the way that you're you're taking these trades yeah I mean like I said the nice thing with Futures is that they trade they trade all the time I mean I originally got into Futures uh because just like everybody else you know life kids because you have other things going on um future is nice because it trades all the time I I if I want to go get on you know so say you have uh this is this is just a generalization but say you have a full-time job but you want to trade and you want to make some extra money on the side uh Future's a great way to do that you can go trade Futures in the evening find setups and and trade at night make some extra money that you need I mean it's a great it's just another great investment tool um or Avenue that you can take to to kind of increase your your knowledge or you know the broadness of of what you're investing in I still have options uh mostly I'm trading in I do do some shorter term options you know but uh my favorites are are swings and leaps and I you know not too long ago here uh just a couple weeks ago the last time that Russell the iwm was up I think about 68 uh you know or 168 puts or 350 and they were at 15 a couple weeks later um I I love that stuff but I I just I don't like scalping um I like longer term strategies and then you know doing spreads just smarter investing but yeah Futures yeah Future's just another Avenue I mean Futures are just but Futures I've I have found as far as me finding something that I can get uh good Returns on on a regular basis period of time I like that for operating trading like so there's no Gap UPS no Gap Downs it just trades all the time not to mention there's no PDT rules or you know not no wash sale rules you don't need the minimum 25k I think it is a lot more accessible for from an algorithmic trading perspective so you mentioned there around wanting to take more approaches on longer term strategies our our longer time frames more appropriate for for retail Traders from your perspective and and why well I think so I mean this Market is so choppy and things are going every which way it's hard to get signals um in this particular Market I mean I've just I've never seen I've never seen this before ever but uh you know I scalping is just dangerous scalping is is I feel like guys are gambling um people that have that gambler's mentality they don't have a reason for doing it or they think they really get this gut you know um and like I said and then this Market has just been so extreme uh I mean hell just look at yesterday right we had all these Gap ups and the market was so green um I personally bought a bunch of puts yesterday and cast most of them oh this morning but um everything was you know showing bearish divs it was all up it almost like needed to come down and retest the port but the longer term strategies I think are just safer bets by time and the signals tend to be more reliable that's why I that's why I recommend the looking at higher time frames I know like I said and then you can kind of Gap ups and GAP Downs don't matter so much right as long as your longer term signals are still validated stick with it with both manual trading and automated trading is less more you know many beginner traders that join our platform I think tend to make the mistake of thinking that they have to take dozens or hundreds of Trades per day in order to capture some kind of profit from the market and maybe part of that comes from the assumption that that's how the high frequency Traders do it or that you know that's how the institutions do it and I think the the takeaway here in general for for us and for many of the people who are successful at doing in this is that the longer time frames are where the where the trend shows up but I'm curious about your viewpoint on that yeah no I completely agree it's I mean so if I go look at uh my algorithm that's running right now on Futures you know uh this since September 1st it would have had 90 closed trades so I mean it's taking an average of about three traits a day it's it's not uh I think you're really right I think what people Miss is when you look at back testing results and you see these charts that just go I mean there's just a nice vertical line right it's really important to go look at your average trade I mean if I have an average trade of of it's trading you know making a profit of 25 cents well I've got no margin for error and I'm probably going to get murdered in fees at the end of the day uh it's unrealistic you need to find strategies that get you know so like the average trade on mine when taking four um up to four contracts it takes anywhere from one to four uh average trade is you know 104 profit it's showing me here I always try and throw in and you know you have a slippage setting on there I try to add in some slippage just to make sure that that doesn't change my my results dramatically because if it does well that means that I have a zero tolerance for error and that's an issue also um you know all these fast moves you got to make sure that you know that you're that's another reason I like training features also by the way is it's so highly liquid right I mean there's never more than a half a point gap between the bid and the ass that's one of the reasons I've also chosen Futures to to for algorithmic trading um but yeah no I think less trades less is more and you need to fight something that is consistently profitable taking less trades with the real trades that you take in what kind of impact have you seen slippage and commissions have on your strategy and maybe you know the the lag of time sick time of signal and time of execution does that affect your performance at all of your of your strategy it has but I found that uh it goes both ways um so I mean the long I had it it went longer a while back I mean it actually went long right you know at the start of a red candle and so it actually got it had five ticked flip but that was it was actually my favorite um sometimes it's the other way around but like I said on this particular strategy I've put in if I put in you know an average of five tick slippage it's still profitable um and that's what I'm watching for that's one of the things I'm looking for I've also been talking to uh Jonathan here about adding in a way to help reduce slippage um and so we're working on that right now or you know he's helping me come up with a solution or I'm helping him whichever way to look at a solution for that right now but I think that'll help a lot of it um yeah maybe we can we talk about that a little I assume that in the event that you're talking about where your the trade went in your favor was because the limit order had best execution tied to it so you actually filled at a lower price than you expected on the buy right yes gotcha well I mean it's not limit I'm doing Market entries yeah part of the issue is that then you wait for the Target price to trigger in trading View and then trading view sends a signal to Traders post so that we send a market order to the broker but a lot of times he's gonna go down yeah and you you just did it because it's a market or you're just at the whim of the market um so we're gonna have a feature that lets you optionally send the take profit and stop loss price ahead of time with the entry so that that Target and that stop loss will be in the broker as a limit for the take profit and uh stop market for the stop loss so that you're you're not getting hit with as much slippage on the exits yeah so my entries would still be Market um and and the reason for that is the same thing I mean so if candles start to rip up I don't want to send a lit I don't want to wait for a limit order right because if it's in the limit order and it's on a whole green candle it'll just never fail I just never I never got to be in it so I'm willing to talk to Jonathan I think slippage on one side is definitely acceptable but if we can reduce slippage on the exits uh and like I said all my triggers I have different triggers set up on my on my algorithm and then I have uh different points progress for each each uh trigger but at that time I could actually with the alert I could have it send in what that Target is and if he could just have a limit order a limit exit created at the time that the order was taken then it doesn't have to wait for the lag of trading view to to send the market exit right it would it just the exit is already set as a limit in the in the system are there any type of news events or days in which you don't let the algo run or do you intervene at all um you know what each time I've intervened it's and I just did it still this week I mean actually my algorithm is the I so I turned it off this week because I was messing with it and I was um took a little bit of a loss the other day and so I was I was I was like I'm gonna turn off for a minute I was playing with it and I missed out on about 1500 profit because I hadn't shut off um I found that like you said it could go both ways you have sometimes where the news goes against you and then you know you're just sometimes on the wrong side or sometimes you're on the right side and you know back tests don't intervene um so I found you know it's the whole point is to kind of get you out of the middle um but it's always easier said than done that's for sure well they said I just need to trust it more I mean what's and it's still you get that emotional thing right I mean it is one of those things where you just um you see something happening but yeah I don't know I said I saw it going down and I I had it I said I had a thousand dollar Max drawdown um I lost that last week and so I was like oh I'm gonna turn it off and then sure enough the next trade would have been a winner I should have just let it kept should have just stuck with my and let the algo do its thing I mean that's the whole point of it right is to not be involved in it and to let it trade I still do my own personal training on the side but the whole point of doing algorithmic trading is to have a fairly consistent just passive Revenue stream and that's what I need to let it do and I think the biggest way to do that is once you find something that you think might work you have to be okay letting it I mean you can't turn it off after the first after it loses once or twice I mean it will lose sometimes it's it's automated it's not it doesn't know anything more than what you've programmed it to see so it can lose but the point is that is it you know consistently profitable do you have a profit Factor that's worth leaving it on and you watch your max drawdown and just make sure that that's an acceptable tolerance for you for what you're trading but you can't just lose a couple and then be like oh you know I failed and start crying about it you got to let it keep going I said my private factor for this month would have been 3.4 if I would have just let it kept going instead I'm I'm below that now because I turned it off for the start of the week so maybe a couple more wrap-up questions here what is something in the future that you would like to continue learning about that you think would improve your approach to outgo trading you know my biggest problem is with trading View and trading futures it's hard to go back and get an accurate back test of more anything back more than a few months starts getting tricky um because contracts expire every three months you know um and you start getting skewed results that I don't think are real but part of it's because it it's looking at other you know it's trying its best to Stitch some of the contracts together but it just I would like to get a feedback testing feature of training view did it help with that at all history of the Futures contracts expires you only have a certain window so when you do it on a continuous contract symbol it doesn't work uh it does kind of but then it so like uh here on you know a month ago when they switched to December futures or whenever that was maybe a few weeks ago um you know if you go to continuous contract it shows a gap up that Gap up is not real but it shows it um like I said it's just doing this continuous this this stitching thing and and the volume is not always right either I mean because the volume was split up between two different contracts for a while so um can fix like is that fixable like can someone could someone build a system that allowed you to properly back test Futures over a longer period of time well that's a problem too right I mean so I'm zooming in I mean ultimately my program is based around um I have all my stuff based around the five minute charts now it's I I've figured out a way to to use longer term signals and like I'm trading off of uh one hour signals but I'm using the five minute chart I just did that by the signals the the technicals that I'm using right I just multiplied them by 12.

To give it close to one hour results now it doesn't line up perfect but that's how I'm trading off the five minute chart with one hour signals but by using five minute candle that's in the problem with trading viewers they only let you look at so many candles so at the five minutes I'm only able to go back a couple months so really I've looked at other ways to do that sounds like there is some other you know using pythons and different things I could buy the data and then try and convert my Pine script into a python script and back test it over just the raw data but once again Beyond me currently so can we hear a little bit about smarter options and and how people might be able to get in touch with you uh yeah so we're Discord trading Community uh smarteroptions.com we'd have uh you know I'm stupid Discord name the ice king9156 if you guys want to hit me up um in the Traders post Discord also but uh yeah we do you know options Futures chat um do technicals drawdown charts what we're seeing what we're looking at um why we take things entries exits all that good stuff um we have it available where you can get alerts through SMS if you if you choose to go with an SMS plan um or through you know just the Discord but we uh we're pretty small group we don't really actively advertise or try and grow it's just more of a as people spread the word type of thing so but we enjoy it and it's not really we don't it's not like really a money maker type of thing we we just do it to help educate and and have a like-minded group of Traders that's great well I appreciate you spending some time with us here on this yeah I appreciate it Zach really this has been awesome yeah all right thank you guys take care

For more info. Click here!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.