Hello,
Just want to make sure I understand where stop/limit orders are actually held. From what I understand, in WLP the orders are held with the Fidelity back end, and with live trading the stop/limit order signal (C# method) must be called at each bar (and can be adjusted so it is replaced on the back end) or else the order is cancelled on the subsequent bar.
For example I want to execute a strategy with a basic entry/exit logic, but also have a trailing stop as protection sitting on the Fidelity back end. That way if I'm using 10,15 or 30 min bars, a sharp move against my position during the time between bar processing by WLP would be stopped out by the Fidelity back end. Also if for some reason WLP crashed there would still be at least some active downside protection by the stop on the Fidelity back end. (assume a trailing stop would just become a regular stop at this point).
Would the code below do this? The rules would be:
-Enter long after a condition is met but not before 10:30 AM
-Exit after a condition is met, or down move hitting training stop real time, also exit near end of trading day (15:45).
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
WLP the orders are held with the Fidelity back end,
If WLP Placed the order and its status returns as 'Active, then the Fidelity back end is working the order.
QUOTE:
...and with live trading the stop/limit order signal (C# method) must be called at each bar (and can be adjusted so it is replaced on the back end) or else the order is cancelled on the subsequent bar
Right on.
QUOTE:
Also if for some reason WLP crashed there would still be at least some active downside protection by the stop on the Fidelity back end.
Right. The order will remain active for its time-in-force, which is "Day" for all Daily and Minute scale orders. TIF is GTC for Weekly and Monthly scales.
Yes, the code is correct except possibly for the use of MFEAsOfBar()*. Generally speaking, if you use bar + 1 in the trading signals and the trades are correct in the backtest, you can be sure that it will work live.
* The use of MFEAsOfBar() in a script will do what you expect only in Raw Profit mode. Consider using MFEPctAsOfBar() instead. Or, if you're just trying to get the highest traded price since the entry bar....
CODE:
Please log in to see this code.
Size:
Color:
Ok thanks. So the order on the back end is a stop order, and adjusted with each new bar, or is it actually a trailing stop order that Fidelity adjust real time between bars?
Size:
Color:
It's a plain vanilla stop order. With Auto-Trading, WLP needs to adjust the stop level (if required) at the end of each bar interval. If you don't have an Auto-Trade entitlement, then you need to manually click to place an Auto-Staged order.
Size:
Color: