I have written a strategy and tested it by simulation. I could also activate it to let it generate trading alerts on Monday next week. However, I do not think that it will be executed in a way I intend.
I repeatedly buy or sell a certain number of shares when the last price reaches a predetermined price. For this purpose, I am testing whether Low[bar] <= target_price <= High[bar] for the latest Bar, and if this condition is satisfied a BuyAtLimit(bar, target_price) or SellAtLimit(bar, target_price) request is issued.
In real time, Low[bar] and High[bar] are not known until the current bar is completed.
In order to know if my trading method can be implemented as a strategy or not, I want to know which parts of the strategy code are executed for actual trading and when they are executed.
My strategy can be easily implemented if Execute(double last_price) is activated, say, every 10 seconds.
Size:
Color:
Size:
Color:
I found the following description in the Wiki page:
QUOTE:
1. A complete bar updates (can be 1-minute, 1-day, etc.)
2. 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).
Does this mean that the whole body of Execute() is executed repeatedly over the complete series of Bars each time the latest Bar is added and that the trade requests on Bars[bar + 1] are converted to actual orders?
1. When does the first bar in Bars start?
2. Should we maintain the data shared by repeated executions of Execute() in instance variables of the class for my strategy?
3. When we consider slippage, could the data maintained internally by my strategy deviate from what actually happens?
4. Have you you considered to use a event-driven callback that responds to a change of the last price or that is executed periodically, say, at every 5 seconds? This approach is much simpler and flexible.
Size:
Color:
QUOTE:
Does this mean that the whole body of Execute() is executed repeatedly over the complete series of Bars each time the latest Bar is added and that the trade requests on Bars[bar + 1] are converted to actual orders?
Right.
1. Depending on specified data loading range.
2. It's up to you, if that's required by design of your strategy.
3. Slippage applies. Strategy executions are theoretical and get out of sync with your live Fidelity account.
Size:
Color:
3. It's possible to get out of synch in 2 ways:
i) For any Strategy: Previous theoretical trade prior to the next Alert doesn't match your account Position. This scenario is dependent on the amount of data loaded. If, for example, your Strategy buys on the first trading day of the month and sells on the last, imagine what would happen if you were loading only 2 weeks of data. At the end of the month, you couldn't sell the Position because the Strategy doesn't "know" that one exists.
ii) Limit Order Strategies. See User Guide: Orders > Portfolio Synch > Theoretical vs. Actual
4. We're not the Wealth-Lab architect(s), but what needs to respond to the change in last price every 5 seconds if the Strategy is running on 1-minute bars (or higher)?
Size:
Color:
QUOTE:
We're not the Wealth-Lab architect(s), but what needs to respond to the change in last price every 5 seconds if the Strategy is running on 1-minute bars (or higher)?
1) Did people at Fidelity decide the architecture?
2) I found on the Web an automated trading program that uses event-driven strategies. However, its uses FIX 4.2 protocol. I noticed that Active Trader Pro and Wealth-Lab Pro both use https. Active Trader Pro allows streaming data to arrive every one second. Does the program issue a GET https request every second?
3)If we wait for 1-minute, a limit buy or sell request may miss an opportunity. Isn't this a problem?
4) Are there people who are using Wealth-Lab Pro in actual automated trading? Is it predictably reliable?
4) Technical support at Fidelity cannot answer some of my questions on Active Trader Pro. Whom can I ask those questions?
Size:
Color:
1) Fidelity owns and develops Wealth-Lab.
2) I've never seen Fidelity streaming code, but it must be an http socket; for sure ATP and WLP do not poll for streaming data.
3) Why is that a problem? Either you enter a Market order to execute on the open of the next bar, bar + 1, or, you enter a Stop or Limit order, which is "worked" throughout the following bar (i.e., bar + 1).
4) Sure. In 5.6 there are two intermittent problems causing frustration.
a. One is that Auto-Stage/Place is failing for some reason for some customers. While Fidelity can't duplicate the problem, the only viable explanation we've come up with is that it has something to do with Portfolio Synch logic, which you will be able to disable in the next release.
b. The other is that Streaming may stop for one or more charts suddenly and you have to logout/login to reset it. We think that problem is resolved for the next release.
5) No idea, we don't deal with ATPro.
Size:
Color: