SellAtMarket not appearing in Orders window (Paper Trading)
Author: lepete
Creation Date: 4/6/2018 4:32 PM
profile picture

lepete

#1
Everything looks fine for 1 min bars of a single equity:

-streaming is on (check)
-strategy is activated (check)
-auto-place is on (check)
-called fidelity and auto-trading is turned on (paper trading)

However, only the BuyAtMarket was filled at fidelity (blue up-arrow). While the SellAtMarket's do show a red down arrow on the OHLC bars, the sell orders are not appearing on the Orders window, and therefore aren't being routed. There are sufficient funds, and this is why the BuyAtMarket was fired.

Why would sells appear on the OHLC bar in the price chart for the strategy, but not get sent to Fidelity?


profile picture

Eugene

#2
There's not enough information to tell for sure but with high probability I'd say that the problem may be listed here:

FAQ | Strategies and WealthScript > Alerts are not triggered.

Your Strategy code and data loading settings could help clear the issue.
profile picture

lepete

#3
There has to be a way to "brute force" a market sell from the code to be routed to an alert, which get's routed to Fidelity. Unless the WL code does not allow an alert to be sent when selling at the market on the same bar(?) Actually, truly waiting for any bar to end when a sell signal triggers and routing the order on the next bar would be deadly in terms of profit.

Since the SellAtMarket ( i , ...) only produces a chart symbol (and a sell during backtesting and optimization) but not an alert which is routed to Fidelity, is there an alert that can programatically be sent from the code to trigger the sell order for routing?

Whats needed is a same-bar Sell function which produces a chart symbol *and* an alert that gets routed to Fidelity simultaneously.

Here's the main loop with signals. FYI using SellAtMarket with i+1 won't even optimize for a profit, so i needs to be used.

CODE:
Please log in to see this code.
profile picture

Eugene

#4
QUOTE:
Here's the main loop with signals. FYI using SellAtMarket with i+1 won't even optimize for a profit, so i needs to be used.


Your case is right on top of the "Alerts are not triggered" list:

Is the buy/sell signal happening on bar? Alerts only work for bar+1.

So change all your SellAtMarket calls to use i+1 and you'll get Alerts.

As an added bonus, your system will stop peeking into the future and producing signals that will not be duplicated in real trading! :)
profile picture

lepete

#5
Ok, thanks. "Back to the drawing board"
profile picture

deckerland

#6
i+1 still does not create alert
profile picture

Eugene

#7
Very informative. :)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).