- ago
Hello,

What would be the best way to implement a strategy in the strategy monitor or quote window that needs to trade at the very end of the day (last 3-5 seconds). I am working on a strategy that looks at the current day price movements and indicators only and uses that information to determine what symbols to pick at market close to hold.

Would I use the strategy monitor with daily streaming? Do I need to make this strategy intraday and stream a lower bar interval? I am only considering roughly 30-40 symbols. Any tips would be appreciated.
0
310
Solved
14 Answers

Reply

Bookmark

Sort
- ago
#1
Any help on this... still trying to figure the best way out.
0
MIH7
- ago
#2
Hi.

I am not sure about the details you looking for, but maybe MOC or LOC orders might be the way to go. You can look for it in the trading preferences.
0
Cone7
- ago
#3
QUOTE:
I am working on a strategy that looks at the current day price movements and indicators only and uses that information to determine what symbols to pick at market close to hold.
At what time, exactly, does the strategy need to make the decision? 3:55? 3:59? 3:59:55?

True MOC/LOC orders need to be placed 5 or 10 minutes before the close to participate in the closing auction. You can also select "not" to use a MOC type in Trading Preferences to let WealthLab place a market order (triggered by OrderType.MarketClose) the specified number of seconds before the close. See the User Guide for the options/behaviors in Preferences > Trading.

QUOTE:
Would I use the strategy monitor with daily streaming?
Theoretically this may be possible using Daily bars with Streaming by assigning the symbols to a market that ends at 3:59 PM.
0
Best Answer
MIH7
- ago
#4
How is the OrderType.MarketClose used correctly in the backtest?

CODE:
PlaceTrade(bars, TransactionType.Sell, OrderType.MarketClose, 0,"MOC");

It seems to me that this function call sells at the next bar only. I guess it needs to be combined with IsLastBarOfDay().

0
Cone7
- ago
#5
ALL signals are for the next bar.
You can't trade the close of a bar after it already closed - especially a Market On Close order, which the NYSE (for example) won't accept after 3:50pm.
0
MIH7
- ago
#6
Ok and sorry when i am repeating, but how do i backtest this order type?
0
- ago
#7
The best explanation is here:

https://www.wealth-lab.com/Discussion/How-do-I-enter-at-the-close-of-the-day-5504

we need to publish a blog post on this topic!
0
- ago
#8
It would need to trade around 3:55:55. The main problem is that it only uses data from the current day’s price/volume action and I can’t find a way to effectively stream for that. The quotes window doesn’t allow indicators to stream prices so I think I have to use the strategy monitor but so far I haven’t had any luck.
0
Cone7
- ago
#9
3:55:55, as in 5 seconds before 3:56pm? The 2 ways to do it that I can think of -

1. With a 1 minute bars base chart scale, you can trigger a Market (or MarketClose) order at 3:56. Of course, if this is a Daily bar Strategy, this would require scaling modifications.

2. Using Daily bars, you could assign the symbols to a Market (a copy of U.S. Stocks) that ends at 3:56pm.

In the Strategy Monitor, make sure to select that new Market at the bottom of the configuration, and program the Daily run at 3:56pm. The bar will update and the strategy will run at that time. (Theoretically this should work, but I just tried it with a market ending at 10:11am. Processing started, but didn't seem to execute the script. Not sure why.)

Who's your broker?
0
- ago
#10
Sorry Cone 3:59:55, 5 seconds before close. It's currently a daily strategy that uses [idx+1] values in backtesting so-as to use current bar information. I use TDA.
0
Cone7
- ago
#11
If I'm reading you right, you want to trigger trades based on an "estimated Close" of the day, which is the current price as close as possible to the end of the session.

5 seconds left in the session is not enough time [for even a Market order] to activate at TDA. Maybe, maybe not. I wouldn't plan on anything less than 20 seconds to ensure a fill.

And, since you're working with 30 to 40 symbols, it requires the Strategy Monitor. That pretty much limits you to triggering starting at 15:59:00.

The trick required is a technique to access Daily bars - probably by polling for them - before the end of the session. Essentially, you need to trick WealthLab into thinking that the "partial daily bar" is complete before 4 pm. Technique #2 described in post #9 above should work (I think) - but it does not currently.

@Glitch, any ideas?
0
- ago
#12
No, this is way beyond my simple daily trading regimen.
0
- ago
#13
Exactly, if I could trick WL into a partial bar being a full bar at 3:55 or 3:59, I would have enough information to then either manually place the trades or allow WL to place them with 10-20 seconds left. What I am trying to do is mimic an MOC order by buying at the end, because the strategy isn't ready by the 3:45 or 3:50 mark for MOC orders.

0
Cone7
- ago
#14
The technique works in a Daily bar Streaming chart, but not in the Strategy Monitor, which has extra logic for Daily+ processing delay. However, I set that to zero, it seemed to process the bar at the "end of session" but the Signal didn't get through. We'll have to dig into it to see why.

I also noticed a minimum 1 second before market close preference to submit MOC/LOC orders. Since we're triggering precisely on the session close, we probably have to relax that to 0 too.
0

Reply

Bookmark

Sort