NexusFi: Find Your Edge


Home Menu

 





Using a NinjaTrader strategy for execution in TradeStation


Discussion in Platforms and Indicators

Updated
    1. trending_up 8,005 views
    2. thumb_up 10 thanks given
    3. group 2 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
Search this Thread

Using a NinjaTrader strategy for execution in TradeStation

  #1 (permalink)
 sgjohnson 
Kingsport, Tennessee
 
Experience: None
Posts: 37 since Apr 2020
Thanks Given: 13
Thanks Received: 13

So if I'm reading the NT documentation correctly, you can use a TS strategy for execution in NT 7/8, but not the reverse. What would it take to do the reverse? I like the strategy building in NT over TS but I only have an account at TS, so I'm curious. And yes, I know "get an account at NT" is a valid answer, but I'm still curious.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Futures True Range Report
The Elite Circle
Better Renko Gaps
The Elite Circle
 
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
38 thanks
NexusFi site changelog and issues/problem reporting
27 thanks
GFIs1 1 DAX trade per day journal
19 thanks
The Program
18 thanks
  #2 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,162 since Jan 2013
Thanks Given: 57,341
Thanks Received: 26,267


sgjohnson View Post
So if I'm reading the NT documentation correctly, you can use a TS strategy for execution in NT 7/8, but not the reverse. What would it take to do the reverse? I like the strategy building in NT over TS but I only have an account at TS, so I'm curious. And yes, I know "get an account at NT" is a valid answer, but I'm still curious.

Someone who knows more about TradeStation than I do may want to chime in on this, but here's what I can say.

(I have extensive NT experience in 6.5, 7 and 8, but have not used TS for many years, for what that is worth, and I also have been a professional programmer for a good long time, also for whatever that is worth. )

Your NT strategy builder gives a user a reasonably simple way to specify how the strategy should work, and then the strategy builder creates a program that runs in the platform you are using. What it creates will in very important respects depend on your platform.

I am quite positive that what you want to do is not possible. The reason is simply that every trading platform makes available a certain set of pre-built functionality and has its own way of activating that functionality.

Let me be just slightly technical, and bear with me with the geekiness , but to create a strategy or anything else, you will have to call a certain set of functions, each with its own inputs -- and the function set of NT is not the same as the function set of TS. When I say "not the same," I don't mean that in general they don't do similar things, I mean that if you want a moving average, for instance, in one case you will call a function with one name and one set of inputs, and in the other case it will be another function with different inputs. You will also have a different structure required of the program that your strategy builder will create, and what is required in NT is not the same as in TS. You also have different ways of accessing data, even of naming the data. You also have different programming languages (and even if the languages were the same, the functions and program structure would still be different.) We could go on and on.

I have had to learn how to code several trading platforms over the years (including NT and TS,) and they are all extremely different. I know that you are using the stratefy builder and not programming directly, but it is just building the program code for you based on what you have told it to do. The strategy that is actually executed is a piece of code, and the code that runs in one platform is not going to run in another.

I'm not sure what led you to think a TS strategy will execute in NT. I'm afraid this is not the case. The reverse is also not going to work.

Not trying to rain on your parade. I am willing to be educated by someone who is familiar with current versions of TS, as I am not, and I'm always will willing to be proven wrong.... But I'm quite sure of this. Again, for what it's worth.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
Thanked by:
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


@bobwest: see https://ninjatrader.com/support/helpGuides/nt8/?tradestation_email_integration.htm .
Not super fast/efficient but doable.

The other way is also possible but would require writing some custom coding.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 sgjohnson 
Kingsport, Tennessee
 
Experience: None
Posts: 37 since Apr 2020
Thanks Given: 13
Thanks Received: 13

Thanks for that @bobwest. I don't mind geekiness. The geekier the better in my opinion.

The reason I suspected NT can accept signals/orders from TS is because they explicitly say so in their documentation:

"The TradeStation Email Interface allows you to take advantage of TradeStation's email notification capabilities right out of the box. Run your TradeStation strategy in real time, order signals are emailed within your computer (never leaves your PC) to NinjaTrader which processes the order through to your broker."

They also offer TS ELDs which contain functions that work with NT 7 to pass price/volume data to NT, but they don't seem to work in NT 8, which I'd prefer to work with. This allows you to do backtesting of strategies in NT but you can't send orders back to TS. The feeling I get from reading a few posts on NT's forum is it *might* be possible, but it's not at all in their business interests to help me with it. I'd be using the platform for free in order to live trade.

After reading a little bit more after I posted, I've decided to go with a FIX solution. I have no interest yet in using complicated algorithms, but I found there's already FIX adapter modules available in Python, which seems to be the most popular language for algo trading. I already know a little bit about Python, but not much. Will have to do some remedial study. This seems to be what the "big boys" do: code their own (or buy) a FIX solution so they can take their algos to any broker they want, rather than having to code over and over again to satisfy a particular platform.

Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 sgjohnson 
Kingsport, Tennessee
 
Experience: None
Posts: 37 since Apr 2020
Thanks Given: 13
Thanks Received: 13


sam028 View Post
@bobwest: see https://ninjatrader.com/support/helpGuides/nt8/?tradestation_email_integration.htm .
Not super fast/efficient but doable.

The other way is also possible but would require writing some custom coding.


Lol. Thanks @sam028 for the link. You posted while I was typing.

Started this thread Reply With Quote
Thanked by:
  #6 (permalink)
 sgjohnson 
Kingsport, Tennessee
 
Experience: None
Posts: 37 since Apr 2020
Thanks Given: 13
Thanks Received: 13


sgjohnson View Post
Thanks for that @bobwest. I don't mind geekiness. The geekier the better in my opinion.

The reason I suspected NT can accept signals/orders from TS is because they explicitly say so in their documentation:

"The TradeStation Email Interface allows you to take advantage of TradeStation's email notification capabilities right out of the box. Run your TradeStation strategy in real time, order signals are emailed within your computer (never leaves your PC) to NinjaTrader which processes the order through to your broker."

They also offer TS ELDs which contain functions that work with NT 7 to pass price/volume data to NT, but they don't seem to work in NT 8, which I'd prefer to work with. This allows you to do backtesting of strategies in NT but you can't send orders back to TS. The feeling I get from reading a few posts on NT's forum is it *might* be possible, but it's not at all in their business interests to help me with it. I'd be using the platform for free in order to live trade.

After reading a little bit more after I posted, I've decided to go with a FIX solution. I have no interest yet in using complicated algorithms, but I found there's already FIX adapter modules available in Python, which seems to be the most popular language for algo trading. I already know a little bit about Python, but not much. Will have to do some remedial study. This seems to be what the "big boys" do: code their own (or buy) a FIX solution so they can take their algos to any broker they want, rather than having to code over and over again to satisfy a particular platform.


Check that. *Forward testing, not backtesting, since you can't pull historical data.

Started this thread Reply With Quote
Thanked by:
  #7 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,162 since Jan 2013
Thanks Given: 57,341
Thanks Received: 26,267

@sam028 and @sgjohnson, I stand corrected. This is amazingly great. Learning is good.

I've been away from NT for a long time, obviously not up to speed any more.

Sam, you said that it could be done the other way with some coding. Can you say something about how it would work? (I'm only curious, so detail is not necessary. But it's kind of interesting.)


sgjohnson View Post
Will have to do some remedial study. This seems to be what the "big boys" do: code their own (or buy) a FIX solution so they can take their algos to any broker they want, rather than having to code over and over again to satisfy a particular platform.

@sgjohnson, I totally agree about not being tied to any particular platform, if you're willing to do the work to get there.

The downside is going to be having to write a lot of code yourself that would otherwise already be provided (and tested) in a commercial application. But the upside is you can move around freely.

Interesting discussion.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
  #8 (permalink)
 sgjohnson 
Kingsport, Tennessee
 
Experience: None
Posts: 37 since Apr 2020
Thanks Given: 13
Thanks Received: 13

Welp, just got done chatting with TS. Their FIX API is reserved for institutional clients. If anyone knows a broker that opens their FIX API to retail traders, feel free to post.

Started this thread Reply With Quote
Thanked by:
  #9 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


bobwest View Post
...
Sam, you said that it could be done the other way with some coding. Can you say something about how it would work? (I'm only curious, so detail is not necessary. But it's kind of interesting.)
...

You "simply" have to trap each order sent by NT, and transmit the information (the simpler is to write a text file, but using a socket or named pipes or messages queues is more elegant).
On TS side the idea would be to create a .dll (in C++) with a function which will read the text file/socket/pipe/.... In the TS EL code you integrate this function and the strategy will know when an order is sent by NT.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #10 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,162 since Jan 2013
Thanks Given: 57,341
Thanks Received: 26,267



sam028 View Post
You "simply" have to trap each order sent by NT, and transmit the information (the simpler is to write a text file, but using a socket or named pipes or messages queues is more elegant).
On TS side the idea would be to create a .dll (in C++) with a function which will read the text file/socket/pipe/.... In the TS EL code you integrate this function and the strategy will know when an order is sent by NT.

Got it. Inter-application communication is always tricky, when there is no actual interface designed for it (and even when there is.) This looks like it would work, but it seems like a lot to do just to be able to run an NT strategy instead of creating one in TS in the first place. But I could see it if the reasons were strong enough....

My worry would be potential missed communications, and how to be sure that nothing had been missed. I would also want to get confirmation back to the NT strategy that the orders had been sent and executed, so it would not just assume there were no issues in terms of the broker and the exchange either. (For instance, your limit order not executing or something else other than pure success at the expected price.) Otherwise, the NT strategy might just merrily roll on, not realizing it didn't have the position it thought it had and perhaps firing off orders against it -- such as, trying to close a long position that didn't exist in the market with a sell order, creating a new short.

But if you worked at it you could probably solve anything.

Thanks for the answer.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote




Last Updated on October 20, 2020


© 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