NexusFi: Find Your Edge


Home Menu

 





TradeStation - How to place an order of GTC duration


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one ktrader with 2 posts (2 thanks)
    2. looks_two veeyem with 2 posts (0 thanks)
    3. looks_3 JimFeyn with 1 posts (0 thanks)
    4. looks_4 SammyD with 1 posts (0 thanks)
    1. trending_up 7,365 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

TradeStation - How to place an order of GTC duration

  #1 (permalink)
 veeyem 
Singapore Singapore
 
Experience: Intermediate
Platform: TradeStation
Broker: TS
Trading: GOLD
Posts: 13 since Dec 2011
Thanks Given: 15
Thanks Received: 1

I am trying to place an order thru a Strategy. The order submitted is defaulted to "DAY" duration. Which means it will get cancelled by end of the day. I am using range chart and hence each bar may span between days. I want to place the order with the duration GTC (Good to Cancel). Thx in advance.

Code used to place the order.
Buy "OrdName" 1 Contracts NEXT BAR AT High+0.01 Stop

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #2 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


veeyem View Post
I am trying to place an order thru a Strategy. The order submitted is defaulted to "DAY" duration. Which means it will get cancelled by end of the day. I am using range chart and hence each bar may span between days. I want to place the order with the duration GTC (Good to Cancel). Thx in advance.

Code used to place the order.
Buy "OrdName" 1 Contracts NEXT BAR AT High+0.01 Stop

You can use the OrderTicket object, i have included all properties you can set here

You only need to set the few you want to use.

Its the Duration field you want to change in your case, its a string containing the duration, like "DAY", "GTC", "GTC+", "30 min" etc. you can find the complete documentation in the easylanguage object reference.


 
Code
	var: tsdata.trading.OrderTicket OrderTicket1( NULL );

		OrderTicket1 = new tsdata.trading.OrderTicket;
		
		OrderTicket1.SymbolType = tsdata.common.SecurityType.stock;
		OrderTicket1.Quantity = 100;
		OrderTicket1.Action = tsdata.trading.OrderAction.Buy;
		OrderTicket1.Type = tsdata.trading.OrderType.market;
		OrderTicket1.Duration = "Day";
		OrderTicket1.LimitPrice = 0.0;
		OrderTicket1.LimitPriceStyle = tsdata.trading.PriceStyle.none;
		OrderTicket1.LimitPriceOffset = 0;
		OrderTicket1.StopPrice = 0.0;
		OrderTicket1.StopPriceStyle = tsdata.trading.PriceStyle.none;
		OrderTicket1.StopPriceOffset = 0;
		OrderTicket1.ActivationRules.UseActivationTime = false;
		OrderTicket1.ActivationRules.UseDeactivationTime = false;		
		OrderTicket1.TrailingStop = tsdata.trading.TrailingStopBehavior.off;
		OrderTicket1.TrailingStopAmount = 0.0;
		OrderTicket1.IfTouched = false;
		OrderTicket1.IfTouchedPrice = 0.0;
		OrderTicket1.IfTouchedPriceStyle = tsdata.trading.PriceStyle.none;
		OrderTicket1.IfTouchedPriceOffset = 0;
		OrderTicket1.ShowOnly = false;
		OrderTicket1.ShowOnlyQuantity = 0;
		OrderTicket1.ECNSweep = false;
		OrderTicket1.NonDisplay = false;
		OrderTicket1.Discretionary = false;
		OrderTicket1.DiscretionaryAmount = 0.0;
		OrderTicket1.BuyMinusSellPlus = false;
		OrderTicket1.Peg = tsdata.trading.PegBehavior.off;
		OrderTicket1.AllOrNone = false;
		OrderTicket1.ConvertInvalidStopToMarket = false;
		OrderTicket1.Name = "OrderTicket1";

Reply With Quote
Thanked by:
  #3 (permalink)
 veeyem 
Singapore Singapore
 
Experience: Intermediate
Platform: TradeStation
Broker: TS
Trading: GOLD
Posts: 13 since Dec 2011
Thanks Given: 15
Thanks Received: 1


Awesome. Thx for the quick response with the solution.

BTW, I had a chat with the TS technical helpdesk on this. They mentioned that the "DAY" order will be closed by end of the session. However, when the session starts again, the same "DAY" order will be placed again automatically. This will happen even though the RANGE bar is still in the midst of completing the range. I am now testing this in the SIM account. Will share the outcome here.

The code you shared gives great deal of flexibility when placing the order. Appreciated.

Started this thread Reply With Quote
  #4 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


veeyem View Post
Awesome. Thx for the quick response with the solution.

BTW, I had a chat with the TS technical helpdesk on this. They mentioned that the "DAY" order will be closed by end of the session. However, when the session starts again, the same "DAY" order will be placed again automatically. This will happen even though the RANGE bar is still in the midst of completing the range. I am now testing this in the SIM account. Will share the outcome here.

The code you shared gives great deal of flexibility when placing the order. Appreciated.

Great you can use it..

I forgot to mention you have to call send() on the orderticket object to actually place the order - a minor but important detail

Reply With Quote
  #5 (permalink)
 SammyD 
Salt Lake City, Utah
 
Experience: Intermediate
Platform: NinjaTrader, Tradestation
Trading: Forex
Posts: 72 since Feb 2011
Thanks Given: 274
Thanks Received: 36


veeyem View Post
Awesome. Thx for the quick response with the solution.

BTW, I had a chat with the TS technical helpdesk on this. They mentioned that the "DAY" order will be closed by end of the session. However, when the session starts again, the same "DAY" order will be placed again automatically. This will happen even though the RANGE bar is still in the midst of completing the range. I am now testing this in the SIM account. Will share the outcome here.

The code you shared gives great deal of flexibility when placing the order. Appreciated.

Let us know how that goes. In my experience, with Forex and TS, my stop order has been cancelled at 5pm EST since it is "day" only but when it goes to renew a few seconds later it responds with a "rejected" message (apparently this is due to some lag on the TS side settling for the day). Anyway, this can leave you in a tricky spot so beware. The problem will usually correct itself when the next bar on the Data1 stream closes, prompting the strategy to run again. This is not a big deal if Data1 is small such as 1m or 5m but can be a big deal if it's larger. You can write some object oriented checks as a safety mechanism but I won't go into that.

Reply With Quote
  #6 (permalink)
JimFeyn
Athens, Greece
 
Posts: 3 since May 2013
Thanks Given: 2
Thanks Received: 0

Dear all,

I have used tickets and still using them. Is there any other way to define order duration in Tradestation?

Also, does any of you sets order duration in FX using Tradestation? I don't get access to 1 min duration. Only IOC theoretically can cancel the order soon enough after its deployment.

Thank you

Reply With Quote




Last Updated on September 9, 2014


© 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