Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Platforms that support Intrabar trading for Automated trading
Hi All,
Trying to find out if there are any automated trading plaforms that can do intrabar trading i.e. if a condition is met, a market order gets triggered right away.
I tried to do this extensively with Tradestation but it seems like the intrabar trading can be triggered only in the next bar, and not in the current bar.
Is there any platform that can do this?
Any suggestions are very much appreciated!
AP
Can you help answer these questions from other members on NexusFi?
Tradestation can trigger orders intrabar. If Intrabar Order Generation is enabled either in your script or via the strategy settings the code is computed with every tick and "next bar" order statements in this context mean "next tick".
Avg = AverageFC( Close, 9 );
[Intrabarordergeneration=true]
{Going Long}
if (Close crosses above Avg) then Buy ( "Long" ) next bar at market ;
if (Close crosses below Avg) then Sell ( "LongClose" ) next bar at market ;
{Going Short}
if (Close crosses below Avg) then Sell ( "Short" ) next bar at market ;
if (CLOSE crosses above Avg) then Buy to cover( "ShortClose" ) next bar at market ;
{------------------------------------------}
I am trying to trigger a market order right at the crossover (before the close of the current bar). But I am getting a fill at the next bar open.
Is there something wrong with script?
AP
the script works fine for me and trades are executed intrabar. Did you enable the look inside bar backtesting feature as otherwise intrabar order generation strategies will only be calculated four times per historical bar and not with every tick?
The way you wrote your code you might not see short entries, though, as you are using the incorrect reserved word. Short entry orders are issued using SellShort or Sell Short.
Hi ABCTG,
Thank you for the corrections and the feedback!
I did include [Intrabarordergeneration=true] in the code. The "Enable intrabar order generation and tabulation" looks disabled after adding this. My guess is that including [Intrabarordergeneration=true] has enabled intra bar orders.
If you look at the image below, I would assume that when the bar (in the dotted yellow box) crossing the moving average line a buy order would be triggered.
Which would be right at the 'Avg' value (of 69.15 as you can see below). However the it always seems to enter at the value of the 'close' (69.19).
Hi ABCTG,
This particular one was a 5 minute chart for crude oil futures.
It does enter on the same bar, but typically on the close of the current bar.
I'm trying to see if TS allows an order to get triggered in real time before the close of the bar?
AP
HI ABCTG,
I just tried it in a live trading session and it seems to be working. Didn't seem to work during backtesting. I guess it must be the conditions of trade.
Thank you so much for all your help!!
AP
my pleasure. You need to specifically enable the "Look Inside Bar Backtesting" settings and set a resolution (preferably 1 tick for your test) on the general tab of the strategy properties dialog window.
If you do not enable this feature intrabar order generation strategies will only be calculated four times per historical bar (with Open, High, Low, and Close) and not with every tick and this would explain why you only see fills at those four price points in your historical testing.
Enabling this feature with a one tick resolution should give you a similar behavior to what you are seeing in real time. Not using a resolution of 1 tick will result in the results only being accurate to what ever resolution you set, as the code will only be computed with that frequency on historical bars.