Algo Trading in India |
Code your Trading Strategy in Trading View using ChatGPT
  • March 27, 2024
  • admin
  • 0

More than 30 million users actively use Trading view but very few people have Pine script coding knowledge due to which many users just stick to basic Trading view charting functionality, let me explain how can you write your own Pinescript code using ChatGPT free version.

I wanted to study the spike patterns in BankNifty on expiry days, within 5 minutes if market moves greater than 100 points I wanted to track those days and see what happens after such spike, does market makes follow through move or it reverses after spikes?

Go to ChatGPT and enter the below Prompt Create a Pinescript that can track every candle and see if market has moved up more than 100 points or moved down more than 100 points in just one candle and plot bigger text S above that candle. Image

Key is to be specific with your prompts, it’s all about asking the right questions to get what you want. Create a Pinescript that can {mention your condition} and plot {mention the outcome you want} Go to Tradingview, click on Pinescript at the bottom of the chart, copy paste Image

If there are any errors , copy paste that error into ChatGPT window so that it can be fixed. Once the error is fixed, copy paste the new code which would display where spikes happened, whenever underlying moves > 100 points in 5 mins, it displays a Spike in the chart.


The given code tracks the spikes on all days, I want to track it only on Wednesday, expiry days for bank nifty, so mention the same to ChatGPT which will make necessary changes in the code. Copy paste the new code in Trading view to track only expiry day spikes.


You can also backtest a trading strategy using pine script with the help of ChatGPT, just mention the rules clearly and you would the code in seconds. Copy paste the same in trading view pine script window. If there are any errors , copy paste the error back to ChatGPT.

The code would automatically plot Long and Short entry on the charts, also you will get the detailed backtest results with complete trade list. You can play around with the parameters like adding stop loss, targets etc. Also you can change the time frame to get different results. Image

You don’t need to subscribe for paid versions, all these can be done with free version of Tradingview and ChatGPT. If you haven’t explored it yet, I would highly recommend you to get started with such analysis that helps you in creating strategy based on market behaviour.

There are good traders & there are good coders, but there are very few traders who can code & trade well which is a deadly combination, with the rise of AI platforms coding becomes lot more easier for non coders. This could be your first step into the world of Trading + Coding.

Leave a Reply

Your email address will not be published.