- ago
In the following, I will talk about regular trading hours in the context of fully automated trading (30 minute scale).

In the Strategy Monitor, the next run on the next day is set to 16:00 (10:00 US time).
Does this correspond to the defined behavior or settings that can be made?

Why is the first run not performed at 15:30 (09:30 US time)?

The last run is at 22:00 (16:00 US time). What is the purpose of this run if no orders can be placed until the next day
and new prices (after hours) are available at the beginning of the next day?

There is certainly a simple explanation that I do not know.
For me, it would be better to execute the strategy at market opening instead of market closing.
0
650
49 Answers

Reply

Bookmark

Sort
Cone7
- ago
#1
QUOTE:
In the Strategy Monitor, the next run on the next day is set to 16:00 (10:00 US time).
Does this correspond to the defined behavior or settings that can be made?
It corresponds to the Market's opening + the end of the first interval.

QUOTE:
Why is the first run not performed at 15:30 (09:30 US time)?
Because there is no data at 0930 since the market hasn't opened yet.

QUOTE:
The last run is at 22:00 (16:00 US time). What is the purpose of this run if no orders can be placed until the next day and new prices (after hours) are available at the beginning of the next day?,... For me, it would be better to execute the strategy at market opening instead of market closing
Now you're on to something. Assuming you're trading the regular session only, if you allow your intraday strategy to create orders on the last bar of the day, the order needs to be placed for the open of the session the next day. Right now, there's no easy way to do that.

I think it makes sense for a Strategy that is Activated premarket to generate Signals from the last run of the previous day.
0
MIH7
- ago
#2
Sorry, i don't get it.

The market opens at 09:30 (not 10:00). At his point there is new information and data available. The strategy needs to run at this time, especially because of the changes during the after/pre market hours.

The run on 16:00 and on 09:30 will produce different results because something happend inbetween (different prices). If you have a price gap of 5% down, for example, the strategy should trigger a signal at 09:30 and not at 10:00. But the price difference was not there at 16:00, so it must happen at the opening of the market.

What is my error in thought?
0
MIH7
- ago
#4
I think I am getting closer to your explanation. You mean by "no data" that you need the last bar from the pre-trading hours to have the current status for the 0930 run. Is that your point?

If that is your point, then please fix it. Because the market opens at 0930 and thus the need for action. Generally there is information (new bars) that allows the strategy to be executed at 0930. If WL does not query and use this information that is a different point.

The Data has changed between 1600 and 0930.
In comparison, the 1600 run is redundant, but not the one at 0930.



0
Cone7
- ago
#5
QUOTE:
The strategy needs to run at this time, especially because of the changes during the after/pre market hours.
This is only the case if you're not filtering pre/post market data.

The good news is that you can just change the Market at the bottom of the Strategy Monitor strategy configuration to a 24-hour market - or one that opens 1 interval before 0930.. Then it will schedule that 0930 [and/or other] runs using premarket data.

The bad news is that I think the strategy only loads history for regular session hours in the S. Monitor. So the data history won't be there unless you actually change the market for the symbol.

Long story short, the Strategy setting for pre/post filtering is missing in the Strategy Monitor, and I think it needs to be there. At a minimum it needs to pick up the setting last saved with the strategy.
0
MIH7
- ago
#6
Thanks for your reply and your estimate.

It is important for me to know that i wasn't missing something.
Just to avoid any misunderstanding of what you say. Which market/time settings do you talk of?



And does the setting in the strategy itself has an influence (for trading)?
I see it is a backtest setting, but just to be sure.



If this setting is used for trading too, i can think of a workaround.
This could be to use Pre/Post Market data and limit the time in the strategy code for the last bar before opening.

However, looking forward to the improvement. Thanks.
0
Cone7
- ago
#7
We're not talking about Daily+ strategies, so that first image with times does not apply to this conversation.

