hello,
i have a signal placing orders:
Buy ("b1") MyShares contracts next bar at open limit;
i attached this signal to a 1 min bar chart and
switched intrabar order generation on.
however, my orders are always generated at open of 1 min bar.
any ideas what's going wrong ?
thank you
intrabar order generation question
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Hello TJ,
thanks for anwer.
i tried your suggestion and found my orders still placed at open
(next bar).
i'd like to have a limit order placed (and as assumed as fill from backtest)
once i initiate it.
say my 1 min bar is open = 5 and close = 20 and min move=1
and my order price is 13, i like this order placed at this bar at 13
and not next bar open.
is this possible at all ?
thanks for anwer.
i tried your suggestion and found my orders still placed at open
(next bar).
i'd like to have a limit order placed (and as assumed as fill from backtest)
once i initiate it.
say my 1 min bar is open = 5 and close = 20 and min move=1
and my order price is 13, i like this order placed at this bar at 13
and not next bar open.
is this possible at all ?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
in your original post,Hello TJ,
thanks for anwer.
i tried your suggestion and found my orders still placed at open
(next bar).
i'd like to have a limit order placed (and as assumed as fill from backtest)
once i initiate it.
say my 1 min bar is open = 5 and close = 20 and min move=1
and my order price is 13, i like this order placed at this bar at 13
and not next bar open.
is this possible at all ?
How does the open come into play?
Buy ("b1") MyShares contracts next bar at open limit;
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Hello TJ,
thanks for anwer.
i tried your suggestion and found my orders still placed at open
(next bar).
i'd like to have a limit order placed (and as assumed as fill from backtest)
once i initiate it.
say my 1 min bar is open = 5 and close = 20 and min move=1
and my order price is 13, i like this order placed at this bar at 13
and not next bar open.
is this possible at all ?
what do you mean by close = 20 ?
do you mean the previous close?
or do you mean the current price?
How role does it play in the formula you are working on?
the open comes into play - as i assume - as any possible
price between current bar open and current bar close.
this is because i thought that intradaybar generation allows
calls the script for each possible price between bar open and bar close.
sample:
the 1 min bar is open=5 and close = 8
then, i think, the script is called 4 times with open=close
open=5
open=6
open=7
open=8
assume at 2nd call for this bar (open=6) my calc. says place
limit, then i like the system to place a limit order at 6 (and assumes its
getting filled)
price between current bar open and current bar close.
this is because i thought that intradaybar generation allows
calls the script for each possible price between bar open and bar close.
sample:
the 1 min bar is open=5 and close = 8
then, i think, the script is called 4 times with open=close
open=5
open=6
open=7
open=8
assume at 2nd call for this bar (open=6) my calc. says place
limit, then i like the system to place a limit order at 6 (and assumes its
getting filled)
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Hello TJ,
ok, i think i understand this now: if intradaybar update enabled, open
of each script call for bar x is fix and the same as the open
for the "historical" (completed) bar.
Where close can be each price within the bar, high and low included.
Whati need, is to enable the script to place a limit order at the current
(real time simulated) close and if possible the backtest system
assumes this orders as filled.
Is this possible ?
ok, i think i understand this now: if intradaybar update enabled, open
of each script call for bar x is fix and the same as the open
for the "historical" (completed) bar.
Where close can be each price within the bar, high and low included.
Whati need, is to enable the script to place a limit order at the current
(real time simulated) close and if possible the backtest system
assumes this orders as filled.
Is this possible ?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
you don't need the intrabarordergeneration.Hello TJ,
ok, i think i understand this now: if intradaybar update enabled, open
of each script call for bar x is fix and the same as the open
for the "historical" (completed) bar.
Where close can be each price within the bar, high and low included.
Whati need, is to enable the script to place a limit order at the current
(real time simulated) close and if possible the backtest system
assumes this orders as filled.
Is this possible ?
all you need is
Buy ("b1") MyShares contracts next bar at open;
"next bar at open" is equivalent to saying:
buy at the closing price of this bar.
.
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
The difference between buying "next bar at open" and "this bar at close" is that the former is in general possible, while the latter is in general impossible (although it can be sort of approximated with a bunch of extra code and intrabar order generation - see below).
If you think about it, there's no way to ACTUALLY buy at this bar's close, because by the time you know what the closing price is, the bar is already closed. (Yes, you can approximate it by doing things like looking at the time, counting ticks, etc... but it's always an approximation, and your test results are always suspect. If you're going to do this, it's generally better to simply use a smaller bar such as 1 minute instead of 60 minutes, and buy at the open of the last 1 minute bar in the 60 minutes.) So, while it's convenient in terms of making models that "test well" to do buy "this bar at close", it's generally a bad idea in terms of making systems that are capable of being taken live in a way that's productive, and at the risk of overgeneralizing, often tends to be a wrong turn on the system development path in that it's a way to make things that "test well" but with results that may be suspect.
If you think about it, there's no way to ACTUALLY buy at this bar's close, because by the time you know what the closing price is, the bar is already closed. (Yes, you can approximate it by doing things like looking at the time, counting ticks, etc... but it's always an approximation, and your test results are always suspect. If you're going to do this, it's generally better to simply use a smaller bar such as 1 minute instead of 60 minutes, and buy at the open of the last 1 minute bar in the 60 minutes.) So, while it's convenient in terms of making models that "test well" to do buy "this bar at close", it's generally a bad idea in terms of making systems that are capable of being taken live in a way that's productive, and at the risk of overgeneralizing, often tends to be a wrong turn on the system development path in that it's a way to make things that "test well" but with results that may be suspect.