NexusFi: Find Your Edge


Home Menu

 





Intrabar Order Generation not working


Discussion in TradeStation

Updated
    1. trending_up 517 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Intrabar Order Generation not working

  #1 (permalink)
timfel
London, UK
 
Posts: 19 since Mar 2023
Thanks Given: 5
Thanks Received: 1

As I understand it, if you enable Intrabar Order Generation, then buy or sell at next bar instructions execute at the next tick, rather than the next bar — this is what I want to happen.

However, I have done this, both by stating it in the code and turning it on in the strategy settings and backtesting settings, and it is only executing on the next bar.

On the 5 min chart, all entries and exits (stop loss and TP orders) are happening in 5 minute increments, when they should be happening at all times. Also the order is executing at the next bar open price, rather than the signal price.

Any ideas?

Code fragment:

 
Code
	  
If (T > RangeEnd) AND (T < LastOrders)  AND (TradeCount < MaxTrades) AND (Marketposition = 0) Then	  
	Begin	  
		If H crosses over RangeHigh Then  
			Begin  
				Buy ("Long") next bar at Market;  
				TradeCount = TradeCount + 1;  
			End;  
		  
		If L crosses under RangeLow  Then  
			Begin  
				Sellshort ("Short") next bar at Market;  
				TradeCount = TradeCount + 1;  
			End;  
			  
			  
		  
  
	End;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
77 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Just another trading journal: PA, Wyckoff & Trends
38 thanks
Bigger Wins or Fewer Losses?
24 thanks
The Program
17 thanks
  #2 (permalink)
RandyK0615
Grand Junction, CO
 
Posts: 4 since Mar 2022
Thanks Given: 0
Thanks Received: 1

Are you using intrabarpersist variables? If not, that might be your problem. Also be sure you have things set to
"update every tick".

Reply With Quote
  #3 (permalink)
timfel
London, UK
 
Posts: 19 since Mar 2023
Thanks Given: 5
Thanks Received: 1



RandyK0615 View Post
Are you using intrabarpersist variables? If not, that might be your problem. Also be sure you have things set to
"update every tick".

Yes I have used intrabar persist. What it appears on further investigation is that the trades are actually executing intrabar, but they were only being reported on bar close, which is why they were all at multiples of 5 minutes, even though they were actually being executed at all times. Presumably, if that is the case, this must be a well known phenomenon that everybody using intrabar has experienced.

Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

timfel,

this is expected behavior. The report will only show the ending timestamp of the bar, but the prices of the fills which could be intrabar.
The same goes for your code by the way. TS will not expose the intrabar times of a bar for timebased bars, but only the ending timestamp.

Regards,

ABCTG


timfel View Post
Yes I have used intrabar persist. What it appears on further investigation is that the trades are actually executing intrabar, but they were only being reported on bar close, which is why they were all at multiples of 5 minutes, even though they were actually being executed at all times. Presumably, if that is the case, this must be a well known phenomenon that everybody using intrabar has experienced.


Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on April 11, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts