Back

Over riding strategy that is running live.

Can user override strategy that is running live. For example a strategy trading through Interactive Brokers.

Update Backtest








Overriding your strategy is something I have thought about also. Should you abandon your strategy when the market changes and your strategy is not working any more? More to the point, my strategy works great in back test and works very well in forward test/paper trade, but when I take it live I have mixed results. Specifically, my strategy favors trends and when the market starts ranging, I do not have a way to switch to a mean reversion strategy, so the algorithm starts to draw down; meaning lose money. I then lose faith in the algorithm and pull it from production.

At a trader meetup in my area, I was talking to another algorithmic trader and he asked me. Do I believe in my strategy or not? If I believe in it, I have to let it do it's work and not second guess it. Taking me out of the equation is the reason I went to algorithmic trading in the first place. I am a retail trader and I almost always guess wrong. That has been proven to me over and over again.

That being said, one technique one can use to "override" a strategy is to use an custom data type. Go to the University and search for "Custom Data". You will find an algorithm for "QCU How Do I Use Live Custom Data?". It is for bitcoin, and you can look at the bitcoin.cs class. In there the Bitcoin type is derived from BaseData and adds a couple of properties and gives it a symbol. Then by overriding SubscriptionDataSource GetSource(...) you add a url for both livemode and back test, which hits a website which returns data that matches the custom Bitcoin type. It then overrides the BaseData Reader function to convert the incoming data from a csv line to a Bitcoin type and returns that new object. Then in Main.cs, it adds an OnData event, which is fired for each bar in your Resolution.

In your case, you need to write that data source that the custom data calls on each bar to return one or more values. I wrote a web site with a web api, but I believe you can also use a call to your Dropbox to just read a file. Then the values you return in your custom data can be used to adjust your running algorithm. For example, one "override" to a strategy would be to stop and start it. Declare a variable in your algorithm, say something like, bool allowExecution. It is true, enter an order; if false, do not enter an order. Then you set your custom data source to return a 1 or 0. In the OnData, if the data is 0, set allowExection to false; if 1 set allowExecution to true.

If your "override" is to change some parameter(s), you can return the new parameters in your CustomData and set variable in your algorithm from it.

I have used this technique to get signals, such as: buy MSFT or sell MSFT, from a custom data source and it worked well. However in the end, I decided that if I did not have faith in my algorithm, I do not deploy it. Wait until until I do have faith in my algorithm.

I hope this helps.

Nick

2


You can issue manual trades through our live environment, but if any trades are detected outside of our system we actually terminate the algorithm - this is because its important algorithm state is maintained (portfolio holdings, cash etc).

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.


Thanks Jared. Interactive Brokers data sometimes is bad. This has happened once. I want to be able to go flat.
I always put in failsafe stops but if data is bad how will they know
0

Had bad data from Interactive Brokers once. Had to stop algo.
Usually happens during heavy use periods like the open and for some reason at midnight EST.
I have fail safe stops but if data is bad how will they know to trigger. Thanks for reply. Only other option (if your platform supports this) have two data sources as a check.
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