Why sell Limit orders aren't always generated in live trading?
Author: digitalsculpture
Creation Date: 8/5/2020 2:10 PM
profile picture

digitalsculpture

#1
Hello,

My current strategy involves buying with a limit order on a low channel breakout, and selling with a limit order on a high channel breakout. In live trading this week I've noticed that sell limit orders aren't always generated for positions. So I have two questions:

1) What might cause WLD to not generate a sell limit order for a position, and how can I resolve the issue?

2) In situations where I need to manually sell a position, is there a way to do so through WLD?

For context on question 2, I should mention that this week, in order to manually sell positions, I have closed WLD, opened my Interactive Brokers account, and closed the positions. As you can imagine, this is time consuming and I would much prefer to sell directly in WLD if there's a way to do so.

Thanks
profile picture

Eugene

#2
Hi,

1 - It's hard to tell without having seen your script and knowing the context (symbols, bar scale, time and your Preferences > Backtest Settings). Could be a peeking into the future error in the code, an out of sync condition etc.

2 - Let's get to the bottom of #1. It shouldn't be required but you can exit manually using the Manual Trade Ticket tool (Ctrl-T).
profile picture

digitalsculpture

#3
1) Actually, today WLD has generated limit orders consistently without any problems. If I run into the issue again I will send the info you requested and we can look into it further.

2) Thanks so much for the keyboard shortcut for the manual trade ticket!! I had seen this in WLP but couldn't find it anywhere in WLD menus.
profile picture

Eugene

#4
2) It was nothing. And you can find more shortcuts in the WL User Guide > Reference > Keyboard > Shortcuts by Category.
profile picture

digitalsculpture

#5
I'm still having some trouble with the limit orders. I'm currently running two strategies. Each strategy is trading a dataset with 9 symbols in it. I would expect each strategy to issue a limit order alert for all 9 symbols during each execution. However, there are currently only a total of five buy limit orders shown in the orders panel-- and I expect there to be 18.

Am I, perhaps, misunderstanding the way that channel breakout buy limit orders are generated? Should they be generated for all symbols at each execution of the strategy, or are they generated only when a stock is close to buy or sell point?
profile picture

Eugene

#6
It's hard to tell without having seen your script and knowing the context (symbols, bar scale, time and your Preferences > Backtest Settings). Could be a peeking into the future error in the code, an out of sync condition etc.
profile picture

digitalsculpture

#7
To make troubleshooting easier, I'll risk oversharing and give a very thorough description of what I'm doing...

I'm using a rules based strategy: Buy at limit channel low, with a channel period of 18. Sell at channel high, with a channel period of 18. Sell at stop loss of 25%.


I'm currently running two strategies. The strategy settings are identical-- they're as describe above. Each strategy is trading a dataset with 9 symbols in it. I decided to use two strategies just to give a little more control over entering and exiting the market more gradually when necessary.

Strategy settings: data range is 2 days; position size is $1,000 (RP), scale is 5 minutes, and the "automatically stage orders from strategy alerts" box is checked. I'm using IQ Feed as the data provider for my data sets. Both strategies are activated and set to auto-place.

Orders panel: auto trading is set to "live accounts".

Account balances and positions: streaming updates are turned on.

Preferences > Backtest settings: I haven't changed anything from the default settings. All boxes are unchecked.

Preferences > slippage: The "slippage for limit orders" box is checked, and it's set to .10

Preferences > trading: The "exit orders should always exit the full position..." box is checked --- the "enable cash threshold" box is checked, and is set to 20500.

Preferences > advanced: pricing decimal places is set to 2.

Account is with Interactive Brokers. Accessing account via IB Provider link.

---

A few additional thoughts-

I was initially using a 30 minute scale, with a channel period of 3. Because I was running into this problem of limit orders not being submitted I switched to the five minute scale, and channel period of 18, thinking it would provide more opportunities for WLD to initiate orders. This switch hasn't seemed to improve things, though.

Again, in a perfect world, while running this strategy I would like WLD to submit a buy limit order (with an 18 period lookback) at the start of each period for all symbols I don't currently hold... and submit/update sell limit orders (with an 18 period lookback) for all symbols I do currently hold. This strategy works well in backtests, but implementation has been tough. But then, I am just a beginner so I imagine I'm probably overlooking some important basics of getting this set up correctly.





profile picture

Eugene

#8
QUOTE:
Preferences > slippage: The "slippage for limit orders" box is checked, and it's set to .10

As the warning says in the User Guide,
Warning! Disable limit-order slippage for Live trading of strategies that use limit orders to enter positions.

Enabling it puts your system at risk of not executing an AtLimit order if the slippage-adjusted price is not reached in live trading.
profile picture

digitalsculpture

#9
Understood, thanks very much, I just turned slippage off. I'll keep you posted about how things go today.
profile picture

digitalsculpture

#10
Now that I've turned slippage off the system is working much better. Sell limit orders are being generated and updated for current positions consistently.

However, the system's submission of buy limit orders has been inconsistent.

I'm trading the following symbols:
AMRH GNCA IO NURO OCX SEEL SHLO SNES XTNT AEMD AGE CLRB DPW NTN TXMD UAVS VISL XSPA

