Back

ETF trading strategy

Bump it up to 5.5 sharpe with 40% annual return. Assuming IB transaction costs and 15 cents slippage.
Update Backtest








That is very cool. As a financial newbie, I'd never heard of the Hawkes process. Thanks for sharing and showing me something new to study.
0

Hawkes process isn't related to finances, it was first created for earthquake prediction. I'd suggest for you seeing the whole world as signals, so using algorithms you can analyze social physics and same algorithms can be applied to any other data, like pricing of financial instruments.
0

0

Hi, can I clone this algo to use myself?
0

Hi Robin, the small chart above has a Clone Algorithm button. I'd recommend checking out this tutorial: Introduction to the IDE
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 Satyapravin,
0

sorry about the last post....

Satyapravin, I see that you liquidate all holdings after 60 seconds. Is there a specific reason for this? I.e. have you tried other settings?

BR,
Max.
0

@Max, I was just trying something and did not have a concrete exit strategy. 60 seconds looked right since it is a temporary correction. I will let you know if I come up with a better exit strategy.

Best regards, Pravin
0

I elaborated with the time span and I achieved higher sharpe ratio when increasing it to 90 but the annual profit % dropped a bit. Looks very promising though! Looking forward to try this algo in auto trading once that feature is implemented.
0

How did you come up with the buy/sellpressure triggers (i.e. 10) ?
Optimization trap/lookback bias is on the back of my head....
But nice work anyway :)
0

I thought about that too. Since optimization isn't available so far (as far as I know) I just tried to increase and decrease it.... but so far I get the best results with 10.
0

Hi,

Made some minor changes.

Entry:
Each entry invests 25% of available cash. As money management this might seem crazy but might be acceptable due to the win rate for this strategy. If the percentage is increased to 50% the net profit gets nuts.

Exit:
As long as the asset is going in the "right" direction, depending on if we're long or short on the market, we're staying in the market. I.e. we're not liquidating strict after 60 seconds.

Thanks Satyapravin Bezwada for this strategy! I'm still trying to learn more about, and understand, the Hawkes process to fully understand this strategy. It's been a couple of years since I studied Math at the university......

BR,
Max.
0


Hi, it looks interesting, but I noticed one thing : this strategy makes entry only when calculated pips variable becomes very high !!!. I logged all entries on only SPY and
1

Hi, it looks interesting, but I noticed one thing : this strategy makes entry only when calculated pips variable becomes very high - so when we see spike in trading prices. I logged all entries on SPY and used IQFEED to get trades. All these spikes look like outliers. I'm very unsure that it will be working in reality.
2

This how this SPY 1 sec series looks for 04/08/2014

You can see outliers where this strategy generate signals.
2

Possible scenario as usually such spikes are widened sprerads, not real prices.
0

Thanks @Ardar, if that's true I'll fix it today. We build our data from raw ticks and those are genuine ticks from the exchange but they were probably cancelled later. QuantQuote has a suspicious tick flag we can use that to eliminate outliers. I'll confirm with the raw data today.
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.


Jared, I took these ticks from IQFEED and built 1 sec series on them. But it's very similar that you have same issue.
0

Interesting, I confirmed they are in the raw ticks as well but as you say they probably can't be traded in reality.

I will update the base QCAlgorithm and add a filter on the Securities Interface to delete them and let each security filter its own data. Later if you want to use different filters or remove the default filter you can override it (similar to how the Transaction Model classes operate). Sadly this might break Pravin's beautiful strategy...
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.


@Jared when will the updated QCAlgorithm be available?

BR,
Max.
0

Hey @Max - I've completed it and will push it to github now. We redeployed servers this morning.

This example below uses the data filter to only trade on Wednesdays :)

I built an [unfinished] more complex standard deviation filter in link above but it was too dangerous to make default. Stocks that were not liquid triggered the filter with legitimate data. Even premarket data on the SPY was so choppy it triggered the filter. So I'll release the tools to you now, and leave it up to you guys to build the right filter for this strategy. Here is the day from Ardar's snap shot above to get you started: 20140804_SPY.zip
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, Jared, as for filter : as I know usually it's used very simple one : if trade goes beyond the ask:bid range significally (let's say 2 x (ask-bid)) then it's just removed. But in this case you need to maintain quotes aswell.
0

