Un-attended trading - NinjaTrader Programming | futures io social day trading
futures io futures trading


Un-attended trading
Updated: Views / Replies:3,578 / 20
Created: by drolles Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Un-attended trading

  #1 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: TradeLink, OpenQuant, considering anything that works...
Favorite Futures: if it trades...
 
Posts: 94 since Oct 2010
Thanks: 24 given, 38 received

Un-attended trading

Hi,

I was wondering if I could kick off a bit of a brainstorm? I’m wondering has anyone done any work with NT on achieving un-attending trading? By this I mean making NT more robust in terms of handling exceptions, order placement for away from bid / ask spreads, etc so it can be more trusted to trade a strategy for itself.

Obviously, this is very open question, therefore, I’m thinking that we might need to specify the problem a little. Therefore, to scope the problem – what about saying we are looking to trade a strategy to trade 1 min bars in the FX market – possibly with a higher timeframe e.g. 60 min – for signals.

To start with an example, one thing I’ve had problems with both in backtest and live testing strategies is the attempted placement of an order within the close of a bar. NT does not like this and it can cause NT to terminate the strategy once the order is rejected by the broker. Therefore, a solution I came up with was checking that we were placing a stop or limit outside a close of the bar. I’ve included a code segment here that I’ve used to do this – it is placed in the OnExecution() method.

 
Code
        protected override void OnExecution(IExecution execution)
        { 
            if (execution.Order != null && execution.Order.Name == "Long Entry") {
                
                double temp_atr = ATR(BarsArray[0], 20)[0];
                
                // Place the limit order - proftiable exit
                if (execution.Order.AvgFillPrice + (temp_atr) < Closes[1][0]) {
                    
                    ExitLongLimit(1, true, execution.Order.Quantity, (Closes[1][0] + TickSize ), "Exit", "Long Entry");
                    
                } else { 
                
                    ExitLongLimit(1, true, execution.Order.Quantity, execution.Order.AvgFillPrice + (temp_atr), "Exit", "Long Entry");
                    
                }
Just to layout some principles that I think we could possibly focus on making NT NinjaScripts more robust is the try .. catch exception handling code.

I think we probably want to attack the most likely area for errors first – I would suggest that this might be the interaction between the broker and NT. For example, the placing of orders and confirming fills. Again, any suggestions would be greatly received.

Thanks and regards,

drolles

Reply With Quote
 
  #2 (permalink)
Quick Summary
Summary of ideas / topics

Thread is trying to consolidate ideas for making NT scripts more robust to achieve more auto pilot than cruise control [thanks RM99 for the terminology]. Ideas generated so far:

1. Order placement: Orders that are rejected by your broker can shut down NT. Order placement is important for both robustness of the strategy and minimising slippage. Possibly area of management is placement around the bid / ask spread. See NT support help here: NinjaTrader Version 7
2. Partial fills: Question is still open as to if the Managed approach in NT7 effectively manages partial fills. If the unmanaged approach is used some other management methods / functionality will be required to be built. This is an open question at the moment.
3. Broker disconnects
a. OnConnection not logging loss of connection: The OnConnection method is not being called when some brokers (notably MBT at this time – see thread here: ). A request put into development. See NT support forum here: MBT unvailable for trading - NinjaTrader Support Forum
b. Not reload data: Data is not reloaded when Recalculate is selected (see Adamus’s post https://futures.io/ninjatrader-programming/8814-un-attended-trading-2.html#post109169).


Last edited by drolles; March 27th, 2011 at 06:48 AM. Reason: Using to capture key ideas of the thread
 
  #3 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


drolles,

Thanks for the thread! I agree there needs more robustness in order handling/reporting in the NT<>broker API ... there are other discussions on futures.io (formerly BMT) about setting up and use of VPS closer to exchanges to run automated strategies, to assist with better entries, but that is not where you are looking to here AFAIK.

There are threads on the NT forum about specific issues with most of broker APIs, and none of them are perfect. I do know you are aware of those as well.

Reference to you comment aboutnot having NT stable during backtesting if orders are placed at the value of the close of the bar: by default that it how it is done in backtesting, regardless of either limit or market orders, it is filled at the close price of the trigger bar. Obviously I am not reading your intent here correctly.

I am trying to get my head around your example: it has to do with an order exit, not a entry. I dont understand how that helps. I used COBC=true for running live strategy, and havent had a strategy stopped (that I can remember) due to an order placed after close of the bar.

I think perhaps more detail might assist me, as I do feel improvements need to be made. I just dont know specifically if it can be done on the trader's level.

I have not yet been able to ascertain if the current issues are any worse in NT6.5 than they are with NT7betas: or if in fact NT6.5 is more robust for trade execution.

Looking forward to more discussion,
Jon

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote
The following user says Thank You to Trader.Jon for this post:
 
  #4 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: TradeLink, OpenQuant, considering anything that works...
Favorite Futures: if it trades...
 
Posts: 94 since Oct 2010
Thanks: 24 given, 38 received

Trader.Jon,

Thanks for the reply.

Fair questions – let me try to clarify:

The example I’ve given relates to using a second timeframe ATR to determine your stop distance away from your entry price. To take the first example, we test to see if the Close[0] is less than where we will put the Limit exit order. If the close[0] is greater than we put it one Tick above the Close[0]. Ideally, we should be moving this order later after it is safe to put the order closer to its actual require value. I would suspect that this is best done after the next bar in OnBarUpdate().

I’ve had a strategy shut down in mid-flight then a order is rejected by the broker. Take a look at the documentation on the help site: NinjaTrader Version 7. By default NT will showdown your strategy if an order it has submitted is rejected by the broker. You can turn it off or on dependent on what your requirements are. They give a relatively good example in the help documentation.

One of the other areas I was thinking about is using the OnConnectionStatus() method a little more robustly than I have in the past. There are some really good examples on the NT support forum on the use of that method not least here: Connection Lost Notification Code (not working) - NinjaTrader Support Forum

Kind regards,

drolles

Reply With Quote
The following user says Thank You to drolles for this post:
 
  #5 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker/Data: IB/IQFeed
Favorite Futures: EUR/USD
 
Adamus's Avatar
 
Posts: 1,085 since Dec 2010
Thanks: 470 given, 778 received

Big question. Hope you're still interested - better late than never though.

I assume you are talking about strategies using the NinjaTrader 'managed orders' approach, rather than scripting everything yourself with the unmanaged approach.

In my experience over the previous half year or so, with 10 trades a day roughly, I've only had 2 problems with NinjaTrader screwing up the strategies and as it turns out, I could have ignored the problem and it would have been OK, but my error checking on the IOrder objects my strategies holds told me there was something wrong and therefore they shut themselves down (as I intended when I scripted it).

That was due to the early morning circa 4:30AM GMT+0 Interactive Brokers routine disconnects, as I told you about before I think.

I checked out the NinjaTrader built-in functionality for disconnects and found this:


Quoting 
Recalculate: Strategies will attempt to recalculate its strategy position when a connection is reestablished and held for longer than 10 seconds. Recalculations will only occur if the strategy was stopped based on the conditions below. Should the connection be reestablished before the strategy was stopped, the strategy will continue running without recalculating as if no disconnect occurred.
If data feed disconnects for longer than the time specified in “Disconnect delay seconds”, the strategy is stopped and the disconnect is logged.
If the order feed disconnects and the strategy places an order action while disconnected, the strategy is stopped and the disconnect is logged.
If both the data and order feeds disconnect for longer than the time specified in “Disconnect delay seconds”, the strategy is stopped and the disconnect is logged.

I assume this means that NT will submit any orders delayed by connection loss. Or am I assuming too much?

You can discover what your enemy fears most by observing the means he uses to frighten you.
Reply With Quote
 
  #6 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

drolles if you have not already seen it take a look here:

https://futures.io/elite-circle/7839-systemmonitor-remote-servers.html

It is in the Elite section so I won't post the code here. Basically you might consider all the things that might go wrong, and code for each of them seperately. You also need to think about what is "global" and what is strategy-specific. Disconnects, for example, might be considered a global problem that can be managed by a seperate strategy.

The biggest problem I've come across is placing limit orders too close to the market. BuyLimit/SellLimit orders on the wrong side of the market will result in a rejection and stratgey shutdown as you have seen.

I have not (yet) migrated to unmanaged orders but that is a next step for me.

Reply With Quote
The following user says Thank You to MXASJ for this post:
 
  #7 (permalink)
 Vendor: www.traderwerks.com 
Taipei Taiwan
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Optimus
Favorite Futures: TW
 
Posts: 693 since Jun 2009
Thanks: 440 given, 440 received


MXASJ View Post

The biggest problem I've come across is placing limit orders too close to the market. BuyLimit/SellLimit orders on the wrong side of the market will result in a rejection and stratgey shutdown as you have seen.

You mean Stop Limit orders I believe.

Math. A gateway drug to reality.
Reply With Quote
 
  #8 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


traderwerks View Post
You mean Stop Limit orders I believe.

It was indeed BuyStopLimit/SellStopLimit that was giving me problems.

Reply With Quote
 
  #9 (permalink)
Fortitudo et Honor
Austin, TX
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 882 since Mar 2011
Thanks: 128 given, 703 received

The only real option I've seen in EL is the use of macros. Macros incorporate the coding that's already in the proprietary matrix. Why the brokers/platforms don't incorporate or release it, is beyond me. It's just dumb and a real pain in the rear.

using macros is simply telling your computer to punch buttons you would.

The biggest problems with hands free, is as you pointed out 1) Uptime and 2) The complexity of limit orders.

I've actually hired a consultant to help with the order rejection on limit orders and I have a viable solution, although it's virtually no different than using a market order. (essentially, you incorporate a pricegap into your order so if you wish to buy at 1.00, then it places the order at 1.00 plus whatever gap you specify .01, .02, .03, etc....which in the end, is the same as experiencing market order slippage.

Even if you get past the dangers in ping lag and having limit orders jumped, the next and bigger issue is partial orders. Limit orders work okay with 1 contract/share, but addressing all the "gotchas" with partial orders is endless. What does it do when it partially fills and then recoils? Do you leave the order out there? Do you cancel the remaining?...How would your exit address either, as if it moves far enough away and hits your stop, does the stop now reflect the number of open shares/contracts?

I've since relegated myself to 2 choices. Either learn to execute macros (which I'm not really sure wouldn't have the same issue...just like a human trying to place an order in very fast moving periods...sometimes you can't click fast enough and your order is skipped/rejected).....OR using market orders. I've had to develop a strategy that can withstand market slippage (and still make acceptible profits after that).

The second issue I'd like to address is dedicated server. DO NOT use a VPS. VPS are partitioned...so you are on the server with others, who have surges in consumption, issues with their partition that warrant restarts, etc.

Pay the additional money and get a dedicated server. I'm planning on using 1and1.com which features $69/month microsoft dual cores....more than enough. Then I'll buy/rent microsoft remote desktop and get a different smart phone that I can access/control the server from anywhere with a connection.

I think the notion of truly hands free is a unicorn. Even with a dedicated server, they still do not guarantee 100% uptime (99.995)% is NOT 100%. Consider this.....there are about 18million seconds in a 6 month period. at 99.995% up time, that's still nearly 800 seconds (over 13 minutes). Ask yourself what 13 minutes could do to you if your platform goes down in the middle of an open position in crazy market conditions. (I personally watched CL move 50c in 5 seconds when the stuff in Lybia was kicking off, which was like 4:00 a.m. Central time...when most people were sleeping.)

I have not checked various service providers for proximity to Chicago and ping response rates...that might be another prudent exercise.

I think at best, you'll have a system where you might be able to have your smart phone on you, but if you're envisioning pushing a start button and going golfing/skiing, I think it's just a matter of time before something melts down. (and if you're progressively upping your positionsize as your profits grow, the risk grows too).

I simply hope for a setup where I can go do other things (while still monitoring my phone) but more like cruise control than auto pilot. The ONLY way you can do that, and it's still not reliable is to hire a human being and train them to babysit for you.

Reply With Quote
The following user says Thank You to RM99 for this post:
 
  #10 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: TradeLink, OpenQuant, considering anything that works...
Favorite Futures: if it trades...
 
Posts: 94 since Oct 2010
Thanks: 24 given, 38 received


Thanks for all the replies.

This thread has moved on since I last checked it. I’ve obviously got to adjust my settings in the notification of thread updates.

I’ll try to reply individually to the topics raised.

Kind regards,

drolles

Reply With Quote

Reply



futures io > > > > > Un-attended trading

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     


All times are GMT -4. The time now is 11:38 AM.

Copyright © 2017 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
Page generated 2017-12-11 in 0.17 seconds with 18 queries on phoenix via your IP 54.82.81.154