Custom Indicators on SAHI: Build Your Own Indicator, Free
Watch: Custom Indicators on SAHI
Build your own in SAHI Script
Open any chart on web.SAHI.com, tap Indicators and choose New script. You won't start from a blank page. It opens with a working EMA, with settings for length and source you can change without touching the code.
Write your own indicator in SAHI Script, or paste a script you already use.
Built for how India trades options
Whether you trade index, stock or commodity options, the data you usually check on another screen is already inside SAHI Script, you probably check PCR, OI and max pain on another screen before you act. SAHI Script puts that data inside the language itself.
- Live PCR, OI change PCR and volume PCR. One line each, for the instrument on your chart.
- Max pain, OI-based support and resistance, and the expected move. Built in, ready to use in your own logic.
- An expiry dropdown. It lists the option expiries available for your instrument, so you can switch expiry from settings without editing code.
- Numbers the Indian way. Large values can show in thousands, lakhs and crores.
Here's how simple it is. This one line gives you live PCR:
pcr = request.pcr()
No option chain, no second tab.
Build your first indicator in three lines
Let's start simple: a moving average where you choose the length.
- Open web.SAHI.com on your laptop and open any chart.
- Tap Indicators, then New script.
- Replace the starter EMA with the code below.
- Apply it to your chart. Applying saves it.
indicator("My average", overlay = true)
length = input.int(20, "Length", minval = 1)
plot(ta.sma(close, length), "SMA", color = color.blue)
What each line does:
- Line 1 names your indicator and puts it on the price chart.
- Line 2 adds a Length setting you can change later, without touching the code.
- Line 3 draws the average of the last 20 closes.
Want 50 instead of 20? Open the indicator's settings and change it. No code edits needed.
Bring the scripts you already use
If you've written or collected indicator scripts before, you don't have to start over. SAHI Script follows the version 6 syntax most traders already write in, so most indicator scripts run with little or no change.
Open New script, paste your script and apply it to your chart.
One tip: share scripts as a text file, not as a chat message. Chat apps sometimes turn characters like 8) into emoji, which breaks the code.
An editor that has your back
When you write code, things break. The SAHI Script editor is built so a mistake never costs you mid-trade.
- Errors on the exact line. If something's wrong, the editor tells you what and which line. No guessing.
- No broken scripts on your chart. A script with an error can't be saved, so it can't land on your chart while you're trading.
- One-tap Report Issue. Sure your code is right, but it still won't run? Tap Report Issue. Your script and the error go straight to our developers, with no screenshots needed.
- Code beside your chart. The editor opens as a pop-up. Use the three-dot menu to move it to the right or bottom panel, and watch your chart update as you edit.
- Docs inside the editor. The documentation, release notes and FAQs are in the same three-dot menu.
- My scripts. Save up to 20 scripts. Star the ones you use every day to keep them on top, duplicate a script to try a variation, or download it as a text file for a backup.
Build on your laptop, use it on your phone
You build custom indicators on web.SAHI.com. Once you apply one to your chart, it syncs to the SAHI app. On your phone, open any chart, tap Indicators and find it under My scripts.
Your indicators also run on seconds-level charts, so they update at the speed intraday traders actually trade.
What's not available yet
We'd rather you know up front. Today, Custom Indicators support indicator scripts. These aren't available yet:
- Strategies, so there's no backtesting
- Libraries
- Alerts from your custom indicator
PCR, OI change PCR and volume PCR are live values. They show the current reading on your chart, not a history of past days.
Frequently asked questions
Is it free?
Yes. Custom Indicators are free on SAHI, and you can save up to 20 scripts. No subscription, no per-script fee.
Do I need to be an expert coder?
No. New script opens with a working EMA you can change, and settings let you adjust an indicator without touching the code. You can also paste a script you already use.
Can I use scripts I already have?
Yes. Most version 6 indicator scripts run with little or no change.
Do my indicators work on the SAHI app?
Yes. You build them on web.SAHI.com, and they sync to the SAHI app under My scripts.
What if my script shows an error?
The editor shows what's wrong and the exact line. If you think your code is right, tap Report Issue and our developers will take a look.
Build yours today
Your own custom indicator, on your own SAHI chart. Absolutely free.
Open any chart on web.SAHI.com, tap Indicators, and choose New script.
Example code in this post is for learning only. It is not a buy or sell recommendation. Investments in securities market are subject to market risks. Read all related documents carefully before investing.
All topics
Click the link, confirm the box next to sahi.com is checked — ignore any other results.