Earlier than the appearance of AI, if we wished to put in writing a customized indicator in TradingView, we would want to discover ways to code PineScript whereas referencing TradingView’s documentation on technical indicator capabilities.
Or you may rent a programmer.
Contents
At this time, utilizing the free model of ChatGPT, we are able to have AI write the code for us.
Let’s see how.
Open up the Pine Editor in TradingView and begin a brand new indicator:
Suppose we would like an indicator to present us a purchase sign when the 8-period exponential shifting common (EMA) crosses above the 21-period exponential shifting common, as within the case of Apple (AAPL) on November 21, 2024:
We now have set the 8-ema as blue and the 21-ema as purple.
As well as, we solely need this sign when the inventory is in a longer-term bullish mode, which we’ll outline as when the 50-period easy shifting common is sloping up.
We’re utilizing each day charts for this instance.
So 8-period, 21-period, and 50-period means 8-day, 21-day, and 50-day.
Nevertheless, these will be carried out at any time.
We’re merely going to ask the next query in chatgpt.com
And it spits out a bunch of code on the right-hand panel.
Copy and paste that into the PineEditor in TradingView and click on “Add to Chart”…
It labored,
Free Earnings Season Mastery eBook
It even drew within the 8-ema, 21-ema, and the 50-sma as blue, purple, and inexperienced, respectively.
In case you don’t like these colours, you may open up the Pine Editor, and with rudimentary experimentation with code, you may merely change these colours up:
Or higher but, simply ask ChatGPT to change the code for you.
I’m certain will probably be comfortable to conform.
By the way in which, keep in mind to save lots of your script by clicking that “Save” hyperlink that’s beneath the “Untitled script.”
To proceed with our instance, we requested it so as to add a promote sign by asking it:
“Are you able to add a promote sign when the 8-ema crosses under the 21-ema whereas the 50-sma is sloping down?”
It modified the script with the next outcomes:
ChatGPT will not be the panacea for all of your customized charting wants.
At the very least Pinescript coders’ jobs won’t be fully changed by AI thus far.
In case you ask the free ChatGPT model to do an excessive amount of, it would reply by saying:
In our instance, we’ve got given it a comparatively easy job.
In case your request is extra difficult, ChatGPT could have errors within the code, so while you attempt to run it in TradingView, it won’t run and will provide you with an error message.
You’ll be able to copy and paste the error message again to ChatGPT, and the code can be rewritten.
Chances are you’ll finally arrive at a workable script by means of such an iterative course of that’s typical of the coding course of.
It’s at all times good to double-check manually throughout a number of ticker symbols and possibly timeframes to validate that the purchase/promote sign generated is what you meant.
We hope you loved this text on.
When you have any questions, please ship an electronic mail or depart a remark under.
Commerce protected!
Disclaimer: The knowledge above is for instructional functions solely and shouldn’t be handled as funding recommendation. The technique offered wouldn’t be appropriate for traders who should not acquainted with trade traded choices. Any readers on this technique ought to do their very own analysis and search recommendation from a licensed monetary adviser.