Edit: The title should be "SellAtStop Orders Are Not Executing"
I'm testing a strategy that uses bracket orders, and I am adjusting the Stop higher throughout the day (on an intra-day chart). This works perfectly when testing the strategy, but when I'm running it live against a PaperTrading account, none of the SellAtStop orders are processing.
Any ideas why these SellAtStop orders are not actually selling the position when the price goes below the stop price?
Here's part of my code:
CODE:
Please log in to see this code.
I am calling PlotStops() to graph the stops on the chart, and logging them Debug Log. Everything looks correct. The orders are getting placed into the Orders window, but the order does not execute and gets canceled.
Is this the correct way to code a bracket order?
Should I be using SellAtTrailingStop if the stop price changes over time?
Is this an issue only with PaperTrading?
Any thoughts would be appreciated.
Thanks.
Size:
Color:
Please post the entire code, preserving the structure of the trading loop. You may skip the definitions of stopLoss/profitTarget as well as any variables that lead to entry (but don't omit the entry itself). Need to check the code for potential peeking into the future and other errors.
Size:
Color:
QUOTE:
Is this the correct way to code a bracket order?
yes, as long as you've previous calculated values for the stopLoss and profitTarget variables.
QUOTE:
Should I be using SellAtTrailingStop if the stop price changes over time?
A trailing stop only allows the stop price to change to a higher price (long position). If the value doesn't change or if you want the freedom to change the trigger price to any value, then just use SellAtStop.
QUOTE:
Is this an issue only with PaperTrading?
Could be. Read the User Guide > Orders > Paper Trading for info about limitations of this feature.
Size:
Color:
Cone, you may be on to something. The User Guide specifically states "Bracket OCO Exit Order functionality" is not supported for paper trading.
I'll try again with just a stop loss order and see if the sell orders execute.
Size:
Color:
I was referring more about how the paper trader polls for quotes every 30 seconds, which is not the way a broker triggers orders. See "How Orders Are Filled"
For example, imagine your stop is at $10.00 and the market is trading $10.05. The market can dip to $10.00 or below, but then rise above it again before the paper trader polls for a quote. (A live order would trigger and sell at the market with the first tick at (or below) the $10.00 stop level.) If the Paper Trader misses this fill, it's a problem for the strategy, because the strategy will hypothetically fill the order since the price actually cross the stop trigger and then will strategy triggering the entry logic again. The result is that the strategy becomes out-of-sync with the Paper account. It's a pretty big deficiency in the Paper trader, but there hasn't been any will to change it.
Keep reading that Orders chapter. This out-of-sync condition can happen with a live account too, but probably only occasionally with limit orders - when the limit is "touched" but not all orders on the book at the price are filled. The salient point here is that Auto-Trading in Wealth-Lab shouldn't be thought of as "turn on and forget". Instead, it's to help traders manage their workload, but they need to be ready to intervene when required.
Size:
Color: