Place order from indicator in TradeStation Easylanguage - TradeStation | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation

Place order from indicator in TradeStation Easylanguage
Started:June 9th, 2016 (11:19 AM) by loi5139 Views / Replies:339 / 3
Last Reply:June 15th, 2016 (08:31 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Place order from indicator in TradeStation Easylanguage

Old June 9th, 2016, 11:19 AM   #1 (permalink)
Trading Apprentice
NewYork, NY
Futures Experience: None
Platform: tradestation
Favorite Futures: na
Posts: 7 since May 2016
Thanks: 1 given, 1 received

Place order from indicator in TradeStation Easylanguage

Hi experts,

I'm very new to EZL, so sorry for the stupid question.

I created an indicator that signal buy/sell and plot. The signal is working fine. But, when i get the signal I want to place an order from the indicator itself.

I first tried the function Buy/Sell, EZL tells me that's not allowed in indicator. I tried the macro .PlaceOrder, EZL didn't like it when verified.

Now I used the command LimitOrder, but it returns me as invalid order. Thisi is my code. After much reading and research on the net, i'm still a bit confused as to which command/function can be used in indicator.

Any help is much appreciated.

price_trigger = (High + Low) /2 ;
Plot2 (buy_signal, "Buy");
Plot3 (Price_Trigger, "Price_Entry");

PositionQty = Getnumpositions ("SIM8625555M");
OrderQty = UserQty - PositionQty;

//.PlaceOrder "Action='Buy', OrderType = 'Limit', Quantity = OrderQty, QuantityType = 'Shares', Route = 'Intelligent', Symbol = EquitySymbol, SymbolCategory = 'Equity'"; // TRIED THIS, DIDN'T WORK

OrderValid = LimitOrder ("OncePerBar", "SIM8625555M", "Buy", "Equity", EquitySymbol, OrderQty, "1min", "", Price_trigger);

PauseSellTime = Currenttime + 1.5;
PauseBuyTime = Currenttime + 1.5;
//Playsound ("c:\AirHorn.wav");

If OrderValid = 0 then PauseBuyTime = 1;

Reply With Quote

Old June 13th, 2016, 09:33 AM   #2 (permalink)
Elite Member
Chicago, IL USA
Futures Experience: Intermediate
Platform: MultiCharts + CTS T4
Broker/Data: Advantage Futures,
Favorite Futures: YM, ES, EU, US, S
furytrader's Avatar
Posts: 153 since Jun 2011
Thanks: 109 given, 142 received

As far as I recall, you can't place an order from an indicator. You have to use a signal. Copy and paste the indicator logic into a signal and generate the order from there. If your indicator uses parameters, you need to make sure you update parameters in both the indicator and signal for them to remain consistent.

Reply With Quote

Old June 13th, 2016, 11:08 AM   #3 (permalink)
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,107 since Apr 2013
Thanks: 188 given, 624 received


you are probably better off following furytrader's suggestion and build a signal with similar conditions.

You can send orders out of indicators nowadays using macros and Object Oriented Easylanguage. The latter will likely give you much more control than you have with macros. The downside is both methods will only work realtime and at least OOEL will require advanced coding skills and therefore it's much harder to track down any problems (especially when starting out).

From your code it's hard to tell - I am not sure if "1min" is a valid duration for the order. You might want to try "GTC" or "DAY" in your testing.



Reply With Quote

Old June 15th, 2016, 08:31 PM   #4 (permalink)
Trading Apprentice
NewYork, NY
Futures Experience: None
Platform: tradestation
Favorite Futures: na
Posts: 7 since May 2016
Thanks: 1 given, 1 received

Hi All,

Thanks for the answers. This is what i found and i hope it helps some future noobs like me.

So, i did some research and like you said it turns out that you can't use that macro command or any other buy/sell commands from an indicator, it can be used on strategies only. No matter what other people says on the net. I tested all the options at long and large.

I realized that macro commands and such are not prefered methods by TS. They encourage to use the Providers Object/Class. Which can/must be added to the code from the toolbox in TS Development Envi.

This works really well in indicator, must add the providers class and init them:

PositionQty = GetPositionQuantity (UserSymbol,UserAccount);
OrderQty = UserQty - PositionQty;
OrderTicket1.Symbol = UserSymbol;
OrderTicket1.LimitPrice = Price_Trigger;
OrderTicket1.Quantity = OrderQty;
OrderTicket1.Type = 1; //Limit=1, Market =2
OrderTicket1.Action = 1; //Buy=1 , Sell=2
OrderTicket1.send ();

I use the GetPositionQty command to get the position qty. There is a better way to do that with the providers class PositionsProvider. Supposedly it is a better method.

However, I was not able to make that work with the the OrderTicket class. When using both, it crashes my TS. I can only use either or.

Hope the information noobs like me to save some time in the future.

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > Place order from indicator in TradeStation Easylanguage

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Place Order just once in a candle raghavan AmiBroker 2 July 5th, 2015 02:36 AM
TradeStation - How to place an order of GTC duration veeyem TradeStation 5 September 9th, 2014 05:12 AM
TradeStation EasyLanguage RadarScreen Indicator Code kitewind TradeStation 3 May 23rd, 2014 05:59 AM
Place text at order entry/exit bar ivanyu EasyLanguage Programming 2 August 5th, 2013 06:20 AM
Is the best way to place a buy limit order by using DOM shots fired ThinkOrSwim 13 April 26th, 2013 05:31 PM

All times are GMT -4. The time now is 10:00 AM.

Copyright © 2016 by 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.
no new posts

Page generated 2016-10-25 in 0.09 seconds with 27 queries on phoenix via your IP