Now that my cash balance is above the threshold, the system has generated buy limit orders for: AMRH GNCA NURO TXMD XSPA

Why do you think it has generated buy limit orders only for these symbols, and not the others?
profile picture

Eugene

#11
Glad to have helped. As the new issue doesn't deal with sell AtLimit orders, I think it's appropriate to either reuse Trading Thresholds exceeded (if it's a repercussion) or start a new topic.
profile picture

digitalsculpture

#12
I'm having some more issues with sell limit orders this morning. Sell limit orders aren't being generated consistently for current positions. The specific symbol that's giving me trouble right now is NBEV.

In our earlier discussion you mentioned that some of the symbols I'm trading have liquidity problems. If I understand the liquidity issue correctly, it seems like switching the scale to a longer time frame would give more time for new data to come in and cause the limit orders to be generated more consistently.

Would WLD generate limit sell orders more consistently if I were to switch from a 5 minute to a 15 minute chart?
profile picture

Eugene

#13
QUOTE:
Would WLD generate limit sell orders more consistently if I were to switch from a 5 minute to a 15 minute chart?

At least it's unlikely to have a skipped 15-min bar there. So my answer would rather be yes.

Note that on a recent 15-min bar during the midday doldrums NBEV had liquidity as low as 3K+ shares traded (that's just a $7K turnover).
profile picture

digitalsculpture

#14
Okay, thanks. I'll switch to 15 minute scale then.
profile picture

digitalsculpture

#15
By the way, is there a particular average volume threshold that you'd recommend for this kind of trading? Of the 6,000 stocks on the US market, I'm working with the 2,000 that have the highest volume. Maybe I need to be pickier, though, for this trading strategy to work in practice?
profile picture

digitalsculpture

#16
...and I could switch to a 30 minute scale if you think that would further improve the consistency of the limit sell orders being generated. Do you think that would be a good idea?
profile picture

Eugene

#17
Whatever works for you is fine with me. :)
profile picture

Cone

#18
I'm just reading the last few entries here, but imho 2000 stocks are a lot to keep track of, especially at first. I'd recommend that you start small with maybe the S&P100 or Nasdaq 100 and use a build-up approach. Makes sure everything's working the way you expect. If you're not getting enough opportunities with either of those, combine them, then S&P 500 next, and so on.
profile picture

digitalsculpture

#19
Thanks, Cone. Reading your message, though, I realize that I was unclear in my previous message. When I wrote that I am "working with the 2,000 stocks that have the highest volume", I meant that I have screened those 2,000 to find the 25 that work best with my trading strategy. So I'm actually only trading with a small number of symbols.

By the way, this morning I made a couple more adjustments to my strategy. Hearing from you, Cone, and Eugene, that a lack of liquidity can cause problems with the data not being updated (which could cause limit orders to not be generated), I did a screen to find the ~300 stocks that have the most volume. Then I selected a subset of 25 symbols in that group that backtested well with my trading strategy. Today I've been trading those symbols on a 15 minute scale.

This morning when the market was opening I saw that the strategy monitor was consistently generating buy and sell limit orders. However, as the day went on there have been a few instances where it's failed to generate a sell limit order for a current position. Most recently this happened with CLNY. Again, CLNY is only of my current positions, so I would expect the strategy to generate a *sell* limit order for it... but the strategy instead generated a *buy* limit order.

I have simplified the rules in my strategy so that I only have channel breakout rules to "buy channel low", "sell channel high, and it has a stop loss of 25%. I have turned off the cash threshold for fear that it might interfere with the creation of/updates to limit orders.

Is there anything else I might change about my approach to try to get the strategy to more consistently generate sell limit orders for current positions?


The same thing just happened with UAVS. The strategy purchased the symbol with a limit order about 10 minutes ago, so I now have a position in UAVS. Then, when the strategy ran at 2:30 it generated a *buy* limit order for UAVS instead of a *sell* limit order.

These glitches are, unfortunately, really holding back the performance of the strategy.


Would it help if I were to turn on "allow same bar exits for auto-trading" in the preference settings?
profile picture

Eugene

#20
QUOTE:
Most recently this happened with CLNY. Again, CLNY is only of my current positions, so I would expect the strategy to generate a *sell* limit order for it... but the strategy instead generated a *buy* limit order.

Clearly there's some disconnect but it's hard to troubleshoot a system with unknown rules (different from post #7), symbols, data loading settings, St.Mon. item log etc.

QUOTE:
Would it help if I were to turn on "allow same bar exits for auto-trading" in the preference settings?

With system rules as on screenshot in post #7, the Rule Wizard won't create a same-bar system. (It's possible to do in WealthScript code but it won't be realistic due to use of same-bar Stop/Limit orders).
profile picture

digitalsculpture

#21
Hi Eugene,

Here are the rules I'm using today, symbols, etc:

Rules:
buy at limit channel low with a channel period of 20
sell at limit channel high with a channel period of 2
sell at stop loss of 25%

Scale: 15 minute

Cash threshold is turned off

slippage is turned off

Exit orders should always exit the full position is turned on

Symbols trading today: DARE, DPW, MGEN, NERV, PHUN, POAI, SEEL

Data range: 1 week

Position size: $1000 RP

Automatically stage orders from strategy alerts is on

The strategy has been running all day. It has generated limit sell orders for current positions only intermittently. Sometimes it will generate a limit sell order for a position for a period of time and then switch over to making limit buy orders, even though the position in the symbol hasn't been sold.

I'm currently holding: DARE, MGEN, PHUN, and POAI, but the strategy only has a limit sell order active for DARE.

I forgot to enable logging for the strategy this morning. I just turned it on a few minutes ago and I'll post that here too at the end of the day.

Thanks in advance for any insight you might be able to offer on what's going wrong
profile picture

digitalsculpture

#22
If I understand WLD correctly, the system will only generate a limit sell order when it *thinks* it has a position in the symbol...

Is there a way to force the system to generate limit sell orders for ALL symbols in the dataset at each run of the strategy?

And if it were to do so, would it then transfer the limit order sell alert to the order panel if there were a position currently held in the symbol?
profile picture

digitalsculpture

#23
I doubt that the log will be useful since I only enabled logging about twenty minutes ago, but just in case, here it is:

8/12/2020 3:30:00 PM: Launch Update(I)
8/12/2020 3:30:00 PM: Entering Intraday Thread
8/12/2020 3:30:05 PM: Earliest End Date is 8/12/2020 2:45:00 PM
8/12/2020 3:30:05 PM: Requesting Updates for DARE,DPW,MGEN,NERV,PHUN,POAI,SEEL,
8/12/2020 3:30:05 PM: Update Completed: DARE, LastDate=8/12/2020 3:30:00 PM, O=1.15 H=1.155 L=1.14 C=1.15 V=22800 Count=30
8/12/2020 3:30:05 PM: Applying Update
8/12/2020 3:30:05 PM: Append: DARE
8/12/2020 3:30:05 PM: Clear Indicators
8/12/2020 3:30:05 PM: Creating Executor
8/12/2020 3:30:05 PM: Execute: DARE 8 12 TOP7
8/12/2020 3:30:05 PM: Build Results: DARE Alerts: 2
8/12/2020 3:30:05 PM: Sell 877 DARE Stop 0.85
8/12/2020 3:30:05 PM: Sell 877 DARE Limit 1.16
8/12/2020 3:30:05 PM: Adding 2 Alerts: DARE, DARE,
8/12/2020 3:30:05 PM: Replace Alerts: DARE Alerts: 8
8/12/2020 3:30:05 PM: Update Completed(2): DARE (6 symbols left)
8/12/2020 3:30:05 PM: Leaving Update Completed
8/12/2020 3:30:05 PM: Update Completed: DPW, LastDate=8/12/2020 3:30:00 PM, O=2.225 H=2.225 L=2.22 C=2.225 V=7637 Count=34
8/12/2020 3:30:05 PM: Applying Update
8/12/2020 3:30:05 PM: Append: DPW
8/12/2020 3:30:05 PM: Clear Indicators
8/12/2020 3:30:05 PM: Creating Executor
8/12/2020 3:30:05 PM: Execute: DPW 8 12 TOP7
8/12/2020 3:30:05 PM: Build Results: DPW Alerts: 1
8/12/2020 3:30:05 PM: Buy 460 DPW Limit 2.17
8/12/2020 3:30:05 PM: Adding 1 Alerts: DPW,
8/12/2020 3:30:05 PM: Replace Alerts: DPW Alerts: 8
8/12/2020 3:30:05 PM: Update Completed(2): DPW (5 symbols left)
8/12/2020 3:30:05 PM: Leaving Update Completed
8/12/2020 3:30:06 PM: Update Completed: MGEN, LastDate=8/12/2020 3:30:00 PM, O=1.105 H=1.11 L=1.1 C=1.105 V=13512 Count=28
8/12/2020 3:30:06 PM: Applying Update
8/12/2020 3:30:06 PM: Append: MGEN
8/12/2020 3:30:06 PM: Clear Indicators
8/12/2020 3:30:06 PM: Creating Executor
8/12/2020 3:30:06 PM: Execute: MGEN 8 12 TOP7
8/12/2020 3:30:06 PM: Build Results: MGEN Alerts: 1
8/12/2020 3:30:06 PM: Buy 917 MGEN Limit 1.09
8/12/2020 3:30:06 PM: Adding 1 Alerts: MGEN,
8/12/2020 3:30:06 PM: Replace Alerts: MGEN Alerts: 8
8/12/2020 3:30:06 PM: Update Completed(2): MGEN (4 symbols left)
8/12/2020 3:30:06 PM: Leaving Update Completed
8/12/2020 3:30:06 PM: Update Completed: NERV, LastDate=8/12/2020 3:30:00 PM, O=3.425 H=3.44 L=3.42 C=3.44 V=16273 Count=26
8/12/2020 3:30:06 PM: Applying Update
8/12/2020 3:30:06 PM: Append: NERV
8/12/2020 3:30:06 PM: Clear Indicators
8/12/2020 3:30:06 PM: Creating Executor
8/12/2020 3:30:06 PM: Execute: NERV 8 12 TOP7
8/12/2020 3:30:06 PM: Build Results: NERV Alerts: 1
8/12/2020 3:30:06 PM: Buy 294 NERV Limit 3.40
8/12/2020 3:30:06 PM: Adding 1 Alerts: NERV,
8/12/2020 3:30:06 PM: Replace Alerts: NERV Alerts: 8
8/12/2020 3:30:06 PM: Update Completed(2): NERV (3 symbols left)
8/12/2020 3:30:06 PM: Leaving Update Completed
8/12/2020 3:30:06 PM: Update Completed: PHUN, LastDate=8/12/2020 3:30:00 PM, O=1.505 H=1.51 L=1.5 C=1.5 V=29032 Count=40
8/12/2020 3:30:06 PM: Applying Update
8/12/2020 3:30:06 PM: Append: PHUN
8/12/2020 3:30:06 PM: Clear Indicators
8/12/2020 3:30:06 PM: Creating Executor
8/12/2020 3:30:06 PM: Execute: PHUN 8 12 TOP7
8/12/2020 3:30:07 PM: Build Results: PHUN Alerts: 1
8/12/2020 3:30:07 PM: Buy 689 PHUN Limit 1.45
8/12/2020 3:30:07 PM: Adding 1 Alerts: PHUN,
8/12/2020 3:30:07 PM: Replace Alerts: PHUN Alerts: 8
8/12/2020 3:30:07 PM: Update Completed(2): PHUN (2 symbols left)
8/12/2020 3:30:07 PM: Leaving Update Completed
8/12/2020 3:30:07 PM: Update Completed: POAI, LastDate=8/12/2020 3:30:00 PM, O=1.5 H=1.5 L=1.5 C=1.5 V=900 Count=31
8/12/2020 3:30:07 PM: Applying Update
8/12/2020 3:30:07 PM: Append: POAI
8/12/2020 3:30:07 PM: Clear Indicators
8/12/2020 3:30:07 PM: Creating Executor
8/12/2020 3:30:07 PM: Execute: POAI 8 12 TOP7
8/12/2020 3:30:07 PM: Build Results: POAI Alerts: 1
8/12/2020 3:30:07 PM: Buy 684 POAI Limit 1.46
8/12/2020 3:30:07 PM: Adding 1 Alerts: POAI,
8/12/2020 3:30:07 PM: Replace Alerts: POAI Alerts: 8
8/12/2020 3:30:07 PM: Update Completed(2): POAI (1 symbols left)
8/12/2020 3:30:07 PM: Leaving Update Completed
8/12/2020 3:30:07 PM: Update Completed: SEEL, LastDate=8/12/2020 3:30:00 PM, O=1.06 H=1.06 L=1.06 C=1.06 V=3887 Count=28
8/12/2020 3:30:07 PM: Applying Update
8/12/2020 3:30:07 PM: Append: SEEL
8/12/2020 3:30:07 PM: Clear Indicators
8/12/2020 3:30:07 PM: Creating Executor
8/12/2020 3:30:07 PM: Execute: SEEL 8 12 TOP7
8/12/2020 3:30:07 PM: Build Results: SEEL Alerts: 1
8/12/2020 3:30:07 PM: Buy 961 SEEL Limit 1.04
8/12/2020 3:30:07 PM: Adding 1 Alerts: SEEL,
8/12/2020 3:30:07 PM: Replace Alerts: SEEL Alerts: 8
8/12/2020 3:30:07 PM: Update Completed(2): SEEL (0 symbols left)
8/12/2020 3:30:07 PM: Leaving Update Completed
8/12/2020 3:30:07 PM: Processing Completed
8/12/2020 3:30:07 PM: All Updates Returned
8/12/2020 3:30:07 PM: Item Processing Completed
8/12/2020 3:30:07 PM: Calculating NextRun...
8/12/2020 3:30:07 PM: NextRun set to 8/12/2020 3:45:00 PM
8/12/2020 3:30:07 PM: Refreshing Item in GUI
8/12/2020 3:30:07 PM: Leaving Intraday Thread
8/12/2020 3:45:00 PM: Launch Update(I)
8/12/2020 3:45:00 PM: Entering Intraday Thread
8/12/2020 3:45:05 PM: Earliest End Date is 8/12/2020 3:00:00 PM
8/12/2020 3:45:05 PM: Requesting Updates for DARE,DPW,MGEN,NERV,PHUN,POAI,SEEL,
8/12/2020 3:45:05 PM: Update Completed: DARE, LastDate=8/12/2020 3:45:00 PM, O=1.155 H=1.1699 L=1.15 C=1.165 V=30142 Count=31
8/12/2020 3:45:05 PM: Applying Update
8/12/2020 3:45:05 PM: Append: DARE
8/12/2020 3:45:05 PM: Clear Indicators
8/12/2020 3:45:05 PM: Creating Executor
8/12/2020 3:45:05 PM: Execute: DARE 8 12 TOP7
8/12/2020 3:45:05 PM: Build Results: DARE Alerts: 1
8/12/2020 3:45:05 PM: Buy 884 DARE Limit 1.13
8/12/2020 3:45:05 PM: Adding 1 Alerts: DARE,
8/12/2020 3:45:05 PM: Replace Alerts: DARE Alerts: 7
8/12/2020 3:45:05 PM: Update Completed(2): DARE (6 symbols left)
8/12/2020 3:45:05 PM: Leaving Update Completed
8/12/2020 3:45:05 PM: Update Completed: DPW, LastDate=8/12/2020 3:45:00 PM, O=2.2202 H=2.2288 L=2.2012 C=2.205 V=20320 Count=35
8/12/2020 3:45:05 PM: Applying Update
8/12/2020 3:45:05 PM: Append: DPW
8/12/2020 3:45:05 PM: Clear Indicators
8/12/2020 3:45:05 PM: Creating Executor
8/12/2020 3:45:05 PM: Execute: DPW 8 12 TOP7
8/12/2020 3:45:05 PM: Build Results: DPW Alerts: 1
8/12/2020 3:45:05 PM: Buy 460 DPW Limit 2.17
8/12/2020 3:45:05 PM: Adding 1 Alerts: DPW,
8/12/2020 3:45:05 PM: Replace Alerts: DPW Alerts: 7
8/12/2020 3:45:05 PM: Update Completed(2): DPW (5 symbols left)
8/12/2020 3:45:05 PM: Leaving Update Completed
8/12/2020 3:45:06 PM: Update Completed: MGEN, LastDate=8/12/2020 4:00:00 PM, O=1.105 H=1.105 L=1.105 C=1.105 V=100 Count=30
8/12/2020 3:45:06 PM: Deleted 1: MGEN
8/12/2020 3:45:06 PM: Applying Update
8/12/2020 3:45:06 PM: Append: MGEN
8/12/2020 3:45:06 PM: Clear Indicators
8/12/2020 3:45:06 PM: Creating Executor
8/12/2020 3:45:06 PM: Execute: MGEN 8 12 TOP7
8/12/2020 3:45:06 PM: Build Results: MGEN Alerts: 1
8/12/2020 3:45:06 PM: Buy 917 MGEN Limit 1.09
8/12/2020 3:45:06 PM: Adding 1 Alerts: MGEN,
8/12/2020 3:45:06 PM: Replace Alerts: MGEN Alerts: 7
8/12/2020 3:45:06 PM: Update Completed(2): MGEN (4 symbols left)
8/12/2020 3:45:06 PM: Leaving Update Completed
8/12/2020 3:45:06 PM: Update Completed: NERV, LastDate=8/12/2020 4:00:00 PM, O=3.435 H=3.435 L=3.435 C=3.435 V=100 Count=28
8/12/2020 3:45:06 PM: Deleted 1: NERV
8/12/2020 3:45:06 PM: Applying Update
8/12/2020 3:45:06 PM: Append: NERV
8/12/2020 3:45:06 PM: Clear Indicators
8/12/2020 3:45:06 PM: Creating Executor
8/12/2020 3:45:06 PM: Execute: NERV 8 12 TOP7
8/12/2020 3:45:06 PM: Build Results: NERV Alerts: 1
8/12/2020 3:45:06 PM: Buy 294 NERV Limit 3.40
8/12/2020 3:45:06 PM: Adding 1 Alerts: NERV,
8/12/2020 3:45:06 PM: Replace Alerts: NERV Alerts: 7
8/12/2020 3:45:06 PM: Update Completed(2): NERV (3 symbols left)
8/12/2020 3:45:06 PM: Leaving Update Completed
8/12/2020 3:45:06 PM: Update Completed: PHUN, LastDate=8/12/2020 3:45:00 PM, O=1.5094 H=1.5094 L=1.48 C=1.485 V=114246 Count=41
8/12/2020 3:45:06 PM: Applying Update
8/12/2020 3:45:06 PM: Append: PHUN
8/12/2020 3:45:06 PM: Clear Indicators
8/12/2020 3:45:06 PM: Creating Executor
8/12/2020 3:45:06 PM: Execute: PHUN 8 12 TOP7
8/12/2020 3:45:07 PM: Build Results: PHUN Alerts: 1
8/12/2020 3:45:07 PM: Buy 689 PHUN Limit 1.45
8/12/2020 3:45:07 PM: Adding 1 Alerts: PHUN,
8/12/2020 3:45:07 PM: Replace Alerts: PHUN Alerts: 7
8/12/2020 3:45:07 PM: Update Completed(2): PHUN (2 symbols left)
8/12/2020 3:45:07 PM: Leaving Update Completed
8/12/2020 3:45:07 PM: Update Completed: POAI, LastDate=8/12/2020 3:45:00 PM, O=1.495 H=1.5 L=1.49 C=1.495 V=5139 Count=32
8/12/2020 3:45:07 PM: Applying Update
8/12/2020 3:45:07 PM: Append: POAI
8/12/2020 3:45:07 PM: Clear Indicators
8/12/2020 3:45:07 PM: Creating Executor
8/12/2020 3:45:07 PM: Execute: POAI 8 12 TOP7
8/12/2020 3:45:07 PM: Build Results: POAI Alerts: 1
8/12/2020 3:45:07 PM: Buy 684 POAI Limit 1.46
8/12/2020 3:45:07 PM: Adding 1 Alerts: POAI,
8/12/2020 3:45:07 PM: Replace Alerts: POAI Alerts: 7
8/12/2020 3:45:07 PM: Update Completed(2): POAI (1 symbols left)
8/12/2020 3:45:07 PM: Leaving Update Completed
8/12/2020 3:45:07 PM: Update Completed: SEEL, LastDate=8/12/2020 3:45:00 PM, O=1.06 H=1.065 L=1.05 C=1.055 V=5220 Count=29
8/12/2020 3:45:07 PM: Applying Update
8/12/2020 3:45:07 PM: Append: SEEL
8/12/2020 3:45:07 PM: Clear Indicators
8/12/2020 3:45:07 PM: Creating Executor
8/12/2020 3:45:07 PM: Execute: SEEL 8 12 TOP7
8/12/2020 3:45:07 PM: Build Results: SEEL Alerts: 1
8/12/2020 3:45:07 PM: Buy 961 SEEL Limit 1.04
8/12/2020 3:45:07 PM: Adding 1 Alerts: SEEL,
8/12/2020 3:45:07 PM: Replace Alerts: SEEL Alerts: 7
8/12/2020 3:45:07 PM: Update Completed(2): SEEL (0 symbols left)
8/12/2020 3:45:07 PM: Leaving Update Completed
8/12/2020 3:45:07 PM: Processing Completed
8/12/2020 3:45:07 PM: All Updates Returned
8/12/2020 3:45:07 PM: Item Processing Completed
8/12/2020 3:45:07 PM: Calculating NextRun...
8/12/2020 3:45:07 PM: NextRun set to 8/12/2020 4:00:00 PM
8/12/2020 3:45:07 PM: Refreshing Item in GUI
8/12/2020 3:45:07 PM: Leaving Intraday Thread
profile picture

Cone

#24
QUOTE:
If I understand WLD correctly, the system will only generate a limit sell order when it *thinks* it has a position in the symbol...
Correct. More specifically though, you must pass a Position to an exit order. It won't work if the Position is null (doesn't exist) or if the Position referenced has already been closed.

QUOTE:
Is there a way to force the system to generate limit sell orders for ALL symbols in the dataset at each run of the strategy?
No, because it requires an active [hypothetical] Position.

Assuming the code is correct and the hardware isn't failing, the code won't fail (computers don't make mistakes). So we're missing something, so we have to continue to exhaust the possibilities. The only other thing I can think of at the moment is that data loading is insufficient.

For example, there are 26 15-min periods in the day and you need at least 18 bars for your channel period to be valid. So, for the sake of argument let's say you set data loading to 1 day of data. For buys that occur for the current day, there's no problem because new bars are added to the history initially loaded. However, say you entered a position 2 days ago. This strategy won't know that this Position exists, so you'll start the day buying again. Is this scenario possible?
profile picture

digitalsculpture

#25
QUOTE:
"For example, there are 26 15-min periods in the day and you need at least 18 bars for your channel period to be valid. So, for the sake of argument let's say you set data loading to 1 day of data. For buys that occur for the current day, there's no problem because new bars are added to the history initially loaded. However, say you entered a position 2 days ago. This strategy won't know that this Position exists, so you'll start the day buying again. Is this scenario possible?"


I don't think this exact scenario is possible, because in the strategy settings I'm specifying a data range of 1 week. And I'm having such bad luck with the system losing track of positions that I'm closing all positions at the end of each day, so I'm starting from scratch each morning. And also, an example of what I'm seeing is this: position in symbol is taken at 11:33am... strategy runs at 11:45am and a sell limit order is issued correctly... at 11:59am the position still has not been sold... at noon the strategy runs again and submits a *buy* limit order instead of a *sell* limit order. So, what I'm getting at with this example is that the system is getting confused on a very short time frame. And it's happening a lot. I'm seeing that about half of my positions are failing to get sold because the sell limit orders aren't being created.

Could it be that there's an interruption in the data from IQ Feeds? Would that be enough to cause the strategy to get confused about whether it owns a hypothetical position?

QUOTE:
"Assuming the code is correct and the hardware isn't failing, the code won't fail (computers don't make mistakes). So we're missing something, so we have to continue to exhaust the possibilities. The only other thing I can think of at the moment is that data loading is insufficient."


My friend just set up WLD, IB, IB Provider, and IQ feeds on his computer like I've done, and is running the same strategy I'm using. He is running into the exact same problem with limit orders not being created, so I don't think my hardware is the cause.

If there's any chance I may be getting bad data, or incomplete data, from IQ Feeds, what other data provider might you suggest I test to see if it would improve performance?

Or, are there any other tests I might try to further explore the possible causes?

My strategy is rules based, and I'm not converting it to code prior to running the strategy. But just in case there could be a glitch in the code that's underlying the rules I thought it would be a good idea to "open code in new strategy window" and share it with you. Here it is:

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

digitalsculpture

#26
I was just reading some of the documentation on IB Provider. http://ib-automated-trading.com/ib-manager/

Toward the bottom of the page it says this...

"Allow 0 Volume Bars (Default: unchecked)
Chart requests will cache all the data returned by IB, even bars where no trading occurs. Some bars may have open, high, low, and close all equal to the same price, but with volume = 0. You can include these zero volume bars in a Wealth-Lab chart by checking this option. Note that this option is not required for Cash markets for which volume is not reported."


Again, I'm using IQ Feeds for streaming data, and I'm not sure how all of these parts work together, so maybe I'm off track here. But since this box is unchecked by default, could it be the source of the problem?
profile picture

Eugene

#27
QUOTE:
And I'm having such bad luck with the system losing track of positions that I'm closing all positions at the end of each day, so I'm starting from scratch each morning.

That's probably the answer. You're breaking the link between the historical positions and new signals. The strategy assumes having different positions which arise from loading 1 week of history while your account has none. They are out of sync.
profile picture

Cone

#28
I agree with Eugene. You have to keep in mind that the Strategy doesn't know anything about the live account. It's aware of only what it does hypothetically. If you close all positions at EOD, the next morning the strategy that had an active position at EOD will still have a hypothetical active position and will be trying to sell it in the morning. Make sense?

'Allow 0 Volume bars' is an option for IB Provider data. If I read this right, you're using IQFeed DataSets and IB Provider only for trading. '


Joe, do this for a day to keep it saner - use Strategy windows. Set up a workspace with, say, 4 or even 8 strategy windows. Pick a different symbol for each one. To complete the set up, click Auto-Stage on the Alerts tab. Use the Alt key + Stream button to turn on/off streaming for all the windows. Save the workspace.

The only thing you'll have to do is load the workspace, start streaming and turn on Auto-Trade (if you want to). In this way, you can inspect the chart and make sure the signaling is correct - maybe we'll learn something. If you need help, we can zoom again tomorrow.
profile picture

digitalsculpture

#29
Robert,

I'll set things up like you've suggested and keep a record of what happens. Thanks for offering to Zoom today. That would be great -- let's do it. Is there a time this afternoon that will work for you? I'll be free from noon to 4pm EST.
profile picture

Cone

#30
Sorry, I cannot today - I said tomorrow, meaning Friday. Remember we're up early on this side of the pond!
profile picture

digitalsculpture

#31
Okay, no problem. Tomorrow will work too. What time suits you best?

By the way, I set WLD up as you suggested, running eight strategies at once. I'm taking screenshots at regular intervals to help with troubleshooting. I've already noticed a strange discrepancy. The alerts in the strategy windows are updating consistently, but the orders are not. I have all of the strategy windows set to auto stage.

Please see the attached screenshots.

For example, in screenshot_6 there are alerts to sell POAI, MGEN, and PHUN, but those alerts are not being sent through to the orders window.
profile picture

digitalsculpture

#32
...and I just realized that in my last post, my reasoning is probably flawed. Since I don't have live trading turned on, there are no actual positions to sell, and so the system can't pass any sell limit orders through from the alerts to the orders window.

Anyhow, I'll keep taking the screenshots in case they're helpful for troubleshooting.
profile picture

Eugene

#33
QUOTE:
my reasoning is probably flawed. Since I don't have live trading turned on, there are no actual positions to sell,

Exactly. Signals are staged but you have to place them on each bar (or enable auto place).
profile picture

digitalsculpture

#34
I just talked with my friend who is using the same trading strategy that I've described above. He said that today he decided to try creating a separate strategy for each symbol, so he's running eight separate strategies at once. So far today his limit sell orders have been issuing consistently.

When I have run my strategies in the past I have always traded a dataset with multiple symbols in it. Should I consider switching over to the one-strategy-per-symbol approach that my friend is using? Are there any obvious reasons that his approach would be more reliable?
profile picture

digitalsculpture

#35
Used the one-symbol-per-strategy approach today, but it didn't improve performance. WLD failed to submit limit sell orders again. I've now lost quite a bit of money because the system isn't working correctly.

This morning my strategies purchased SEEL and DPW at ~10:00am. In the couple runs of the strategies that followed at 10:15 and 10:30, sell limit orders were issued correctly. However, at 10:45 while I was still holding positions in SEEL and DPW, the strategies canceled the sell limit orders and issued buy limit orders instead.

I'm attaching a screenshot that shows a view of WLD from 10:55

If you have any additional suggestions for how I might resolve the problem I would appreciate it.
profile picture

Eugene

#36
QUOTE:
at 10:15 and 10:30, sell limit orders were issued correctly. However, at 10:45 while I was still holding positions in SEEL and DPW, the strategies canceled the sell limit orders and issued buy limit orders instead.

Sorry I don't understand. How come you were holding positions in these stocks despite the sell limit orders?
profile picture

Cone

#37
QUOTE:
10:15 and 10:30, sell limit orders were issued correctly. However, at 10:45 while I was still holding positions in SEEL and DPW, the strategies canceled the sell limit orders and issued buy limit orders instead.

This is not specific enough. What were the sell order prices? An example of what could be happening (explained in the User Guide > Orders > Portfolio Synch > Theoretical vs. Actual. To debunk this idea, just open your strategy in a chart window and look at the trades? Did the sell order fill "theoretically"?

Limit order strategies - especially with illiquid symbols - must be watched carefully. The strategy will always fill, but you may not be.

Please don't use the Strategy Monitor until you can sort this out. Use Strategy Windows. The S. Monitor doesn't give you the visual feedback you need to understand what's going on.

Again, check for the hypothetical trades in a Strategy window for SEEL and DPW, and see if what happened makes sense.



profile picture

digitalsculpture

#38
QUOTE:
Sorry I don't understand. How come you were holding positions in these stocks despite the sell limit orders?
At 10:45 I was still holding positions in SEEL and DPW because the sell limit orders didn't get filled.

QUOTE:
Did the sell order fill "theoretically"?

Looking at the charts now, I can see that the sell limit orders did indeed fill "theoretically" right before I ran into the issue I described above.

This is starting to make more sense now. So, perhaps the best pragmatic fix would be to use market orders for selling?

Please see the image below. Do you think these rules would cause the strategy to more consistently sell the symbols at channel highs?

profile picture

Cone

#39
Using a market order is the right idea. However, the way you have it set up is to Sell At Market if the Close of the current bar is precisely the Highest price in the lookback period. That will only occur if the Close[bar] == High[bar[ AND High[bar] is the highest price in the lookback. It happens, but I don't think that's what you want.

If you describe the rule you want, we might be able to find or code something appropriate. However, I'm afraid what you're looking for will be a multi-timeframe strategy, which the Strategy Builder doesn't support. (We can help code it for you though.)

Here's what I mean by multi-timeframe: You can create indicators based on 15-minute bars, but operate on the 1-minute scale. For example, you could create your channels and other indicators based on 15-minute bars but run the Strategy on a 1-minute scale. When the 1-minute High or Close crosses the channel high based on 15-minute bars, you'd sell At Market. Whereas a Limit order is always "working", you'd be checking for a channel crossing every minute. You could even reduce that to n-second bars with IQFeed (but I have never tried multi-timeframe with n-second bars).

Finally, you'll still have a similar problem using the Buy At Limit order. Most times you're likely to be filled. Other times, no.
profile picture

digitalsculpture

#40
Thanks for sticking with me through this long discussion, and for your patience with all of my beginner's mistakes.

QUOTE:
I'm afraid what you're looking for will be a multi-timeframe strategy, which the Strategy Builder doesn't support.

I would prefer to stay with the strategy builder if at all possible. If it would make things easier I could switch to a different scale. The strategy I'm using seems to also work at a 5 minute and 1 minute scale as long as the channel periods are adjusted to use the same time frames for buying and selling lookbacks. But of course, if what I'm trying to do isn't possible with the strategy builder then I'll be happy to bite the bullet and switch over to using code.

QUOTE:
Finally, you'll still have a similar problem using the Buy At Limit order. Most times you're likely to be filled. Other times, no.

In the live trading I've done so far I've seen that the limit buy orders have been filling without any major problems. So, I think it's fine to keep the buying part of the strategy as is.

QUOTE:
If you describe the rule you want, we might be able to find or code something appropriate.

Thanks! Basically, what I'd like to do is sell with a market order if the current price is greater than or equal to the highest price in the lookback period.

So, here's how I'd like to set the strategy up on a 5 minute scale:
Buy at limit channel low, with channel period of 60
Sell at market when current price is greater than or equal to highest price in past 6 bars

Or, if it would be better to use a 1 minute scale then the strategy would be:
Buy at limit channel low, with channel period of 300
Sell at market when current price is greater than or equal to highest price in past 30 bars

profile picture

Cone

#41
Re: BuyAtLimit
Buy (and Short) limits are just as susceptible as Sell (and Cover). The thing is, when an entry limit order does not fill, it won't be as noticeable because Wealth-Lab's Portfolio Sync will save you from attempting to sell a Position you don't have. In other words, since you're autotrading, the Orders tool checks to make sure you have a Position to sell before placing the order that it received. If you don't own a position in the symbol's hypothetical Position being exited, the Orders tool "eats" the order and does not place it.

Sure, for channel high/low, you don't need to multi-timeframe. Use 1-minute bars so that you're checking every minute for your exit. For Price1 and Price2, use High and High (or Low and Low), to sell at market on the next bar.

Edit:
QUOTE:
For Price1 and Price2, use High and High (or Low and Low), to sell at market on the next bar.
Let me double ceck how that rule actually works... I'll come back..
profile picture

Cone

#42
Your requirement is: "Sell at market when current price is greater than or equal to highest price in past 30 bars"

I'll just restate that that will only occur if the Close[bar] == High[bar[ AND High[bar] is the highest price in the lookback.

Whereas a SellAtLimit would always hypothetically sell if the limit were touched, your rule would only sell if Close precisely equaled the High in the lookback.

Say that price went straight up after you bought it, and the highest price in the last 30 bars is 10.50, but the Close for the next 10 bars is 10.49, 10.48, 10.47, etc.. You won't sell until at least 30 bars later when the Close = High of last 30 bars condition occurs.

In short, what I said before is correct if you want to use the Rules-based code. I recommend that you use High/High, so that if the High were "touched" you exit at market, no matter where the Close is.

If you go to a Code-based strategy, then you can "delay" the channel series by 1 bar and then you can see if the Close is at or greater than the High of the last 30 bars before exiting. Run this code, copy, paste, and compile, and compare it to the Rule-based High/High technique.

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

digitalsculpture

#43
Thanks so much for your help!!!! I really appreciate it!!!
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).