June 1, 2011

Learning Python helps me with Excel

I use Excel extensively at work and I’ve always wished to write intricate macros but never understood the complexities of Visual Basic.  After spending a few weeks learning Python, I’ve managed to build an Excel formula in VB that creates an IF statement formula if a hammer candlestick formation has  occurred.  I use this as a macro function and apply it automatically to my downloaded data using TraderXl.

The formula is generates a 1 if a hammer has formed or a 0 if not.  Assuming you’ve downloaded 153 rows of a stock’s date, open, high, low, close, volume in the A, B, C, D, E and F columns respectively. The output is in column P; you may modify it as you see fit.

Whoop-de-doo, right?

Well here it is:

ActiveCell.FormulaR1C1 = "Hammer Formula"
ActiveCell.FormulaR1C1 = _

Don't forget to sign up for our monthly newsletter on Data Science and RapidMiner here!

Python Excel tutorials

Previous post
R and Rapidminer Together = Disruptive Technology! I’ve been teaching myself R now that I finally got Rapidminer’s R plugin to work.  It’s  pretty slick program and easy to learn, I’ve picked up
Next post
A Botched "R" plugin installation in Rapidminer - Solution I decided to install the “R” plugin in Rapidminer recently and seriously botched the process.  I botched it so bad that Rapidminer got stuck in an