Can I write a script querying multiple F&O or Nifty stocks

I want to write a script say, to find out the set of all F&O stocks that are crossing the 50 day SMA from below at Close. Currently, a script can be run only on a specific stock chart. Is there a way by which I can write a script and ask it to generate an alert if any of a group of stocks (say any of the F&O stocks) satisfy the conditions given in script? Better if we could do it without opening any chart.


Yes, You can do this in Zerodha Pi.
Choose the artificial intelligence Option and Write your Script for your conditions.

Any stock while market is Live fullfill your Script conditions you will see on your screen.

Thanks a lot for your reply. Today I wrote an EA with my conditions. But looks like we need to apply the EA, in order to activate it. Under artificial intelligence, the “Apply Expert Advisor” option menu button appears only if I first click on a chart. So I am able to apply my EA only to an open chart (a single stock). Please advise on how I can start an EA in the background for a list of stocks (say all F&O stocks or on all Nifty 50 stocks).


@bsriman I’ll let you know after today’s Market hours.

ok thanks. Shall wait to hear from you.

Click on “Get Code” to see Scripts.

Follow this link and you will see Script which are written by experts. This will give you idea to create your own scripts.

Thanks for your response. I saw the link and as I understood earlier, it gives examples for different EAs. Actually, if you read carefully, my original question was not on how to write scripts. It was on how to apply a script simultaneously to a set of stocks (say all F&O stocks, which is more than 100) or on all Nifty50 stocks. The script should run in the background on a group of stocks and then generate buy/sell signal even if one of these stocks satisfy the script conditions. Currently, we can only apply an EA on a single chart.

So I assume such a facility is not there currently. If you still think that it is there in Pi, please tell me specifically as to how we can apply an EA on multiple stocks, without opening charts.


@bsriman Check out this video.


Thanks a lot for the video. This was exactly what I was looking for. I shall try this out and in case of any further clarifications, shall post in this thread.


@bsriman welcome.
This platform is created for helping each other :slight_smile: