orders only passed at the closing of the candle?
Forums › ProRealTime English forum › ProOrder support › orders only passed at the closing of the candle?
- This topic has 24 replies, 6 voices, and was last updated 9 months ago by Wim.
-
-
03/31/2024 at 12:13 PM #230780
Hi everyone,
I am working on the DAX with 15mn candles. I have “sell” and “exitshort” instructions written as “if close crosses over… then “.
When running the backtest I see that the timestamps for those orders is always at round quarter-hour times like 10:15, 11:45 etc. Obviously, I want it to sell/exitshort at the best time anytime, not to wait for the closing of each candle. I have tried replacing those instructions with simpler “set profit” and “stop loss” but the report still shows round quarter-hour times for each order. Is it just an artefact of the backtest where it shows the time of the candle and not the precise time inside the candle? Or does ProOrder really only pass orders at the close of each candle, which would obviously be a big problem? How can I ensure that orders are passed at the optimal time?
Thanks a lot!
03/31/2024 at 12:27 PM #230781Hi juld,
This is indeed an anomaly of how the backtest results show; hover with your mouse over the exit crosses and you will see the real time. But of course only when in-bar exit is implied (like with the examples you talk about).
Regards,
Peter03/31/2024 at 12:32 PM #230782You need to use Multiple Time Frames.
Use both the 15-miniute and 1-minute TFs, the first one for the setup conditions and the latter as the main TF, the one on the chart, that sets the pace at which the strategy is executed.
Searching this forum for MTF, acronym for Multi Time Frame, will return many links to articles, instruction and tons of code to help you master it.
03/31/2024 at 12:43 PM #230783Perhaps in addition to Roberto:
If you use a time frame of 15 minutes, then indeed all orders will be executed on the “Open” of the next candle because the algo is always executed on the “Close” of the candle (so every 15 minutes) …
If you don’t want to wait, in this case fifteen minutes, you can use multiple time frames, for example a combination of a 1-minute time frame with a 15-minute time frame…
In the time frame of 15 minutes, you can then determine the conditions, for example “If Close crosses over… then” and have these conditions executed in a time frame of 1 minute (or even 1 second), your “waiting time” has now been reduced to a maximum of 1 minute…
So, the solution may be to use multiple time frames…
03/31/2024 at 12:51 PM #230784I have tried replacing those instructions with simpler “set profit” and “stop loss” but the report still shows round quarter-hour times for each order.
No need for other timeframes when that is used. And that is what I was referring to.
But of course only when in-bar exit is implied (like with the examples you talk about).
03/31/2024 at 1:14 PM #23078503/31/2024 at 1:24 PM #230786“set profit” and “stop loss” but the report still shows round quarter-hour times for each order. Is it just an artefact of the backtest where it shows the time of the candle and not the precise time inside the candle?
Good point! Depends where / what you are looking at … maybe post an example?
Set Stop pLoss for example would set a pending order at P points loss and this Order would execute at whatever price meets the P points loss … it would not wait until the end of a 15 minute candle (for example) to execute the P points loss exit.
03/31/2024 at 2:10 PM #230787This would be the (simple) code for working with two-time frames:
TimeFrame(15 min)
If Close crosses over… then
LongCond=1
Else
LongCond=0
EndIf
TimeFrame(1 min)
If LongCond=1 then
Buy x contracts at Market
EndIf
I’m very curious about a code that does the same thing but only based on (special) orders…
03/31/2024 at 2:24 PM #230788Is it just an artefact of the backtest where it shows the time of the candle and not the precise time inside the candle?
Yes … the backtest equity curve can only show the candles on which it is based, e.g. 15 mins chart TF will show 15 min candles and therefore a Set Stop PLoss exit at end of a 15 minute candle.
You need to look in your ‘Closed Position List’ to see the exact time that the Set Stop PLoss Pending Order closed the trade.
03/31/2024 at 3:02 PM #230789You need to look in your ‘Closed Position List’ to see the exact time that the Set Stop PLoss Pending Order closed the trade.
🙂 Which is not there during a Backtest. 🙂
That’s why I said “Hover the Exit cross”.See below, although that is from Live. There’s no difference with a Backtest.
03/31/2024 at 3:37 PM #230792Thanks for you quick and detailed replies! I understand that in backtest at least I will not get the results I want. I have to do a realtime test on my demo account to see how each robot behaves live. And of course, this question came to me right on the longest weekend where all the places are closed for 4 days… We’ll see on Tuesday. IF only “set profit” and “stop loss” instructions operate in real time and not more subtle instructions like “if price goes over x” at any moment (since “price” is not a command, only “close” then it’s an issue, because even a 1-min time frame is too large for what we’re doing.
I’ll test on Tuesday and let you know.
03/31/2024 at 4:44 PM #230798Hi juld – I don’t know where you got it from that you can’t test this in backtest … was it from something we said ? then this was not intended. If from elsewhere :
You can test all in backtest, although the results may not be 100% equal, depending how thoroughly you constructed your backtesting (e.g. take into account the spread as good as possible, etc. etc.).03/31/2024 at 6:43 PM #230802Which is not there during a Backtest
Why do you say that … see attached at yellow arrowheads.
03/31/2024 at 7:16 PM #230804Maybe adding to the confusion, but . . . I normally exit my positions using set stop loss, take profit and also breakeven. Just to not have to wait for the opening of the next candle. My backtest detailed report, however, shows exact candle start times. When I look at the little triangles on the chart that indicate exit levels, they show me the correct stop loss, take profit and breakeven levels. They are NOT at the open of a candle. So I don’t bother about the timing data in the backtest detailed report. I only care whether the desired levels are respected, and they are.
03/31/2024 at 8:27 PM #230808Why do you say that … see attached at yellow arrowheads.
What a crazy loop this is. 🙁
Why ? because – like Wim says – that shows exact candle times. Did I show an exact candle time ? no. Or should I have added that this is just 1 minute TF I showed ?Or you, or me have eaten too many eggs. But I’ll get rid of those tonight (don’t tell my wife yet). So maybe tomorrow is a better day.
No wait … two Easter days here. More eggs to come !
- The Detailed Report from Backtesting only shows exact candle times (this is wrong).
- The chart does show the real times (up to the second), not matter how you arranged for that. But you should explicitly arrange for it because a Market Order won’t do that, unless slippage; then a Market Order will do that too.
-
AuthorPosts
Find exclusive trading pro-tools on