Updating the Bars object from within a strategy
Author: haytac
Creation Date: 6/26/2010 8:49 PM
profile picture

haytac

#1
Is it possible to update the Bars object OHLC components from within a strategy during trading hours?
profile picture

Eugene

#2
Anything is possible. Why would you need that? Which data provider?
profile picture

haytac

#3
Hi Eugene,

This is from a previous post of mine and response:

" Not in Version 4 - not even from the "Refresh" action in the data tree. That Refresh is for the DataSources and WatchLists only - not for the data. Currently, the only way to refresh the data is through the Data Manager, Data Editor, select Symbol, and then "Reload Data"

In Version 5, you'll be able to reload from the chart (although I personally don't like it that easy to access since I've already hit that action accidentally)."

The data provider would be Fidelity.

I have three reasons:
a) The WL 1 minute streaming mode sometimes works and sometimes does not for me. It is hard to depend on this for intraday trading.
b) The strategy may take more than one minute to run. It would be nice to start a refresh and have the 1 minute Bars object to update the one or two minutes that need updating. A related question is: what happens when 1 minute streaming is working but the strategy run is delayed by more than this.
c) The main value of WL for me are the indicators. I would like to decouple the indicators from trading.

Thanks and Regards,
Hal

profile picture

Eugene

#4
Hi Hal

The response quite clearly tells about the possibility to refresh the symbol's data, it does not seem to be linked with your question. Frankly, I imagined something else than workarounds but from your reasoning, it's still unclear how do these 3 points connect to updating the Bars object from within a strategy, i.e. something that is documented as Bars.SaveToFile.

QUOTE:
a) The WL 1 minute streaming mode sometimes works and sometimes does not for me. It is hard to depend on this for intraday trading.

As to the WL streaming, as you may have heard, in the very next version of WLP, the Fidelity data provider will be changed (waving goodbye to Fideity Server and thus allowing to have a native x64 version of WLP as a benefit).
QUOTE:
b) The strategy may take more than one minute to run.

In this case, you obviously need to optimize both the code and the workflow (i.e. switch to a 2-3 minute scale) so that things like that couldn't happen - as opposed to inventing workarounds.
QUOTE:
c) The main value of WL for me are the indicators.

As far as I know, tick indicator update and displaying indicator's PartialValue are to be considered as potential enhancements, if that's your point.
profile picture

Cone

#5
QUOTE:
Is it possible to update the Bars object OHLC components from within a strategy during trading hours?


a) Streaming should be realiable, but if it's not, it can't be a reason to update from a Strategy. If a new bar doesn't come in, then the Strategy doesn't run, so it can't update OHLC anyway. It's a chicken or the egg scenario.

Fidelity is getting a new Streaming provider and Authentication next release. I'm fairly confident that the intermittent problems with Fidelity streaming are some combination of the two components being replace, and will be testing for reliability.

b) More than 1-minute? For a Version 5 Streaming Strategy? Using a modern processor?
Something is probably wrong there, or there must be a way to reduce that execution time significantly (or maybe you shouldn't try to trade such a complex Strategy on 1-minute bars.

c) Of course you can just look at indicators in a chart without a trading Strategy. Explain more.
profile picture

haytac

#6
Hi Eugene, Cone,

Thank you for your answers. They help me understand my problem a bit clearer.

There are two considerations that lead me to these questions:
1) Intraday behavior of WL is unpredictable. One minute streaming works half the time. It hangs the rest of the time.
2) I do stock and options trading.

1) I can posibly handle this issue as follows:
1a)Start manually a 1m WL srategy (that never exits) before the market opens, This provides Bars for 1 minute for the day before as well as Bars for Daily.
1b)The daily indicators (20 day, 50 day etc) do not change so they can be used in the 1m straegy for the new day.
1c)The 1m indicators can be computed proiding I have a way of getting quotes.
1d)If WL stalls in streaming mode, I can start it manually once and keep getting real time data via web access to Fidelity. I can then compute the 1m indicators in this strategy without ever leaving it. This is where the refresh question comes in but as you say if WL streaming stalls there is no telling if I will get 1m Bars object updated. The nice thing about the Bars object is that it has the sharp 1m intervals.

2) WL does not provide options quotes. So, I need to go somewhere to get them. I tried to get them from Fidelity web but unlike the manual options quotes, the quotes my C# got were 30 minutes old. I was able to login fine but somehow it knew the HTTP requests were not coming from a browser.
2a) If I go to a web site then it is not clear if my strategy will exit within 1 minute. This is another reason why I would like to just run once and keep refreshing data.

I wonder if the reason why Fido is changing streaming provider is that these problems are common?

Thanks and Regards,
Hal
profile picture

Cone

#7
I'm not confident that the Streaming provider is the problem... after all, AT Pro doesn't have the problem, does it?

Anyway, if you see one or more charts stop, log out and log back in. It should refresh and start streaming again immediately.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).