Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
HELP: Simple Heiken Ashi momentum trader

Hey guys, I'm new to the game of algorithms, and I'm also new to the world of development.

I was hoping to get your help on getting started with algorithms. I have an idea for something I want to follow, but I have no idea where to begin to implement the idea. Anyway, here goes:

Indicator used: Heiken Ashi (Japanese Candlesticks)
Type: Momentum trades
Criteria: When there are two bear/red candles, sell the stock. When there is a doji followed by a bull candle, buy the stock. When there is a doji, followed by a bear candle, sell the stock. VOLUME >= Average VOL 3 months.

I use Questrade (don't know if that's relevant or not) and would eventually like to implement my program into it.

Thank you for all your help!

6 responses

I was working on something, might be a start for your quest. Caveat emptor: I'm not a super coder

@Peter B., Hey thanks for the the impetus. I had to dig up my old CQG HA bar code to see how that stuff worked.

I never knew about the pandas resample parameter "how", that's pretty trick.

Below is a variation that tries to implement the original poster's logic regarding reds and greens and dojis.

@Ishtar C., The "doji" code is just a guess, but in the plot you see there there were actual dojis where the haOpen and haClose were less than .1 % separated. If you want tighter dojis then you'll need to squeeze the value further. Also, the volume test is removed in this example, it really knocks down the returns. You can put it back by removing the comment in HandleHAEntry.

Hey guys, thanks for the help with this. Peter, is there a way to change it from being a monthly reference to simply the candle of the day before? I.e. if yesterday's candle was simply a green candle, hold. If it's a doji, buy/sell depending on if it is followed by a confirmation. If it's red, sell all.

I think thats easy to do yourself with Market Techs code.... just change handle entry and handle exit

I played with this old non parametric idea, modified it and came out with such results.

pretty good, why not share the code as it was shared initially?