Back

Inside day breakout

Thinking of starting to work with this platform. I was looking for some code of something like an inside day breakout to get me started? Any suggestions?
Update Backtest








I've worked on this a while back.

What you will need is a filter that can detect breakouts either in terms of price or in terms of volume (which QC doesn't offer).

Here are two relevant questions from StackOverflow:

Time Series Breakout

Peak signal detection in realtime timeseries data

[Disclaimer: the second question and best performing algorithm is mine]
0

Thanks. I was looking for something simpler in QC code, example:

If high of yesterday < high of 2 days ago and low of yesterday > low of two days ago and close of today > high of two days ago then buy with TP% target or sell with SL% stop
0

That's just simple logic. You should be able to do that by saving the closing prices and some if-statements.
0

I did it in about one day in Multichart platform (my trial expired) but I am struggling here with documentation for about 5 days and I cannot find the relevant information.:

https://www.quantconnect.com/docs/QuickStart#1.1

This is too condensed for no professional programmers. It is more specs than a guide. Maybe I am not fit for this task.:) Anyway, thanks.
0

@JPB - "price or in terms of volume (which QC doesn't offer)" - we offer both JPB! :)
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Rick!

You might like to see a good example algorithm to get you started :-)

I quickly drafted together something along the lines of what you requested in your second post. Every midnight, this algorithm does two things:

1.) Adds the most recent day's open, closing, high, and low prices to a "rolling window" object of length 3 (a rolling window object is just like a list, but has constant length; when you add items to it while it is full, older items drop out of the bottom).
2.) Evaluates your logical statements for an example company stock (AAPL) using the rolling window data and makes trades based on the logic.

The crux of the algorithm (and all algorithms in general) is the OnData() method, which gets called at midnight each night when the securities are updated on daily resolution.

The logic seems to work well but, in the one month of backtesting I tested, it never made any trades because there was never an occurrence where all three of your checks that you mentioned returned "true". Anyway, take a look at it and note the logs it is writing.

PS. I would clone this and view it in your IDE, not on this forum. The code formatted badly, so it'll look weird here.
0


@Jared Broad

Oh my bad! I didn't know that. That's very good to know :)
0

Thanks Stephen but I am giving up. This is too low level programming for me. I will settle with something simpler. I appreciate your help.
0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed