ChatGPT vs Strategy Builder - Building a Trading Bot! | NinjaTrader 8

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
there's been a lot of talk lately about what chat GPT is and whether or not you can use it to build yourself a trading bot that will generate a ton of profit so then maybe one day you can ask others what color is your big guy well I don't know about the profitable part but we can definitely use it to build ourselves a trading bot in this video we're going to be using the platform ninjatrader 8 and we'll be building ourselves a trading bot using chat GPT and after that we'll be using ninjatrader's very own built-in strategy Builder to build the exact same bot alright so to get things started first we go to the open AI website and then you want to come down here and try chat GPT if you've never used this before you have to make an account first it is free so no need to worry about that and then let's figure out what chat GPT actually is so what better way to do that than to just type in what is chat GPT and can it help me code you just hit enter and it's going to generate a response chat GPT is a large language model developed by open AI that is trained on a massive data set of Text data to generate human-like text it can be used for a variety of natural language processing tasks such as text generation language translation and question and answering while chatgpt can help you write code it is not designed specifically for that purpose however it may be able to generate Snippets or explain programming Concepts in natural language it's worth noting that chatgpt generated code may not always be correct or efficient so it's important to thoroughly review and test any code generated by the model before using it in a production environment okay so that's pretty good you can talk to it ask it questions and it will generate a response and it can even help you with coding but it might not be perfect you might still have to go through it and fix it up so let's get started and see what can do for us so can you show me how to build a strategy on ninjatrader8 enter long when the 9 EMA crosses a thief 50 SMA and enter short when 9 EMA crosses below the 50 SMA we hit enter and see what it comes up with okay so it seems to be typing out the code here so I'm actually pretty impressed with what it generated here uh I wasn't expecting it to be this accurate there are a few things if you've coded with ninjascript D4 for example initialize is not a thing on ninjatrader 8. I also don't see anything that's going to add your indicators to the Chart also this is not the proper way to define your SMA and your EMA periods at least this is not how I do it but I'm going to copy and paste this into a blank strategy and see what we can come up with so I've copied and pasted this chat GPT generated code into our ninjatrader blank strategy uh so I added the private SMA private EMA under the public class and I've added our conditions to enter long and enter short the only thing I'm going to change are the periods uh just to save time on the video I'm going to fix them now uh because I know this is not going to work so under your set defaults I'm going to type in something like SMA period equals 50. and EMA period equals nine and you also have to declare it as an integer so I'm just going to copy and paste this from another strategy and then this way once we load the strategy we can just change around these variables if we want now the next thing I want to do is I want to add these indicators to our chart once we load the strategy so let's see if chat GPT can do that for us all right so it gave us a response a pretty in-depth response but unfortunately if you've worked with ninjascript you know this is not the correct way to add it so let's see if we can try something else okay all right so now we generated our ad chart indicator and our plots and gave a pretty good description of how it works but again even though it's pretty good uh this is still not going to work uh a few things just for example pen color is not an actual thing on ninjatrader we use bar brush we also don't use on Startup ours is more like a state data loaded so even though this code is not a hundred percent correct as long as we have some sort of idea of what we're doing this can still help us save a lot of time in writing code and can even give us an idea of where to place our code so I'm going to fix this really quick and then we're going to add it to our chart and see how it performs okay so I just had to fix a few things and we're going to go over all of these here we added our EMA and our SMA that part is okay then we had to Define our periods and we did that by making integers then instead of having an on Startup which is not part of ninjatrader we added our indicators on the data loaded so first we have to Define our SMA with the period so our SMA 50 is equals to our SMA with a 50 period and ema9 is equal to an EMA with a 9 period next we plot them on the chart so really the only difference here between these two is the pen color method ninjatrader 8 uses brushes instead of pen color it's just ninjatrader specific thing and then for the very last step we add the indicator to the chart and that should let us compile so overall it's pretty good for just typing out what you want and you can keep adding to it if you like just like you're having a conversation so if you want to set a stop or a profit Target but I don't want to make this video too long I think we've seen that whatever it does generate we still need some knowledge and coding to be able to fix it but overall I like it I think it's a pretty cool toy to have I'm sure we ask in more General coding questions rather than very specific ninjatrader stuff it might actually work even better but we're not here for that we're here to build trading bots so let's load it to the chart and see this in action okay so now that we're in our chart you want to right click go to strategies find the strategy and apply it and remember it's a strategy you have to enable it and here we can see we have our 9 EMA in blue our 50 SMA and yellow and it's filled out all of our historical trades so let's zoom in a little bit and here we can see when the 9 EMA crossed below the 50 SMA it it enters short when it crosses above it closes the position it entered long and then once the 9 EMA crosses below the 50 SMA closes the long enter short again and it just keeps doing that over and over because we have no other conditions coded into this strategy which is fine just for the testing part of it then if you want to check the performance history you can just right click strategy performance and check the historical trades and as you can see we made a killing with this strategy with a profit of almost four thousand dollars now don't go buy a Lambo just yet these numbers are from a small time sample they're easy to fake and almost certainly won't translate to the real world there are things you can do to make your back testing a little more accurate I'm not going to go into them this video this video is just to compare chat GPT and strategy Builder so let's move on and see how it works in real time okay so we're just going to play it in real time here I'm just going to hit the play button and once this 9 EMA crosses below it enters your short position and once they crossed over the 50 SMA now It reversed and entered a long position so our bod works that's the important part and now for a comparison we're going to be using strategy Builder on ninjatrader to build the exact same automated Trader so we want to go down to your control panel new and you want to select strategy Builder next you get this window you just want to select a new strategy and chat GPT dread build then you can just hit next additional data we don't need that we're working with the current one inputs and variables we don't really need to do that on the strategy Builder this is not an in-depth how to use strategy Builder we're literally just building the exact same thing as we did with chat GPT so you can just hit next in this section is where the magic happens and you can select the conditions that must happen in order to enter a trade so first go to the top box right here select add and you want to select the indicator so we're doing EMA first so scroll down to the EMA select a period of nine and if you wanted to show on the chart make sure you select the plot on chart and I'm just going to switch the color to Sky Blue next we're going to go to this middle box and we're going to say cross above then the second box here we select indicator again and this time we're going to scroll all the way down to our SMA select a period of 50 and we're also going to plot this on the chart so what we're saying is when the 9 EMA crosses above the 50 SMA then we're doing the following so you select add order management and we're going to select enter long position then next for the shorts we have to select a second set so click this plus tab down here and we're going to do the same thing just with the opposite so go to indicator EMA lot on charts nine then this time we're doing cross below and select the SMA again plot on chart with a period of 50. on this one we're doing the enter short position okay let's hit next stop in targets we're not setting these for this strategy so let's just hit next and we can just hit finish and it'll unlock our code so once you hear that compile noise you're good to go so you can just go back to your chart so you want to right click strategies and you want to select the strategy so here chat GPT Strat build then you want to hit apply and hit enable so here you can see the same thing when the 9 EMA closes below the 50 SMA you enter short when it goes above the 50 SMA you close the position and you enter a long position and you can check the strategy performance of this one as well we just go back and do that option and you can see the the results are pretty similar so the the back testing part work and let's see how it plays out in real time order films and there we go across below uh order filled order filled and you can see just keeps entering over and over every time there's a difference so that's the same bot built in two different ways another question is which is better to use chat GPT or strategy builder in most cases and this is especially true if you have no coding experience then I'd say definitely use strategy Builder it's built into the platform and it's designed specifically for ninjatrader so it just makes a lot more sense to use it on the other hand if you like to manually code your own strategies then while I wouldn't rely solely on chat GPT because you still need to know what you're doing I think it could still be a great tool to help guide you in the right direction or if you just need General C sharp Health but let me know what you think or have you been able to build a proper bot using chat GPT whether it's on ninjatrader or any other platform I want to know and that's it for this video take care
Info
Channel: TradeSaber
Views: 7,530
Rating: undefined out of 5
Keywords: ninjatrader, Ninja Trader, Order Entry, Free Ninja Trader, Futures, Stocks, Day trading, Ninja Script, auto trader, algorithmic trading, stock trading, futures trading, open source, breakeven, ninja script, trading for beginners, trade management, tradesaber, trade saber, how to, c#, investing, tutorial, stock market, algorithmic, trading futures, dre, trade saber dre, ninjatrader indicator, ninjatrader strategy, ChatGPT, OpenAI, comparison, SaberTrade, Saber Trade
Id: RoeLmdE695Q
Channel Id: undefined
Length: 13min 1sec (781 seconds)
Published: Tue Jan 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.