Hi,
I have need to "programatically" load chart with different startdate and enddate (DataRange). As an example, while running a strategy one can select the #of bars, startdate-enddate etc. using the DataRange in the DataPanel, instead of using the DataPanel, i want to "programatically" select range and load it.
I know i can create a separate bar object-> copy bars for selected DataRange -> Bars.saveToFile->Bars.LoadFromFile etc.
I was wondering if there is an API call i can make from the strategty, so i dont have to use the above mentioned messy code.
Size:
Color:
Anything that you do in a Strategy is dependent on first loading the data that you've specified in the Data Panel. While you can modify Bars OHLC/V data in your strategy, currently it's not possible to change the Date list (though we've requested that capability).
So, you can't change the primary Bars Dates, and I can't think of another way other than using Bars.LoadFromFile for a secondary series. We don't know what your purpose is, but if you don't synch a secondary series to the primary, you cannot use it for creating trades, for example.
What is the purpose?
Size:
Color:
Cone, Thanks for ur quick response.
What I am trying to do is simulate RT data feed for my strategy. I want to generalize it to work for any symbol/sclale.
So, suppose I want to look at 1minute data for AA starting from open of yesterday to 10AM today. I Dont want to load my chart with any data after open yesterday to 10 am today. on next run I may want to run to 10:31am etc. I know i can use... for(bar=begin, bar<=end,bar++ ){ my code} to do it but when the startegy ends, the chart displays the data for entire range (as selected by the DataRange in DataPanel), I have to manually scroll to area of interest.I want to be able to look/recognize mathematically patterns as they are being formed.
I was hoping to use existing code/class that is used in datapane's datarange selector, instead of writing some big code.
I think API for data adapter might be helpful here but that is an another story.
Thank you.
Size:
Color:
Of course the right way to simulate streaming is to use the streaming API and then add the static bars at whatever rate you'd like. Aleksey created a streaming adapter that did that for 4x, and I really don't think there's an adequate way to do it other than creating a streaming adapter for that purpose for 5x. It's another project I think we'll eventually get to, but probably not for another year.
Size:
Color:
Thanks cone.
Thats a long wait! Any news on data adapter API release?
Can u suggest a way/method to programatically load/plot "snap shop" of data for a symbol as described in my last post. e.g. load & plot first 200 1min bar for today, then first 201 bars etc. so that the last bar displayed is 200th bar, 201st bar etc.
Size:
Color:
Re: Data Adapter API
I thought it was coming out with the rest of them. That goes to show you how much I know!
QUOTE:
Can u suggest a way/method to programatically...
You can't change the number of Bars loaded from a script, so forget about that. I actually just gave this some thought, and have an idea based on my first answer -
changing the chart's OHLC/V data with the data that you've loaded from file. In theory it should work. The idea is this:
1. Load whatever number of bars you'll need for your script's pattern recognition logic. It doesn't matter what time frame you use assuming your script is "time agnostic".
2. Grab the Bars.LoadFromFile for the data that you want to run the logic on. Let's call that Bars object
BARS.
3. Let's say the chart has 200 bars and
BARS has 900. (If
BARS are 1 year of 1-minute bars, then it probably really has something more like 100,000.) You're going to use the chart's 200 bars over and over by changing their data using the
BARS data.
4. The trick is that you can't do it all with one script execution. That's because Wealth-Lab won't render the chart until script processing is complete. So, you need to keep a static class variable in to track where you are and hit "Go" or F5 to "load" the next bar.
You can be as fancy as you want here, but let's say you want to run starting with the 500th bar in secondary series, it would look something like this -
CODE:
Please log in to see this code.
Size:
Color:
Thanks Cone.
I will give it a try and keep u posted. Cheers!
Size:
Color: