Can someone check my logic here.
I want to generate and execute some orders exactly 1 minute after the open at 9:31 (or some other specified time)
I have a long/short strategy and follows the logic of a rotational strategy in that it generates ranks for all symbols in a dataset. I generate 5 longs and 5 shorts. It relies on getting the previous days Daily close and the close of the specified 1 minute bar
Will the logic below be the way to go?
I plan to log in to Fidelity within WL
Set streaming on
Gather the quotes at the close of the first intraday bar (in this example) or at some other bar with a specified time stamp.
CODE:
Please log in to see this code.
Run my calculations (ranks etc..) and generate the orders to be auto staged/place
I've never automated an intraday strategy and if there is an example you could point to or a comment about the logic above, it would be greatly appreciated
To clarify, I'm not looking to get backtest results, just to simply trigger today's orders according to the trigger using the previous daily close and the specific intraday bar
Many thanks
Size:
Color:
QUOTE:
Gather the quotes at the close of the first intraday bar (in this example) or at some other bar with a specified time stamp.
It's more reliable to use
IntradayBarNumber to get the first intraday bar. As to some other 1-minute bar, have you considered the possibility of no trades going on at the bar with the specified timestamp? What is your strategy's logic going to do in this case: wait until the next day or something else?
Size:
Color:
Hi Eugene
Thanks for the suggestion. If there is no trade at the specified bar, the symbol would be excluded from the selection process and yes there is the possibility that none of the symbols have traded (and hence no trades that day) but I am using a dataset that's been preselected for being very liquid and has had a lot of volume that was traded at the opening cross (data from Nasdaq
http://www.nasdaqtrader.com/Trader.aspx?id=OpenClose)
Is the logic above sound? Will W/L behave the way I think it should it real-time?
I am clicking on a symbol within a 1-minute dataset and then putting the daily closes into a list of a daily data holders
CODE:
Please log in to see this code.
I then RestoreScale back to the original minute bars.
I'd like to in a sense pause the program to wait until the specified time. Gather whatever available closes as of the 1-minute bar and at that time generate the buys and sells. I'm not sure exactly how to accomplish that exactly
Regards
Size:
Color:
Steve, the logic looks OK on the surface. I just wonder why won't you convert the system into Daily and use Daily Strategy Scheduling in the SM because it a) relies on daily data and b) generates only 10 signals a day?
Size:
Color:
Hi Eugene
Perhaps I wasn't making myself clear. The strategy needs the daily up to and including last nights Close
It then collect quotes on all symbols in the dataset at the given time of day. In this case 09:31 but it could be a different 1 minute bar
It then calculates a rank based on that 1min Close and calculations from the daily data
I'm not sure how the strategy monitor will help but happy to learn how.
I want the strategy to in some sense "wake up" at a given time of day. Calculate my ranks and then send the orders off.
Size:
Color:
Steve,
Thanks for clarifying. "Daily Strategy Scheduling" is not an option as you're after finding a relationship between the previous day's close and the specified 1-min bar's close. "Waking up" a strategy's processing at a given time is implemented by using a time condition like in your initial post. It's activated when a bar's timestamp matches the preset time.
Size:
Color:
Yes the scheduler won't work. Is there something via streaming live quotes that would?
I can't see it, hence the post
Size:
Color:
There's no time-based activation option for intraday strategies. Your strategy window has to be streaming prior to the given time (the proverbial 09:31 in your code).
Size:
Color:
Got it but is there a way in streaming mode to monitor the bars as they come in whereby I can then check the timestamp to trigger the alerts and trades? That's what I was getting at
Size:
Color:
Size:
Color:
got it
QUOTE:
Absolutely not. Not only tick data is more noise than information, tick charts really aren't practical for Wealth-Lab as your strategy has to execute for each tick added to a chart. Furthermore, access to intra-bar ticks is not required to trade intraday. Here's how the process is in Wealth-Lab:
A complete bar updates (can be 1-minute, 1-day, etc.)
Your strategy executes over all the bars in the chart and determines if it wants to trade on the next bar.
If it doesn't, you don't do anything.
If it does, you place orders for the next bar and they're worked by your broker. (Process complete).
It doesn't say whether this works as the quotes stream in. Does it? Or do I need to "run the strategy" or click the go button at the appointed time
Size:
Color:
You simply have to click the "Stream" button before market opens.
Size:
Color:
Ok great. That was what I was after. I've never live streamed a strategy with intraday data (or any periodicity) and I was unsure how it worked.
I appreciate all your help.
Thanks
Size:
Color:
So in streaming mode, at the arrival of each and every bar (at the scale set), the strategy is re-run
I guess this was my fundamental disconnect in understanding
Please correct me if I'm wrong. Thx again
Size:
Color:
QUOTE:
So in streaming mode, at the arrival of each and every bar (at the scale set), the strategy is re-run
Yes.
Size:
Color:
I have a good understanding and appreciation of multi-time scale WL coding and how to run intraday strategies executing at particular times of day. I hope it was helpful to others
Thanks so much.
Size:
Color:
Thanks for all the previous help. Today I tried to test streaming intraday trading with a test program below.
I set the account to "PaperAccount 1"
On the Alerts tab in the strategy, I set Auto-stage to ON
I opened the Orders window and set the account to PaperAccount 1 and enabled autoTrading
I then set streaming on
For some reason, the trades and alerts don't trigger.
The program basically just generates some random intraday trades when I click on a symbol in an intraday dataset
(Here I use a modulus function to trigger the trade) after setting the time for the trade via sliders
Is there something I'm doing incorrectly?
CODE:
Please log in to see this code.
Size:
Color:
It's hardly reasonable to expect trades to happen here since there's no such required attributes as the trading loop and position handling in the dummy code. However, you should see real-time Alerts produced by this code provided that the selected hour/minute matches the current time. That's it. If you want trades, build a "real" code using the single- or multi-position strategy template.
Size:
Color:
Update: I hadnt realized the paper trading account was only 100k. I changed the size of the positions it wanted to take to $1000 and now the trades were submitted.
It was a subtle error.
The Orders tab now says the trades were "submitted" at 11:32 but the status has not changed by 11:35. The alerts still show up in the strategy window and the account balances and Positions windows show no positions.
It looks like the trades did not go though. Any thoughts here?
QUOTE:
It's hardly reasonable to expect trades to happen here since there's no such attributes as the trading loop
Hi Eugene, not sure what you mean here, sorry. If a buy order is placed, why shouldn't it go through?
Size:
Color:
You must have overlooked my reply above.
Size:
Color:
Are you referring to your post #18 ??
QUOTE:
If you want trades, build a "real" code using the single- or multi-position strategy template.
Just tried a "real" strategy fwiw, when the appointed time of day comes around, the strategy doesnt finsh it's calculations before the next minutes bar comes in. I then get a message flashed about thread aborted (likely because the strategy is trying to re-run). Other than making the calculations simpler/faster and/or getting a faster machine, is there any way around that?
Size:
Color:
Hello Eugene
I am trying to make this as "real" as possible. Basically what I'm after is looking to execute a strategy at a certain time of day given the results of some calculations based on the current 1-minute bar at that time of day and some historical
daily calculations. Below is a strategy I think should work but either does not seem to in streaming mode. It basically buys at the appointed time if the current 1-minute bar is above the 5-day daily moving average. there's obviously something I'm missing because it doesn't appear to trade. Your help is appreciated
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
Below is a strategy I think should work
Obviously it doesn't. Please re-read post #18 carefully. Let yourself digest the idea. Do not rush in with reply. Read the guides to find out what "main (trading) loop" and "position handling" are. It's in the default strategy template and your code has this all removed. Your code is not going to work without them for this purpose.
QUOTE:
Just tried a "real" strategy fwiw, when the appointed time of day comes around, the strategy doesnt finsh it's calculations before the next minutes bar comes in. I then get a message flashed about thread aborted (likely because the strategy is trying to re-run). Other than making the calculations simpler/faster and/or getting a faster machine, is there any way around that?
I'd suggest to optimize your slowly-performing strategy. Check out existing discussions: preface a google search for "Thread was being aborted" or "ThreadAbortException" with
site:wealth-lab.com/Forum/.
Size:
Color:
1. The statement SetContext( DataSetSymbols[ds], true ); causes a new Bars object to be loaded and synch'd to the clicked [intraday] symbol.
2. SetScaleDaily(); caused the intraday data to be scaled to daily, but the result is never used, nor required!,
3. And then you follow that up with another synch operation (daily to intraday): Bars b = GetExternalSymbol("ALL", DataSetSymbols[ds],
true);
I don't see a good reason to be using a DataSetSymbols loop for this, and certainly none of these operations either. I hate to see you struggle with this, so give this a try... one symbol at a time. When you're convinced it works, you can run it in the S. Monitor on the intraday DataSet.
CODE:
Please log in to see this code.
Size:
Color:
Hi Cone,
Thanks, I will examine this. I think the strategy monitor is not appropriate in this case as it is a rotational strategy. I will be ranking the symbols and just executing buys and sells on some of them
What I am trying to do is have the strategy grab the time of the latest intraday bar and if the time is right, loop through the dataset symbols, get the recent
intraday closes of the symbols and some daily data (say the previous
daily close for example) and generate some buy orders and sell order for a select few of them
I tried modifying Cone's code to this
the timestamps showed up in the debug window but not data i was trying to retrieve. Is this just due to the fact that data takes a long time to load?
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
Is this just due to the fact that data takes a long time to load?
In general it's preferred to have intraday historical data loaded and updated before running a strategy (rather than have on demand do the work). But the symbols are already present in your "ALL" DataSet, aren't they.
Size:
Color:
Hi Eugene.
I'm not looking for intraday historical, merely just the close as of the most recent intraday bar. As for the daily data, the previous (last nights) close and perhaps a few days before that would suffice. Based on that, the rotational strategy would have enough data to work with
the ALL dataset has daily data
Size:
Color:
How's this for an idea?
1. Run your daily rotation strategy the night before and export the Alerts to a text file.
2. Create a strategy that reads the Alerts and generates the trades at the specified time.
Forget about all the unnecessary scaling code. Voila!
Size:
Color:
Thanks Cone but here's the rub. I actually need the intraday close of that specified 1-minute bar vs the past daily closes so night before doesn't actually work.
My thought now if I can't make this work is to stream the 1-minute quotes to a debug window or file and then have another strategy (one that works on daily data) to read these quotes in and issue the alerts. Two step process and not ideal but it might work.
Size:
Color:
That's no problem. Use the previous day's intraday close, which is in the bar loop is Close[bar - Bars.IntradayBarNumber(bar) - 1]. But if that isn't acceptable and you must have the settled daily close, just save its value with the Alert.
Size:
Color:
So I guess I need to run this with at least 390 bars as 6.5hrs * 390 (if I were to run say, at the end of the day) to insure I have enough bars
Not the best but might be close enough. I've found some large differences between the last bar close and the settled price.
Appreciate the suggestion
Is there any way to get live streaming quotes of the pre-markets? I get that on the Active Trader Pro product.
Size:
Color:
QUOTE:
Is there any way to get live streaming quotes of the pre-markets? I get that on the Active Trader Pro product.
See
FAQ on Data >
Can I have access to premarket or aftermarket data in strategy?
Size:
Color:
Hello Cone
I tried your suggestion this morning
QUOTE:
Use the previous day's intraday close, which is in the bar loop is Close[bar - Bars.IntradayBarNumber(bar) - 1]
and replaced all calls to get daily bars and only use the intraday bars.
What I am finding (and perhaps you can affirm) that switching contexts is a slow process. I am finding that in streaming mode (using 500 bars) is that I can't get through all the symbols in the 1 minute before another bar streams in. Is there something I could be doing better?
CODE:
Please log in to see this code.
Size:
Color:
Size:
Color:
I'll give it a try. Thanks Eugene
I can get the data using the legacy mode
CODE:
Please log in to see this code.
but not in the C# extension mode
It doesn't seem to speed things up.
Basically the task comes down to this.
When the time is right
Grab the last days worth of1minute bars in streaming mode for ALL the symbols in the dataset (about 100 in this case)
Do some rather simple calculations on all 100,
Rank them (I've been using list.Sort for this)
Generate trades
Is there any way to do that before the next minute bar comes in? I've backtested the strategy and would start trading it yesterday. I just can't seem to get the trades generated in real time.
Size:
Color:
QUOTE:
Grab the last days worth of1minute bars in streaming mode for ALL the symbols in the dataset (about 100 in this case)
You don't seem to have implemented Cone's idea in posts #28 and #30. Forget about your DataSetSymbols loop running every minute. No to DataSetSymbols, no to SetContext in your production script. Cache this data
once (could be in another script). Read that later by your intraday strategy. Makes sense?
QUOTE:
but not in the C# extension mode
Then your syntax is incorrect.
Size:
Color:
It doesnt make sense to me actually. I'm really trying hard to understand the suggestions.
I do not have the alerts the night before as suggested in #28.
I also tried Close[bar - Bars.IntradayBarNumber(bar) - 1] as suggested in #30
I know the frustration is getting palpable for both of us.
I understand that I can output last nights close (or any other data I might need) to a text file.
If I need the latest 1minute bar of all the symbols in streaming mode I don't see how to get around the SetContext because in streaming mode, a Multi-symbol backtest is disabled.
Size:
Color:
Sorry for being thick.
To get around I tried parallelizing the external symbol requests so to replace the
DataSetSymbols loop but this has failed a
Stopwatch test i.e. doesn't seem to be a breakthrough:
CODE:
Please log in to see this code.
On the other hand, I do not believe that the bottleneck is WL being slow to deliver intraday data. Rather your processing of it is not adequately efficient and may deserve a code optimization. Have you already looked in this direction?
Size:
Color:
Thanks Eugene
If my code is as in post #33 where all I am doing is trying to get a return from previous close to the intraday bar (of a given time) I'm not sure what optimizations I could make. I also try to grab as few intraday bars a possible. 6.5 hours * 60 bars per hour = 390 + 10 for some buffer.
I have no problem as I said when backtesting as execution time isn't an issue but I'd have thought that there would be a way to get say, in this case, the returns for the day so far (e.g. as of some bar) and still have time to make decisions to trade a strategy on the next bar. If you can think of a way to optimize #33 that would be a great start. I could take out the PrintDebug statement which isnt necessary but helped me understand how long things took.
Size:
Color:
Have you unchecked all visualizers in Preferences before opening this streaming window?
Size:
Color:
Thanks for the suggestion. I will try it during market hours tomorrow.
To do that you have to go to Tools->Preferences etc... uncheck the boxes but then you have to exit and restart W/L
Any easier way than having to restart all the time?
Size:
Color:
There's no need to restart WLP. The change you're making in the Preferences dialog applies to newly opened Strategies.You just have to close and reopen the particular strategy window.
Size:
Color:
Good morning Eugene
Just paired down all the visualizers leaving only the Performance tab open. No joy.
Can you think of any way that I can generate an as of bar "daily" return for the symbols in a dataset (as in the code of #33 or any other way that works) in a timely matter (e.g. before the next bar streams in) so that I can generate some buy and sell orders? It seems like it should be do-able yet I'm at a loss to see how. I can see this happening in a spreadsheet instantly provided I have the intraday quotes. In fact, I have done this using Yahoo finance. The calculations I am doing are simple. Only problem is that their data is 15 minutes delayed.
I've tried an example while logged in and in multsymbol backtest mode (with collect data on demand) and it seems the real problem is with data collection.
Thanks again for your insights.
Size:
Color:
The problem (slowness) is requesting intraday data serially in the DataSetSymbols loop as external symbols. This creates a on-demand static request for the data, which for the Fidelity provider requests
at least the last 3 or 4 days of intraday data. This is a synchronous request that probably takes 500 msec to 1 sec for each round trip.
Here's another idea, but it's hard for me to know if it will work for your Strategy's architecture...
1. Use the Strategy Monitor to run the script below on the DataSet with 1-minute bars (400 fixed bars). It should finish writing all 100 symbols within 15 to 20 seconds. Make sure you have this running before the open!
2. In your trading script, delay processing by 20 seconds:
System.Threading.Thread.Sleep(20000); 3. Without using SetContext, read each symbol's data file generated by the S. Monitor script. Note that you can get the gain from yesterday's close directly from each file.
4. Only SetContext() for the symbols that you will trade.
CODE:
Please log in to see this code.
Size:
Color:
Hello Cone
Thanks for this. I will peruse the code and give it a try in the morning. Preliminarily, I hope the 100 or so read/writes take only 15-20 seconds. I am using a solid state hard drive. Perhaps writing to a ram disk is a faster alternative.
The other tack I was taking was to see if I could "scrape" tables from the Fidelity website using some C# code (preferably) or VBA Excel generate the buys and sells and executing from there or if Excel, sending the signals to a file and have a script that just executes orders.
In either case and I think it will work, the objective is to truly automate it in the sense that I can start W/L, log in to Fidelity, and leave the system unattended so that at the appointed time, the trades are executed.
Thanks for paying attention to the topic and chiming in.
Size:
Color:
I think this works. Wrote all the code and my strategy's architecture seems to support it.
One question as I read up on the strategy monitor.
It seems that I should place both strategies into the monitor.
The strategy that Cone generously supplied works on the entire dataset.
The strategy that generates trades works on a particular symbol within a (1minute) dataset. It then has to run a DataSetSymbols loop to read the files and then generate the trades.
1) I'm not sure how to specify a particular symbol in the correct 1-minute dataset so the DataSetSymbols loop runs correctly.
2) The Wealth Lab User Guide shows a strategy monitor with an AutoStage button. If AutoStaged is it placed right away if Auto-Trading in the orders window is on (I believe so but want to reaffirm)
3) I'm reading about Behavior as a Function of Scale in the Strategy Monitor section of the guide. Is this an issue for this approach?
QUOTE:
Behavior 1: Intervals 5 minutes and lower
· As soon as the strategy item is activated, a thread is launched to update data history for each symbol.
· If the symbol is not in the local data store, this will result in a long delay. These data are updated on demand and saved locally.
· Thereafter, data from new interval updates are not saved (eliminates disk access delay for saving multi-megabyte files).
This is a very creative approach. I'm looking forward to testing it
Size:
Color:
With respect to point #1 above
In the strategy monitor the strategy "Write One Minute Bars" is using a dataset called 1-minute SP100 which contains all the symbols from the S&P100
The second strategy called "Generate the trades" has as Data the symbol AAPL selected from the 1-minute SP100 dataset.. Will the Dataset symbols loop through all the symbols in the dataset as it "knows" AAPL was selected from the correct dataset? Because the Data column only says AAPL I am unsure of this.
Thanks again
Size:
Color:
QUOTE:
Will the Dataset symbols loop through all the symbols in the dataset
Yes it will, exactly like the Strategy window would. But don't just take my word for it: run any rotation strategy in the SM this way and notice its results (trades/alerts).
Size:
Color:
Thanks for clarifying Eugene
All set up in SM this morning. Logged in, Strategies activated, Auto-stage, and the orders window open with Auto trading enabled for Paper accounts. Have to leave before the open and be away for a while so this will be as real a test as possible
Size:
Color:
Update:
The "write minute bars" strategy goes off every minute as planned. It updates all but about 1-7 symbols in about 30 seconds or so and then it seems to stop until the message "Leaving Streaming Filter Monitor Thread" under the Action heading. I'm not clear why it would complete the majority of the symbols so quickly and then unable to complete the very last ones. Thoughts? Is it possible for you to take Cone's code and try it on your machines and see if the issue exists on your end as well. Try the SP100 or the Nasdaq 100 as an example.
Not sure, but could it be that if there were no 1 minute bars for a symbol that that is what's hanging. I'm trying to test that but it is difficult to track at the 1-minute time scale
Size:
Color:
QUOTE:
unable to complete the very last ones. Thoughts? ... be that if there were no 1 minute bars for a symbol that that is what's hanging
Right. It's because there are no updates for those symbols.
If a symbol doesn't trade during the interval, the S. Mon. waits until it can wait no more. In my test, 100 symbols updated in less than 20 seconds... mileage will vary, but I'm currently using a cellular network off the coast of Africa!
With respect to your strategy, the last close will still be available in the file, so there's no incompatibility if the symbol doesn't trade in the last minute.
Size:
Color:
East or West Africa?
Hi Cone
So here's my take on the day. SM creates the files, just that some symbols don't update.
The generate trade code executes if nothing else is running in a split second if nothing else is running (e.g. when I ran it after hours)
However when I ran while strategy monitor was running. It executed very slowly. Even using the editor while trying to write some work arounds ran slowly
I set the pause to 45 seconds or so, so that as many files could be written as possible. I am using three Lists of a class I created called Dataholder. The master list and then a long and short list. The strategy reads the list, sorts on some criteria and then grabs the top/bottom n (in this case 10) with some very minor screening and then generates trades. Things slow down considerably as you can see below. Recall, after hours w/o SM running, this ran very fast. It doesn't look like WL multitasks well.
Done sleeping 5/11/2016 2:47:49 PM
Done getting the list 5/11/2016 2:47:49 PM # members = 102
Before sort 5/11/2016 2:47:49 PM Milliseconds 0057 # members = 102
After sort 5/11/2016 2:47:49 PM Milliseconds 0141 # members = 102
Done getting LONGS 5/11/2016 2:48:16 PM Milliseconds 0355 # members = 10 (top 10)
Done getting SHORTS 5/11/2016 2:48:30 PM Milliseconds 0556 # members = 10 (bottom 10)
It's getting closer but not quite there yet. I was going to try using arrays instead of lists but I don't think that is the bottleneck. As an experiment you might try with your code, try generating random numbers on your list of 100, output to the files. Next strategy then reads,sorts, and generating trades. See if you run into the same issues.
Thanks for all your help.
Size:
Color:
QUOTE:
I was going to try using arrays instead of lists but I don't think that is the bottleneck.
Definitely not - at least for only 102 items:
Performance of Arrays vs. Lists
Size:
Color:
Hello Cone
Hopefully you are still monitoring this topic. Might you have any other ideas as to how to make this work?
My thinking now is that I have to find a brokerage firm that has a true API for trading. WL is good for backtesting but it might not be best for realtime trading at the 1-minute intraday bar level due to synchronous calculations and lack of multithreading. I would prefer to stick with WL/Fidelity if possible.
Size:
Color:
Yours is a pretty special case, but sure, this isn't going to work for you if you keep trying to access dozens of external symbols synchronously in WealthScript - at least that's what I continue to believe to be the issue (but I can't really tell since I don't have your code).
So, assuming the problem is that you're still looping through a bunch of external Bars objects, use this approach.
Step 1. Update your daily data and run this script on your trading DataSet.
CODE:
Please log in to see this code.
Step 2. Modify your code to load and access the the secondary symbols from Global memory. Example:
CODE:
Please log in to see this code.
Size:
Color:
Hi Cone
Doesn't *seem* like it's that special a case, a rotational strategy just on intraday
Will give this a try on Monday (Need to pick up son at college ;->)
Sorry to reiterate but what I am trying to is not too much different than what you suggested before in #44.
The writing of the intraday files works (just doesn't complete due to some symbols not being updated)
Then because WL is still waiting for the updates, the execution part doesn't happen
QUOTE:
(but I can't really tell since I don't have your code).
isn't really an issue. You could assume that all I am doing is reading all the files and data into a list, assigning (for illustrative purposes) a random number to each one and buying the 3 with the highest value and selling the 3 with the lowest value. This doesn't happen quickly because WL is busy with task #1
Like I said, I will try your approach and hope it works better than the previous try.
Thanks again.
Steve
Here was my take on your code but obviously something wrong with the global since I never get to the tbars.count printdebug statement due to object ref not set
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
obviously something wrong with the global since I never get to the tbars.count printdebug statement due to object ref not set
Note that the two snippets go into different strategies. The first one is to be run in multi-symbol mode to collect the data for all symbols in a DataSet into global memory.
Whereas your attempt just sets one global item for the clicked symbol and then immediately tries to get some data for
all symbols in a DataSet with GetGlobal. Hence the exception.
Also, SetScaleDaily doesn't belong and have no effect where you insert it.
Size:
Color:
Which is task #1?
Size:
Color:
Task 1 was writing the files to disk as in your example and then task 2 was to generate trades
Ok so 1 strategy gets the globals that is the daily closes
Second strategy loops through all symbols getting 1minute bars
Ill try on Monday. This still has to set contexts but hopefully that loop wont take so long
Both strategies in the strategy monitor,
Size:
Color:
No Joy. I'm unable to have this run very quickly. I've included all code.
I appreciate any help you can provide to see a way to get this to execute quickly so that a rotation strategy that operates on 1-minute bars can succeed.
Part 1
CODE:
Please log in to see this code.
Part 2 - Get the 1 minute bars and generate signals. I commented the section about finding the right hour and minute and just tried to run.
Rather than disclose the real signal for ranking, I used a random number generator to generate "criteria" to sort on
CODE:
Please log in to see this code.
Size:
Color:
Steve,
1. So I ran your code #1 on a Nasdaq 100 DataSet once (EOD Yahoo! data)
2. Then I added code #2 to run in single symbol mode of the same 5-minute DataSet (Google data, 500 bars of AAL)
3. Code #2 executed in 22 seconds (1st run), 11 seconds (2nd run).
What am I doing wrong?
Size:
Color:
Not sure. Did you get the orders generated?
I'll see if I can run it on a faster machine but it's hard for me to see why I'm not getting your result.
Were you were logged in and getting streaming quotes with the option set to update/
Is there a way to dump all my settings and let you view them to check for differences?
Size:
Color:
QUOTE:
Did you get the orders generated?
I just made sure that both times the Alerts view was filled up with 20 alerts:
05/16/2016 xx:55:05: Execute: AAL Test2
05/16/2016 xx:55:22: Build Results: AAL Alerts: 20
...
05/16/2016 xx:55:22: Replace Alerts: AAL Alerts: 39
05/16/2016 xx:00:05: Execute: AAL Test2
05/16/2016 xx:00:16: Build Results: AAL Alerts: 20
...
QUOTE:
Were you were logged in and getting streaming quotes with the option set to update/
As I do not have access to WLP, I wasn't logged in and streaming wasn't taking place.
Can you give Google data a try?
Size:
Color:
Sure, I've never used this provider. Will research and try
Same result w/ Fidelitydata on my somewhat faster laptop with the same result I had before.
Seems to run faster with Google data. 25 seconds or so.
1. Is it truly realtime?
2. Is Fidelity's feed just a lot slower?
Start Time 5/16/2016 3:58:30 PM
Done getting the dictionary 5/16/2016 3:58:30 PM 15 58
Done getting the list 5/16/2016 3:58:54 PM
Long and short Count = 10 10
Done generating trades 5/16/2016 3:58:54 PM
3. If this works, Is there any way to tell the strategy monitor to run a strategy at a specific time e.g. say 9:35 so that I won't need the code to check if the time is correct?
4. The Google data has a 9:30 bar and a 4:00 bar while Fidelity's bars start at 9:31. Can you comment if you know the differences
Size:
Color:
1 - It's
believed to be real-time for NYSE and NASDAQ symbols as per
disclaimer. Your mileage may vary. Make comparisons on your own.
3 - Strategy Scheduling is applicable to EOD strategies only.
Size:
Color:
Any thoughts on why Google is so fast and Fidelity so slow?
Size:
Color:
Maybe due to the data extent. Working with 55 MB files takes a little time.
Does your machine have an SSD?
Size:
Color:
Hello Cone
Yes, Brand new Samsung 1TB installed last week. I guess Google data loads much faster. Can't see how to get Fidelity to wok well.
My code below works in stand alone mode with Google 1 minute data on the Nasdaq 100 (I am logged in to Fidelity and I select a time in the strategy parameters about a minute ahead and run it when we get to the right minute) but it seems not to run in the Strategy Monitor for some reason [cannot figure out. It executes, takes about a second to run and then exits. It fails to generate the trades. If I can get this to work and the Google data is good enough, I'm done.
CODE:
Please log in to see this code.
Size:
Color:
To make this work you absolutely have to avoid the SetContext
with the symbol string overload. That one creates an on-demand (slow) request for data.
Luckily 6.9.15 came with a SetContext(Bars bars) overload to support synthetic options - but we can take advantage of that for stocks too. So here's the plan.
Run the "SetGlobal" strategy on the
1-min DataSet in the
Strategy Monitor to put the 1-minute
Bars object in global memory so that we can quickly grab it later.
CODE:
Please log in to see this code.
Next, here's the code you just posted with modifications and optimizations. Run this one in a
Streaming Window (mainly to monitor debug messaging). It will generate the orders as fast as the data has been retrieved.... in my test, typically within 13 seconds for 50 symbols.
CODE:
Please log in to see this code.
Size:
Color: