Using a NinjaTrader strategy for execution in TradeStation - futures io
futures io



Using a NinjaTrader strategy for execution in TradeStation


Discussion in Platforms and Indicators

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Using a NinjaTrader strategy for execution in TradeStation

(login for full post details)
  #1 (permalink)
sgjohnson
Kingsport, Tennessee
 
 
Posts: 35 since Apr 2020
Thanks: 13 given, 12 received

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.

Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(189 thanks from 22 posts)
looks_twoSalao's Journalby Salao
(51 thanks from 11 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(38 thanks from 18 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(31 thanks from 14 posts)
looks_5Maybe a little bit different journalby Malykubo
(14 thanks from 15 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Big Mike in Ecuador
76 thanks
The Crude Dude Oil Trading System
68 thanks
Help improve the FIO community
36 thanks
futures io site changelog and issues/problem reporting
27 thanks
The New Micro Contract - MICRO BITCOIN coming May 2021
25 thanks
 
(login for full post details)
  #2 (permalink)
 bobwest 
Site Moderator
Sarasota FL
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
 
bobwest's Avatar
 
Posts: 6,448 since Jan 2013
Thanks: 48,906 given, 21,573 received


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
Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to bobwest for this post:
 
(login for full post details)
  #3 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,675 since Jun 2009
Thanks: 3,790 given, 4,507 received


@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
The following 2 users say Thank You to sam028 for this post:
 
(login for full post details)
  #4 (permalink)
sgjohnson
Kingsport, Tennessee
 
 
Posts: 35 since Apr 2020
Thanks: 13 given, 12 received

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.

Reply With Quote
The following user says Thank You to sgjohnson for this post:
 
(login for full post details)
  #5 (permalink)
sgjohnson
Kingsport, Tennessee
 
 
Posts: 35 since Apr 2020
Thanks: 13 given, 12 received


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.

Reply With Quote
The following user says Thank You to sgjohnson for this post:
 
(login for full post details)
  #6 (permalink)
sgjohnson
Kingsport, Tennessee
 
 
Posts: 35 since Apr 2020
Thanks: 13 given, 12 received


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.

Reply With Quote
The following user says Thank You to sgjohnson for this post:
 
(login for full post details)
  #7 (permalink)
 bobwest 
Site Moderator
Sarasota FL
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
 
bobwest's Avatar
 
Posts: 6,448 since Jan 2013
Thanks: 48,906 given, 21,573 received

@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
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #8 (permalink)
sgjohnson
Kingsport, Tennessee
 
 
Posts: 35 since Apr 2020
Thanks: 13 given, 12 received

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.

Reply With Quote
The following user says Thank You to sgjohnson for this post:
 
(login for full post details)
  #9 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,675 since Jun 2009
Thanks: 3,790 given, 4,507 received


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
The following user says Thank You to sam028 for this post:
 
(login for full post details)
  #10 (permalink)
 bobwest 
Site Moderator
Sarasota FL
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
 
bobwest's Avatar
 
Posts: 6,448 since Jan 2013
Thanks: 48,906 given, 21,573 received



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
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #11 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,675 since Jun 2009
Thanks: 3,790 given, 4,507 received


bobwest View Post
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.

Yes, that's the tricky aspect.
I wrote something to replicate orders from on NinjaTrader (the Master) to other NinjaTrader instance(s) (the Slave(s)) and I resolved this in having a kind of dashboard which shows the orders/positions on the Master and the orders/positions on the Slave(s). In this case you can see the differences in fills, if the pending orders are similar on both instances and so on.
It would be necessary to have something check the NT positions/orders vs TS positions/orders (while an intra-machine communication have a smaller failure probability than two machines seeing each other across Internet).

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
The following user says Thank You to sam028 for this post:


futures io Trading Community Platforms and Indicators > Using a NinjaTrader strategy for execution in TradeStation


Last Updated on October 20, 2020


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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