Earlier than the arrival of AI, if we needed to write down 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 present, utilizing the free model of ChatGPT, we will 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 offer 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’ve got set the 8-ema as blue and the 21-ema as crimson.
As well as, we solely need this sign when the inventory is in a longer-term bullish mode, which we are going to outline as when the 50-period easy shifting common is sloping up.
We’re utilizing day by day charts for this instance.
So 8-period, 21-period, and 50-period means 8-day, 21-day, and 50-day.
Nonetheless, these will be achieved 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, crimson, and inexperienced, respectively.
If you happen to 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 glad to conform.
By the way in which, keep in mind to avoid wasting 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 beneath the 21-ema whereas the 50-sma is sloping down?”
It modified the script with the next outcomes:
ChatGPT is just not the panacea for all of your customized charting wants.
A minimum of Pinescript coders’ jobs is not going to be utterly changed by AI up to now.
If you happen to ask the free ChatGPT model to do an excessive amount of, it is going to reply by saying:
In our instance, we have now given it a comparatively simple job.
In case your request is extra difficult, ChatGPT could have errors within the code, so once you attempt to run it in TradingView, it is not going to run and provides you with an error message.
You may copy and paste the error message again to ChatGPT, and the code shall be rewritten.
You might finally arrive at a workable script by such an iterative course of that’s typical of the coding course of.
It’s all the time good to double-check manually throughout a number of ticker symbols and perhaps timeframes to validate that the purchase/promote sign generated is what you supposed.
We hope you loved this text on.
You probably have any questions, please ship an electronic mail or depart a remark beneath.
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 aren’t aware of trade traded choices. Any readers on this technique ought to do their very own analysis and search recommendation from a licensed monetary adviser.