Understood, sadly we don't have the quotes, but the provider does include a suspicious flag. We pass that through with the tick data, but it wasn't used in the second & minute bars.

We've started the process of regenerating the entire data set with this filter flag activated to remove bad ticks for second and minute bars, and if people want to use all of the raw ticks they can drop down to tick resolution and see the suspicious ones themselves. The re-processing is automated but will take at least 7-10 days I think. There's a lot of data to crunch. It might not remove everything either, so we'll leave the filter there as well for full control.
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.


@ Parvin
Hi Parvin, thank you for sharing this strategy.
I can't see where you calibrate the hawkes process in your code?
Could you please elaborate a bit on this.
regards
0

I think its valuies from bitcoin article (above), but actually those values don't matter much if beta is times less than betafactor. Calibrations usually work in backtests only, but not in the forward testing. Usually at least :D
1

As a side note. Understand the logics behind process. Simply said it acts on extreme spikes (i.e., errors, anomalies). Actually, a lot of sciences have anomaly detection techniques. For example, detecting marijuana in fields of crops using aerial photography. We can try any of methods in various different disciplines if you think about financial data as any other data. Problem with financials, they are not static as shapes of broken chains or crops.
1

Imo the data for the simulation has major flaws. I reimplemented the strategy using IB 1 second tick-data and had a completely different (much worse) result. 80 cent per share discrepancies (see image) in the same tick in thickly traded instruments like IWM are very very bad.
iwm
fotos hochladen

0

Thanks @Andreas, we diagnosed this on Aug 8th above -- the data is real, even much better than IB's feed (IB is a market maker) - it is just too real :) The trades are from high frequency, low volume flickers that some retail providers don't capture. We're doing some filtering on the data now and have built in a way for you to implement your own data filter - its part of the difficulty of working with tick data unfortunately. If you're curious can purchase 1-symbol-year directly from QuantQuote to see the raw ticks
1

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.


Haha, I'm so slow, I've just read QuantQuote data sample. Questions regarding this. Is there a possibility on script to call exchange name and trade size? Are there quote ticks available or just trade ticks?
0

Hey Tadas - absolutely, it is in the "Quantity" and "Exchange" properties of tick data, (here on Github). Exchange is a short code expanded here.

We don't have the quote data but QuantQuote offers that as well. I'd like to offer it, but its more expensive than trade-only and 90% of users are using second data maximum. One thing to consider if trading through QC is the live data streams are broker provided so often aren't as good as our historical source (e.g. IB is updated every 300ms). Tradier datafeed is built from trade-streams just like our backtests.
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.


Hey Satyapravin Bezwada,

First of, thank you for sharing the strategy with such great performance. My back tests of this strategy against other data providers such as IB and IQFeed did not show such good results. The reason was the data of other data providers is different seriously affecting the performance. Although I tried to adjust the strategy parameters still the performance at QuantConnect is much better. Did you test your strategy against other data providers and whet performance did you get there?
0

Sergey, all, we identified performance due to spikes in market price causes by high frequency trades or exchanges not covered by retail data feeds. The spikes often lasted just for 1 tick, skewing the second bar's value. These were real market prices and also came through the live feeds on eSignal etc. Some providers filter this data after market close, and store different data to eliminate such spikes. We also found similar spikes/bars on other data providers (ardar's screen shot comment above).

It is unlikely a retail user could execute a trade on this flux given its brevity. So the likelihood of this strategy performing well in real trading is very slim. To save repeating same questions, and anyone risking real cash with this strategy I'll lock this thread --

If doing intra-minute trading I'd still recommend using a 2-3 sec rolling filter, or use tick data and scan the volume and exchange of the trades. (See comment on tick Exchange & Quantity properties above).

We're exploring the best way to make this more user friendly. Our data is more realistic than any retail source; but at the same time if you can't execute on those prices its not helpful for backtesting. Next week after live trading is humming we are scheduled to review the best way to address this. Potentially we'll build out the default filters or use a liquid subset of the markets (NYSE, NASDAQ, BATS). I'll update this thread once we do.

Best,
Jared
1

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.


What would the result be if we increase the commission to 0.2% (in percentage of capital traded instead of in absolute figure like $1) and increase the slippage to 0.8% spread between the bid-ask?
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