NexusFi: Find Your Edge


Home Menu

 





Intra bar order @ pre determined time


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one jay j with 3 posts (0 thanks)
    2. looks_two Keystone with 2 posts (0 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 RM99 with 1 posts (1 thanks)
    1. trending_up 5,987 views
    2. thumb_up 2 thanks given
    3. group 5 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread

Intra bar order @ pre determined time

  #1 (permalink)
jay j
connecticut
 
Posts: 3 since Jul 2011
Thanks Given: 2
Thanks Received: 0

could anyone help me on how to do an intra bar code for opening a breakout order a certain number of pips above/below current market price 3 seconds before a particular established time in TradeStation Easy language? I would be greatful, thank you in advance.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Deepmoney LLM
Elite Quantitative GenAI/LLM
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
GFIs1 1 DAX trade per day journal
18 thanks
The Program
18 thanks
  #3 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704



jay j View Post
could anyone help me on how to do an intra bar code for opening a breakout order a certain number of pips above/below current market price 3 seconds before a particular established time in TradeStation Easy language? I would be greatful, thank you in advance.

I'm assuming you want a breakout bracket (with a buy and a sell order that cancels). I've included the code for minute resolution. As far as getting down to the second resolution, you'll need some help from there (I dunno). The inputs include the time at 10:00 a.m. and a number of ticks at 3.

[intrabarordergeneration = true]
inputs: timetrigger(1000), pricebreakgap(3);
variables: pricebreakup(0), pricebreakdown(0);

pricebreakup = currentask + (pricebreakgap*(minmove/pricescale));
pricebreakdown = currentbid - (pricebreakgap*(minmove/pricescale));

If marketposition=0 and time >= timetrigger then begin
Buy next bar at pricebreakup limit;
Sellshort next bar at pricebreakdown limit;
end;

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
Thanked by:
  #4 (permalink)
jay j
connecticut
 
Posts: 3 since Jul 2011
Thanks Given: 2
Thanks Received: 0

I do need it down to the second, but nevertheless I greatly appreciate your taking the time and the effort to give me the response you did. I thank you for the privilege of your help.

Reply With Quote
  #5 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,536


jay j View Post
I do need it down to the second, but nevertheless I greatly appreciate your taking the time and the effort to give me the response you did. I thank you for the privilege of your help.

To best of my knowledge, TradeStation doesn't support resolution more granular than 1 minute. MultiCharts does, if this is a requirement you might check it out.

One possible work around is to track when a new minute bar forms, then concurrently start tracking your local computer time from tick to tick so that you could trigger something at 57 seconds (3 seconds prior to the next minute bar).

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #6 (permalink)
jay j
connecticut
 
Posts: 3 since Jul 2011
Thanks Given: 2
Thanks Received: 0


Big Mike View Post
To best of my knowledge, TradeStation doesn't support resolution more granular than 1 minute. MultiCharts does, if this is a requirement you might check it out.

One possible work around is to track when a new minute bar forms, then concurrently start tracking your local computer time from tick to tick so that you could trigger something at 57 seconds (3 seconds prior to the next minute bar).

Mike

Mike, that is an excellent suggestion and might be the answer. I still think the process can be programeded in T.S. Easy language or in thinking out loud to myself if needed in C++ that T.S. also accepts now. That said you may have the best solution and will put that at the top of the list for now. I am very greatful for the time others offer to help.
Jay

Reply With Quote
  #7 (permalink)
jsoctus
Hartford + CT/United States
 
Posts: 2 since Sep 2013
Thanks Given: 0
Thanks Received: 0

In TradeStation, you can get the current time in minutes an seconds with the BarDateTime function. For example, to determine the time of the current bar, you can use
CurrentBarTime = BarDateTime[0].ELTime + ((BarDateTime[0].Second)/60);
John

Reply With Quote
  #8 (permalink)
 Keystone 
Dallas Texas
 
Experience: Advanced
Platform: Tradestation
Trading: Emini ES, Emini YM
Posts: 12 since Sep 2013
Thanks Given: 0
Thanks Received: 5

Tradestation does support time intervals as low as seconds.

Reply With Quote
  #9 (permalink)
 forward2012 
AUSTIN, TX
 
Experience: Advanced
Platform: Thinkorswim
Trading: stocks
Posts: 4 since Nov 2012
Thanks Given: 0
Thanks Received: 0

I modified the code to close it at 14:55 (CST) on 1 minute chart. I have done something wrong, can you please let me know what have I done wrong.

[intrabarordergeneration = true]
inputs: timetrigger_start(0930), timetrigger_end(1455),pricebreakgap(10);
variables: pricebreakup(0), pricebreakdown(10);

pricebreakup = currentask + (pricebreakgap*(minmove/pricescale));
pricebreakdown = currentbid - (pricebreakgap*(minmove/pricescale));

If marketposition=0 and time >= timetrigger_start then begin
Buy next bar at pricebreakup limit;
Sellshort next bar at pricebreakdown limit;
end;

If marketposition = 1 and time = timetrigger_end then begin
Sell next bar at market; end
Else if marketposition = -1 and time = timetrigger_end then begin
Buytocover next bar at market;
end;

Reply With Quote
  #10 (permalink)
 Keystone 
Dallas Texas
 
Experience: Advanced
Platform: Tradestation
Trading: Emini ES, Emini YM
Posts: 12 since Sep 2013
Thanks Given: 0
Thanks Received: 5


It works on my system. Does your session have bars that exceed the end time?

Reply With Quote




Last Updated on October 1, 2013


© 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