The Market that controls the run times is in the drop down at the bottom. Open a Strategy Monitor, hit F1 (help), and scroll to the image in the middle of the page. It's marked with a big red "2" and explained below:

2 - Market
Check for the correct market, which affects the run times.

0
MIH7
- ago
#8
Thanks Cone. I have the right settings by default in my case. I did not need to change it before.
Ok, so the time settings are implicit with the market.

So, it is finally about making the pre/post filter available for the Strategy Monitor.

Maybe when working on that you can think of this special case too where only the last bar of pre-market is needed to start a RTH strategy with the market open. Of course it can be handled individually too, when the data is available.

Saying this, i am looking into the preferences again.



If i enable this and code the strategy to use the last bar before opening,
how would the code look like? Isn't that the data we are talking about?

So, if this is enabled, will the strategy start at 0930, or do you still need an update for the Strategy monitor?
0
MIH7
- ago
#9
Hello again. Just a question about some configurations and how to handle them.
The combination of a new market and trading Pre/Post Market, might that be enough?





I think the strategy would start at 0900 and should work for trading.

Am I correct that I then need to exclude the time slots in the strategy code besides 0900?
Controlling the time slots in the code would allow the setup to be used in backtesting as well (when using pre/post market data).

Thus, an RTH strategy would be modeled, which already produces signals at the market opening and also analogously in the backtest.

What do you think?
0
Cone7
- ago
#10
First thing, if you change the market (and hours) for a symbol, then that becomes regular session, so you wouldn't have "Enable Pre/Post Market Trading".

QUOTE:
I think the strategy would start at 0900 and should work for trading.
I think so too.

QUOTE:
Am I correct that I then need to exclude the time slots in the strategy code besides 0900?
If you want to trade starting with the end of the bar that starts at 09:00, then you just need to put a statement like this at the top of Execute()

CODE:
         if (bars.DateTimes[idx].GetTime() < 900)             return;


QUOTE:
What do you think?
I think that you're going to get another bar that includes the trading from 0900 to 0930, so you still won't get the signal that may have occurred at 16:00 the day before.

Currently, the only way I can think of to generate those signals at 16:00 for the new session is to run a backtest in a strategy window premarket, using the regular market hours. Then you can Stage or Place the signals for the new session that opens at 09:30.
0
MIH7
- ago
#11
QUOTE:
First thing, if you change the market (and hours) for a symbol, then that becomes regular session, so you wouldn't have "Enable Pre/Post Market Trading".


Ok, good to know about this detail.

To keep the settings consistent in the backtest, I decided to activate this function in both parts. This way I can directly control the trading times in the backtest as well. Ultimately, I turn on Pre/Post Market everywhere and control the times explicitly in the strategy code.

QUOTE:
If you want to trade starting with the end of the bar that starts at 09:00, then you just need to put a statement like this at the top of Execute()


I already played around with it and did a backtest as described.
Combined with the first point it looked like that (buy,sell)
CODE:
// handle pre/post market hours explicitly 30-Min scale if (bars.DateTimes[idx].GetTime() < 0900) return; // market open 0930 if (bars.DateTimes[idx].GetTime() >= 1600) return; // market close 1600


So, thanks for confirmation.

QUOTE:
I think that you're going to get another bar that includes the trading from 0900 to 0930, so you still won't get the signal that may have occurred at 16:00 the day before.


Please help me to understand why you need this signal of 1600. In my opinion you only need the 1600 OR the 0900 signal (evaluation).
If you left out the time in between, or in a 24 hour market, it would only be one signal. Now there is a break, so I want to take the last data, but I need only one signal (to continue)
0
Cone7
- ago
#12
QUOTE:
if (bars.DateTimes[idx].GetTime() >= 1600) return; // market close 1600
I did not suggest this one... but if you make it > 1600 so as not to process post market trading, that seems okay.

QUOTE:
Please help me to understand why you need this signal of 1600.
Well remember, I don't know anything about your strategy. You can do whatever you want, as long as you know what you're doing.

What happens if you're long and your strategy [would have] signaled to exit on the 16:00 bar? If you don't process the 1600 bar (the summary of the trading from 1530 to 1600 for a 30-minute bar) you miss that exit signal.
0
MIH7
- ago
#13
QUOTE:

What happens if you're long and your strategy [would have] signaled to exit on the 16:00 bar? If you don't process the 1600 bar (the summary of the trading from 1530 to 1600 for a 30-minute bar) you miss that exit signal.


That's a good question I've been thinking about as well.

1.
My first thought was that signals that are not regenerated at 0900 are not relevant. However, we both know that the reason for signals can be very different. While a crossover at 1600 does not reappear at 0900, a StopLimit can still be generated at 0900, just as an example. In short, it really depends on conditions or strategy.

2.
However, inspired by your question, I also tried to think about it in a formal context. Here is my conclusion.

A thought model can look like this. For each time scale we have bars. A trading day then looks like this on the timeline if you choose 1h as the base for illustration and map it vertically.

(You can look into #15, i missed to upload the images)

If you want, you can consider the break as a bar of 7h or 17h. This bar has an open (left) and a close (right) like trading bars. Even if you don't trade the pre/post market, it still takes place. In the second picture, the bar includes these trading times, which leads to the fact that the "bar" (break) has an open and close that differs from each other.

Now the crucial point. The open is always on the left side of the bar and the close is always on the right side, no matter if we put the bar before 1000 or after 1600. That means 1600 is the open for the break and at 1000 the bar is closed. The same is true for the bars in which you trade.

So the conclusion is that when you trade the close you should consistently choose the right side of the bar.

Now coming back to your question, this is how I see it. Yes, you can miss a signal, but you do so basically and differently roughly depending on the time period you choose to trade. More importantly, however, from the point of view is that the open is not considered, but the close. If one is consistent and follows this logic, one takes the price information that is generated at the end of the break.

Just my 2 cents.

3.
From my standpoint, I see the issue as solved. The technical tools to implement this are available.
Of course, the evaluation can be different with a different way of looking at things.

Thanks Cone! for the support.
0
MIH7
- ago
#14
I missed to put in my picutres for my second point. Unfortunatelly images can not be uploaded afterwards.



0
Cone7
- ago
#15
QUOTE:
That means 1600 is the open for the break and at 1000 the bar is closed. The same is true for the bars in which you trade.

fwiw, bars end with the last tick at or on 16:00:00.000 exactly, but the open is the first tick in the next interval - at least at 16:00:00.001.

Anway, if you've got it under control, all's good!
0
MIH7
- ago
#16
Well, i think you know what it is about. There is a difference in 16:00:00.000 and 09:00:00.000. So the question is at 09:00:00.001,
which closing price do you take. No need to be nitpicking. I simply tried to give a picture how the break "can" be handled.
And i think the "idea" was explained pretty simple. It is not about ticks here.

The break opens at 16:00:00.001 and the break stops at 09:30:00.000 for the RTH.
And you will have a different price when this time slot starts and when it stops.

My argument was, if you want to be consistent when you trade the "Close" of bars,
you should trade the price when the break (time slot) ends and not the price the break "opens" with.

If you don't want to follow such a simple principle it is ok.
If you have good reasons for it, it is ok too.
If you don't understand what i say, it is ok too.
If you don't want to talk about it, it is ok too.

But talking about ticks in this context is boring and shows the quality of you mindset, or what is your point with it?
I will apologize if that was not meant to be a jibe.

It would really be much more interesting to know why this consideration is not used or what the reasons are for taking the 2200 close instead of the 0900 close.
0
MIH7
- ago
#17
Can you please solve this, because this a negative impact on trading results.

The scenario looks like that at 0930 also no SL order is attached to the main order.
This means that in my case the stop limit has already been reached and falls another 30 minutes. (Today alone I have lost an additional 1-2 percent).

Only then the SL and TP orders are placed (again).

To be honest, this is an embarrassing and shameful behavior for a trading software, not to accompany the main order permanently with a SL. Permanent is simply defined as soon as it is filled, until it is sold.

When it comes to real money, I don't care which design you use and for what reasons. If it doesn't work, the software is not worth a penny for automatic trading.

QUOTE:

What happens if you're long and your strategy [would have] signaled to exit on the 16:00 bar? If you don't process the 1600 bar (the summary of the trading from 1530 to 1600 for a 30-minute bar) you miss that exit signal.


What happens if the price falls in the pre/after trading hours and the SL is triggered (not at 1600, but in the in-between time, until 0930)?

The answer is clear! So fix the point. The RTH start at 09:30. Directly at 0930 orders can be placed, that is the meaning of "the market is open".
0930 to 1000 is part of RTH, pretty simple.

The check if a signal is generated (for the RTH) is based on the last available bar, and that is not the one of 1600 of the previous day.
The last available bar is the one before the market opened (and is not required to be part of the RTH).

Correct the error and stop messing around.
0
MIH7
- ago
#18
A pretty simple question, will you fix this issue?

Regardless of which bars (1600, 0930) you use for signal generation, signals for the "bracket" orders (TP+SL) must be generated in any case, also by WL design.

These can and must be placed completely independently at 0930, especially since they are cancelled at 1600 (the day before).

Here are two examples from my portfolio from yesterday and today. These are not exceptions but daily events. (PDD from yesterday, BIDU from today). I am sure you know that especially the markt opening is very sensitive for these price movements. So this is one of the worst moments actually, not securing the orders.

The TP+SL orders are just a first and necessary step. Finally i would appreciate that any type of event driven signal can be placed at 0930 already. As i said before, the last available price/bar before market opening should be used.





0
- ago
#19
Why can't you define a market with hours of 9:29 to 16:00? Then, you'll get that first bar that you want to take an action on and can place signals for 9:30 based on that bar.
1
MIH7
- ago
#20
Hello Glitch,

i tried it (see post #8,#9). And, of course, i will try it again, but i failed the first time for some reason i do not know.

I enabled pre/post market trading in the setup (to be sure to get the bars before 0930). Maybe it is not necessary if the market is defined with 0900 start time. (30 minute scale). Additionally i prepared my code to use the range i defined in the market.

Ok, i will try it again and report tomorrow in hope that it will work.

But even if I get it working, I still think that with defined market opening (in that case 0930) it must be possible to place orders automatically.

For one thing, orders are not always triggered by events, so are not dependent on any bars from the past, like SL+TP. And when it comes to event triggered orders to be placed, it is not a requirement that the bar for the signal evaluation is also part of the RTH. And it is self-explanatory that a price from the previous day is irrelevant if you can use a near-time price. Finally, for a market defined for 0930-1600, the design must be able to place signals already at 0930.

It would be much easier for me to understand you, if someone can give me a reason why a TP/SL should not be placed at 0930., with the default market. All requirements for generating and placing a signal are met. And if one starts to generate signals out of this context, consequently other (event driven) signals should be generated as well (which admittedly must take into account several considerations.).

The above mentioned solution is only a workaround imho.

In addition, there may be inaccuracies with the terminology. While the RTH refers to the defined market time, no explicit RTH is specified in the backtest. Well, this leads to the fact that you have to switch off the pre/post filter in the backtest although you are trading at "RTH". Different meanings in the two sections. (EDIT after post #21: not to forget the code changes to avoid trading/backtesting the pre/post trading hours by accident)

0
- ago
#21
I can see a new override method might be introduced to facilitate an event to be triggered that would execute at the start of the trading day (market open). I see it as an enhancement and not really a fix, but it would provide some useful new functionality.

And you mentioned 30 minute bars, so yes in order to get this working you'd need to define the market open as 9:00est, you should then get that first 30 minute bar, assuming there is pre-market data for the symbol.
0
MIH7
- ago
#22
Thank you very much. I am very much looking forward to this enhancement.
0
MIH7
- ago
#23
Ok, today i tried it again.

I used a customized copy of "US Stocks" market where I adjusted the start time from 0930 to 0900. My code contains the following line to prevent pre/post trading.

CODE:
if (bars.DateTimes[idx].GetTime() < 0900) return; // market open 0930


and i enabled pre/post market trading in the settings.

Well, the strategy was activated at 0930 (instead of at 1000) but signals were neither generated nor sent.
The generation and placement of orders was again done at 1000. Are there any other settings I need to consider?
0
MIH7
- ago
#24
Hello Glitch, Hello Team.

I'm sorry, but this problem should be fixed urgently. Although I would like to avoid further discussion,
this is a crystal clear usability bug (in the context of auto-trading) and not an "improvement".

1. An attached stop loss order that fails for a time slot is a bug! This needs no further explanation.
If this time slot is also the first one during regular market hours, it does not make it any better.

2. In addition, an order should always be able to be placed at the opening of the market, detached from point 1.
There is no meaningful consideration that an order cannot be placed at the opening of the market.
This cannot be in the sense of the inventor (especially not if you are the inventors).

3. Maybe you can help me with the workaround, because I could not get it to work. I have copied and adjusted the "US market" as described (start time moved forward by half an hour, since I use a 30-minute strategy). I did not set the filter Pre/Post Market Data in the strategy and activated Enable Pre/Post Market Trading in the trading configuration.

The strategy monitor is now started 30 minutes earlier, but no signals are generated and there is nothing in the order manager.

Now I ask you to confirm that this or another workaround works by trying it.

Thank you very much in advance.

In the long run, I ask that you consider this an bug, as it cannot be intentional behavior (see first two points),
and fix this problem as soon as possible.
0
MIH7
- ago
#25
Now, is there a working way to place orders at 0930? Have you tried it on your side? (the pre/post trading setup with modified market)

If you can confirm that it works for you, then I can at least try to figure out what I'm doing wrong.
If it doesn't work for you either, I can save myself the time and wait for a solution/alternative.
0
- ago
#26
Hi MIH, we had a few other issues in the queue that we've been working through, so I haven't had a chance to test this yet, but will set up a run tomorrow morning before market open and report back.

I read through the encyclopedic thread again, and want to summarize: you're looking for a way to start the strategy in the SM at some point PRIOR to market open, let's say make a 9:29 run, in order to use the pre-market bar information to place an order at 9:30.
0
MIH7
- ago
#27
QUOTE:
... you're looking for a way to start the strategy in the SM at some point PRIOR to market open, let's say make a 9:29 run, in order to use the pre-market bar information to place an order at 9:30. ...


Thank you for the feedback. Yes, i want to place an order with the opening, eg. at 0930.

1. In particular, "bracket orders", like a stop-loss order (no prior information/bars required).

2. Preferably any order type that can otherwise be generated with WL. Intraday orders would then also have to take into account pre/post market bars for the calculation. In other words, we are talking about pre/post market trading with a defined time window.

Example1: 0930 to 1600 (0930 included)
Example2: 0800 to 1700 (0800 included)
Example3: 0400 to 2000 (0400 included)
0
- ago
#28
I'm working to extend the SM to allow pre/post market operation, it's currently locked to market hours only. Once my change is complete you'll be able to operate a Strategy in the SM in pre/post market, but if you want to restrict orders to within a specific time window it'll need to be done in code or the blocks.

I think this is preferable to having to create a new customized Market, because even with said Market, it's not inherently tied to the underlying data provider so getting the history will still be stuck with pre/post market data filtered out.

Let's see how this change works in the next build.
0
MIH7
- ago
#29
The preferred way via a modified market would of course be good if I can get it to work :-). Here are a few details about the setup.

I use IB and have tried the initial 30 minute time frame and also 5 minute time frame. I think the information could play a role to test for 0930.
0
Cone7
- ago
#30
I'm trying to avoid this discussion, but I feel that the implementation discussed is not going to produce the desired result, which I think is MAINLY this INTRADAY Scenario:

U..S. Market hours-only trading
Your strategy runs at 1600 and signals 20 orders for the NEXT BAR, which is tomorrow at 0930. There is no way to keep these 20 orders active because they'll be canceled by the Day TIF.

The only way currently to place these orders tomorrow is to run the strategy in a Strategy Window, select the signals, and Place them. Obviously this preempts the Auto-Trading function.

If you allow PREMARKET trading, PRE/POSTMARKET bars will appear in the BarHistory. The orders that were signaled at 1600 will NOT signal again for 0930 if there is even a single PRE/POST bar. Is that what you want?

-----
In my judgement, any regular-session-only intraday trader that needs to act on the signals from 1600, wants an option to place those orders pre-market the next day. To do it, the strategy needs to be activated and executed before 0930 the next day so that the signals from yesterday's closing bar appear. (Be careful if you have checked the Pre/Post Trading Preference.)
0
MIH7
- ago
#31
Hello Cone, thank you for coming back into the discussion!

QUOTE:

If you allow PREMARKET trading, PRE/POSTMARKET bars will appear in the BarHistory. The orders that were signaled at 1600 will NOT signal again for 0930 if there is even a single PRE/POST bar. Is that what you want?


I do not want to activate necessarily Pre/Post Market Trading.

1. what I want to avoid in any case is that there is an interruption of the bracket orders (SL/TP) that protect the main order. Between 0930 and 1000 these orders are not placed and there are no guards. There is no need for a single historical bar to do this. (Am I missing something here?)

2. I agree with you that if only incomplete pre-market data is available, it must be weighed very well whether it makes sense. If you come to the conclusion (for yourself) that you want to do this, it should be technically possible. I am unsure about the following point.

What interests me is, when you trade the pre/post market and data is streamed, aren't the associated bars requested. What I'm getting at is, historical data may be incomplete for backtesting, but in trading those bars are supplied, aren't they?
Is the incompleteness a backtesting or a trading problem?

3. Just because it comes to my mind when you write that a signal is no longer sent. I think in such a case the existing order should not be cleaned up either. Currently, the SL order is deleted at 1600 and no new one is created. Also not at 0930 with market start. (Hopefully i do not misunderstand this specific point).

Finally, the first point has a completely different context than the second. In the first case, I want to protect an existing position continuously. Currently, there is always an interruption at the beginning of the market. Depending on the time units, the effect varies. 30 minutes are clearly different from one minute. Perhaps we can focus on point 1 first.

Thank you.

0
- ago
#32
OK so the primary issue is the inability to place/maintain the protective stop/limit exits for an overnight order in intraday trading.
0
Cone7
- ago
#33
^^ Yes ^^

(what I had just written without seeing Glitch's response #32...)
The problem is that Glitch is going to make it so that premarket data is allowed into the equation, and I'm sure you do not want that for the regular trading hours (RTH) scenario.

I want to be very specific about one scenario - the RTH scenario - so we don't keep getting confused. You (we) want to be able to activate the orders generated on the last bar (1600) yesterday at 0930 today. This is what you stated here:

<<what I want to avoid in any case is that there is an interruption of the bracket orders (SL/TP) that protect the main order. Between 0930 and 1000 these orders are not placed and there are no guards.>>

Forget about anything else, because nothing else about pre/post market should be involved with solving this RTH issue.
0
- ago
#34
So, assuming you have an open position, and your intraday strategy is maintaining a stop order.

At 16:00 the strategy should fire and place the continuation of the stop order.

Is the problem that the broker closes these orders because they are "day only?"

I'm just trying to get to the bottom of exactly what's happening in this case, and I'll mock something up for market close today.
0
Cone7
- ago
#35
QUOTE:
Is the problem that the broker closes these orders because they are "day only?"
I know I should wait for MIH to answer, but I can't help myself :)

The answer is yes. A GTD (good-to-date) or even GTC order would work for the stop/limit case. However, for a Market order scenario, there would be no solution other than to regenerate the orders the next morning.

---
Something that just occurred to me...
What about converting the 1600 Auto-Placed orders to a Staged status? Then we would just need a way to recall them the next day and they could be placed with a click.
0
MIH7
- ago
#36
@Cone

Yes, let us focus on the RTH (stop/limit) context until it has been solved.

QUOTE:

QUOTE:
Is the problem that the broker closes these orders because they are "day only?"


I am not sure about it at this point. I say this because the SL order already disapears at 1600 which is not the end of the day. I might be wrong. I see three scenarios.

1. the broker closes the order before market opening ("day only")
2. the broker does not accept the order with market close
3. the signal is not submitted at all

Perhaps all three points need to be considered for it to work properly.

QUOTE:

The answer is yes. A GTD (good-to-date) or even GTC order would work for the stop/limit case. However, for a Market order scenario, there would be no solution other than to regenerate the orders the next morning.


I would like to see this approach as a solution (maybe as default for stop/limit case)

Hower, this seems to be the natural way to solve it. It does not go hand in hand with WL design that orders are deleted and renewed,
BUT it is imho the right approach for this order type.

QUOTE:

Something that just occurred to me...
What about converting the 1600 Auto-Placed orders to a Staged status? Then we would just need a way to recall them the next day and they could be placed with a click.


A click is already to much :-), simply because i am not available at market opening in general. The stop/limit scenario should work full automated. Your idea might already work if you add an option like "place staged orders at market opening", and the "click" will be simulated. (this would already address any order type not the stop/limit scenario only)

Note

However the solution in the stop/limit scenario will look like, i think it is important that it should work for modified market times too.
I note that because the RTH context is related to the market hours in WL afaik.


0
- ago
#37
It looks like this will involve some more thought, design, and internal discussions. Cone seems to have a good handle on the issues and we'll do our best to figure out the best solution. But one clarification ...

"Hower, this seems to be the natural way to solve it. It does not go hand in hand with WL design that orders are deleted and renewed"

Orders aren't deleted and renewed unless there was a change, for example a different stop price or quantity. If everything about the order remains the same from bar to bar in an intraday auto-trading scenario then the stranding orders aren't canceled and replaced. Their timestamp is just updated in the Order Manager.
0
MIH7
- ago
#38
QUOTE:

Orders aren't deleted and renewed unless there was a change, for example a different stop price or quantity. If everything about the order remains the same from bar to bar in an intraday auto-trading scenario then the stranding orders aren't canceled and replaced. Their timestamp is just updated in the Order Manager.


Thanks for pointing that out.
I've seen this topic pop up in several threads and I've also read your statement before.

How does this work together with you statement in
https://www.wealth-lab.com/Discussion/Cancel-placed-order-at-broker-via-code-8080 post #3 ?



My understanding was that even if the order remains identical, a signal must also be generated and transmitted, otherwise the order will be cancelled at the broker. Or is the action cancel/renew to be considered differently in the order manager and the broker?

Sorry if I am confused at the moment.
0
- ago
#39
That's right, the Strategy works by issuing orders on a bar by bar basis, there's no concept of a good til canceled order type.

BUT - in practice the WL Order Manager does not cancel and replace such orders during auto trading. It keeps the live order open with the broker as long as nothing has changed with it.

Sorry for the confusion.
0
- ago
#40
I believe the issue is that WL doesn't keep re-submitting these standing orders to the broker unless they change. So, if you have a position open, with a stop loss in place, and that stop loss doesn't change, WL won't cancel/replace the order. BUT - the broker will cancel the "Day" order after market close of that day. We'll come up with a solution for this.
0
MIH7
- ago
#41
Hello Glitch, Hello Cone, thank you.

I have a question for a better understanding on day orders in the context of RTH.
I think I have looked at this point too superficially.

RTH (WL)
is defined for the market hours in the market someone uses, so if someone defines a market from 0800 to 1700, RTH is related to that time frame. Is that right?

Day Order (RTH)
If the example is right, then what is the day order in WL and what is a day order at the broker. Looking at the US market 1600? 2000? 1700?

The point I realize now is that the problem can also be created on the broker side, or must be considered additionally. Well, the role of the broker plays a bigger role in this scenario than I first thought, at least if the market open signals are generated from the previous market close.

In this case, an order would not survive until the next market opening, even though WL has already sent a signal.
So, there is of course no reason from WL's point of view to send the signal again.

Now, if you create a GTC (with market close), you also need to specify on the broker side that orders are accepted outside RTHs.

Do you think you can cache the market close signals and fire them again when the market opens if you focus only on the RTH?
(I'm intentionally leaving out the question of whether you should avoid using pre/post bars with a "delayed" signal, which intuitively suggests itself to me at the beginning of the topic.).

ADDED

When thinking about it, caching the signals at the market close and placing them at the market open would remove all obstacles on paper.

1. the dependence on how the broker handles it would be eliminated.
2. self-defined market times ("RTH") can be solved in the same way.
3. Pre/Post Market hours trading can be handled that way too.
3. stop/limit/market order type can also be solved in the same way.

The GTC type for stop/limit orders would still be useful so that open positions are accompanied regardless of how the software (WL) is started.
0
Cone7
- ago
#42
RTH are the Regular Trading Hours of the exchange (NYSE, CME, GLOBEX, etc.). The hours you set in WL should reflect exchange hours because they're used to filter chart data and set the schedule for the Strategy Monitor, for example.

We're looking at placing the RTH orders that are signaled on the last bar after the session closes. (The Pre/Post Trading Preference must NOT be enabled, otherwise the orders would be live in the Post market session.)

For IB, we're not sure what the cutoff is, but you can't place orders for the next day immediately after the market closes - they are rejected. It appears that about 15 to 20 minutes after the close IB starts accepting orders for the next session.
0
MIH7
- ago
#43
Ok, thanks for the feedback.

QUOTE:

RTH are the Regular Trading Hours of the exchange (NYSE, CME, GLOBEX, etc.). The hours you set in WL should reflect exchange hours because they're used to filter chart data and set the schedule for the Strategy Monitor, for example.


It is now self-explanatory that pre/post market times are outside the RTH, depending on the market you choose
or configure based on the exchange times.

What about the Pre/Post Market Data filter in the backtest, what market times does the filter refer to?
Is there a setup i overlooked so far?
0
Cone7
- ago
#44
Every symbol has a Market assigned; the default is "US Stocks". Data Providers are made to assign markets when they can be determined by the symbol/contract. If you need to override the market, then you do it in Markets and Symbols.
0
MIH7
- ago
#45
QUOTE:
Every symbol has a Market assigned; the default is "US Stocks". ...

Great, thank you very much. That was not on my radar.
0
- ago
#46
We have a plan for this now, and we’ll start working on it as soon as the next build is released. It’s too involved to get into this upcoming build, but will be in the following one 🙂
0
MIH7
- ago
#47
Great news! Thanks.
0
- ago
#48
As you start working on it, please have in mind also for Future Trading.

Right now it's completely out of sync Pre/Post Market with the Actual hours set in the Symbol/Market Table
0
Cone7
- ago
#49
QUOTE:
Right now it's completely out of sync Pre/Post Market with the Actual hours set in the Symbol/Market Table
Please cite a specific example, because we're not even aware of a problem there.

Note - you have to make sure that the market is correct when you configure the item in the Strategy Monitor.

0

Reply

Bookmark

Sort