Hi,
I would like to have my scanning function called when a new bar comes out, particularly during intraday. E.g. in a 5-min interval scenario, when a new bar shows every 5 minutes, I intend to have my function being called, so that a scanning of a set of symbols can happen. I think the same is possible for daily chart too (at market close, do a scan, and send me an email).
I searched in the forum but I didn't find an answer. Please help if anyone knows the solution.
Thank you.
Size:
Color:
Size:
Color:
Hi Eugene,
I didn't find related answer to my question from the FAQ. I believe my question is a common one though.
Basically, I created a strategy to determine market condition at any given bar. I want to run my strategy about 30 mins before market closes on a daily chart, on a list of symbols, one by one. My strategy prints info to the log. Then I will use the info printed in the log to determine which one to trade.
Today when I tried this, I found that before the market closes, the price of the last bar on a daily chart was yesterday's price, even when I logged in to stream the data as current. So this is issue #1.
Secondly, I wanted to try this on 5-min intraday chart, so it means I want to run my strategy every 5 minutes when a new bar comes out, but I don't know how to do this.
Thank you for the help.
Wei
Size:
Color:
Hi Wei,
Now that's a
completely different question of its own. Either you simply run the strategy every 5 minutes or anything else. And that "anything else" could be, for example, covered by workaround in post #4 in this thread:
Eliminate overnight tradesNamely, the WealthScript Programming Guide > Programming Trading Strategies > Alerts >
How to: Alert for AtClose Signals.
QUOTE:
Today when I tried this, I found that before the market closes, the price of the last bar on a daily chart was yesterday's price, even when I logged in to stream the data as current. So this is issue #1.
Which is by design. For instance,
Intraday / Multi-Time Frame | Compressed price series alignment.
QUOTE:
Secondly, I wanted to try this on 5-min intraday chart, so it means I want to run my strategy every 5 minutes when a new bar comes out,
Run your strategy on 5-minute data. Again, please refer to the same Wiki FAQ for the mechanics.
Size:
Color:
QUOTE:
So this is issue #1.
The ability to update a daily bar during the market session depends on the Data Provider. You can create daily bars by compressing intraday data as Eugene suggested, or, find a EOD provider that will update your symbols in real time during the data. You can configure the Yahoo! provider to do that, for example, but data are subject to delay. Depending on the market you're covering, I'd recommend IQFeed.
QUOTE:
I want to run my strategy every 5 minutes when a new bar comes out
Simple. Use either the Strategy Monitor (for many symbols) or Streaming charts (up to a dozen symbols or more).
Size:
Color:
Thank you Eugene and Cone. I will try this tomorrow.
Size:
Color:
Hi Eugene and Cone, I tried using your compress price from a lower scale approach, but I did not get the expected result. My most simple objective is to just view the daily chart, while displaying the current day's price change in percentage on the label, during the market open time, but no current day's latest price is available from the latest daily bar.
I was trying to think alternatives. For example, if I can dynamically change the scale to 15 mins, and then save the latest price to a file, and then change the scale back to daily, that should solve the problem. But I didn't find a way to set the scale from daily to 15 mins dynamically in the code.
I feel I need additional help on this issue. Thank you.
Size:
Color:
Size:
Color:
Hi Eugene,
The external symbol approach worked! I will test it using live market data on Monday. Thanks very much for your advice.
Wei
Size:
Color:
Hi Eugene,
During the test today, I found that the intraday bars retrieved in this method is somewhat cached. It means it always gets the same number of intraday bars as the first time it was called, even if additional bars should have been generated.
CODE:
Please log in to see this code.
I tried to update the DataSet using Data Manager, but it is still the same.
I tried restart WealthLab, and tried re-create the intraday data set, and both worked, new prices are shown.
Therefore, I wonder if there is a way to auto-refresh the data set, or clear the cached values.
Thanks,
Wei
Size:
Color:
Hi Wei,
Like Cone said in a thread I referred to above, "Usually what you get from a secondary symbol in a streaming window is one bar old since the request is static." Please see if some of the workarounds in the forum topics/Wiki apply to your case.
Size:
Color: