Hi all,
I’ve spent the past few months building a Windows app on the FYERS API for testing strategy ideas on historical data. Here are a few things I learned along the way, in case they help anyone building something similar:
1. Historical data and warm-up bars
Indicators like a 200 EMA need plenty of history before the first signal can be trusted, and the shorter the timeframe, the more of that history you need. I fetch a history window based on the timeframe, so every indicator is fully warmed up before the test starts. I cache it per symbol, so a re-run doesn’t hit the API again.
2. Testing a basket of 50+ stocks without freezing the app
Running a strategy across a whole basket made the UI hang at first. What fixed it was parallel fetches with a small worker pool and retries, saving to disk in batches, and refreshing the screen once at the end rather than once per symbol. Now a full basket run stays smooth, and the app responds the whole time.
3. Realistic fills in a backtest
Checking stops only at the candle close makes results look better than they would be in practice. In my backtester, a long’s stop is checked against the candle’s low and a short’s against its high, and the stop is checked before the target on the same candle. That’s the conservative order, so a test never assumes the best case.
4. No-lookahead indicators
Every indicator value at a candle uses only that candle and earlier ones. I check this by computing on part of the data and comparing it with the full-data result; they must match exactly. It’s an easy way to catch repainting.
What the app does: Python strategies, backtests on a single symbol or a basket, optimisation, and portfolio results with a full trade list. It uses the FYERS API for market data only. It does not place orders.
Happy to answer questions about any of the API parts, python coding(indicators & Strategies), backtesting or to hear how others have handled these problems.
It’s completely free to use.