
Its been a long time since I've made a post, and so I decided to put up something different from a usual post. This post is about a stock charting tool that I developed during my "stock-market days" (the meaning of that might require another post ;-). 5 years back, the stock market suddenly started appearing quite attractive to me. After studying the subject for some time, I decided to explore the path of Technical Analysis. Reading books like Edwards and Magee's Technical Analysis of Stock Trends was a great motivator at that time.
Having chosen the path of technical analysis, one of the important missing factors was a tool which would help in plotting price charts and technical indicators/overlays. Yahoo! finance was a good tool, but then, I felt it would be more convenient to use a desktop chart plotter (maybe I need to thank my erstwhile slow-internet-connection for that!). There were other commercial softwares available in the market; however I didn't want to miss the thrill of developing it. So I wrote this little program that would fetch price/volume data from
NSE's website and plot charts/technical indicators.
In this post I'm attaching the source code for this little program. Its written in Perl and uses the Tk module for graphics stuff and LWP for fetching data from NSE.
The program supports features like
1. Creating your own portfolio of stocks (although it just supports one portfolio currently :)
2. Sync-ing with latest price data from NSE. Although this is currently tied to NSE, it wouldn't be too difficult to map to it to another data source. (in fact my first data source was a different website; but after they stopped providing data feeds, I had to switch to NSE)
3. Price and Volume charts
4. MACD chart (MACD variables are currently fixed at 4,6,12)

5. Simple Moving Average - 5,10,20 days averaging (probably my short-term trading influenced these numbers :)

6. Exponential Moving Average - 6, 12 days
7. CandleStick charting

8. Support/Resistance Lines
9. Adjustment for Stock Splits

The source code for this program is available
here under the GPL license. Hopefully someone starting to build a similar tool will find this useful!
Update Sep 18: A friend of mine reported that NSE has apparently changed the data feed format. So, for those of you who'd like to get a preview of Elevetrica.pl before the formats are sync'd up, here's a
sample zip file for the data that would be fetched in with the older format.