Place order from indicator in TradeStation Easylanguage
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.
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.
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.
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: