NexusFi: Find Your Edge


Home Menu

 





server based auto strat


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one NetTecture with 2 posts (2 thanks)
    2. looks_two Fat Tails with 2 posts (2 thanks)
    3. looks_3 liquidcci with 1 posts (0 thanks)
    4. looks_4 gparkis with 1 posts (0 thanks)
    1. trending_up 2,124 views
    2. thumb_up 4 thanks given
    3. group 5 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
 

server based auto strat

 
 gparkis 
New York City, NY/USA
 
Experience: Intermediate
Platform: NT
Trading: 6E, ZN, CL
Posts: 121 since Dec 2010
Thanks Given: 3
Thanks Received: 74

when employing a server based auto strategy with regards to NT7 and the server goes down then in all respects so does the auto strategy.

when server and NT7 are back up and on, does the auto strat pick up where it left off or does it start anew?

Started this thread

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
36 thanks
Tao te Trade: way of the WLD
24 thanks
Spoo-nalysis ES e-mini futures S&P 500
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
16 thanks
 
 NetTecture 
Szczecin
 
Experience: Intermediate
Platform: Ninja, writing own now
Posts: 211 since Mar 2010

Pretty irrelevant - firs, nInja is not terribly good at syncing, second if you check ninja you see the strats do not autostart.

Anyhow, in a server failure scenario you can have massive losses simply because you may be in a position without stop (execution not reported, ninja never puts the stop in as it is not running). Ninja syncing is your smallest problem - you should manually make sure your account and positions are in order.

 
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



NetTecture View Post
Pretty irrelevant - firs, nInja is not terribly good at syncing, second if you check ninja you see the strats do not autostart.

Anyhow, in a server failure scenario you can have massive losses simply because you may be in a position without stop (execution not reported, ninja never puts the stop in as it is not running). Ninja syncing is your smallest problem - you should manually make sure your account and positions are in order.

When running a strategy, it is possible to

-> let NinjaTrader manage the exits (OCO either profit, trailing stop or initial stop)
-> add a hard stop at the exchange which is far away from the stop managed by Ninjatrader

In case that the server goes down, you still have the hard stop at the exchange. With the hard stop you may suffer from larger losses than usual, but you are still covered against a major event. The hard stop would also protect you, if a larger move occurs intrabar (not applicable to range or Renko bars), when your strategy only executes at bar close.

Another way of protecting oneself against a major move would be an out-of-the money option, but this would rather apply to position trading than intraday trading.

 
 NetTecture 
Szczecin
 
Experience: Intermediate
Platform: Ninja, writing own now
Posts: 211 since Mar 2010


Fat Tails View Post
When running a strategy, it is possible to

-> let NinjaTrader manage the exits (OCO either profit, trailing stop or initial stop)
-> add a hard stop at the exchange which is far away from the stop managed by Ninjatrader

In case that the server goes down, you still have the hard stop at the exchange. With the hard stop you may suffer from larger losses than usual, but you are still covered against a major event. The hard stop would also protect you, if a larger move occurs intrabar (not applicable to range or Renko bars), when your strategy only executes at bar close.

Another way of protecting oneself against a major move would be an out-of-the money option, but this would rather apply to position trading than intraday trading.

No, you do not have a hard stop at the exchange - not under ALL conditions. This is the classical distributed transaction problem most people can not solve. Yes, you ahve the hard stop - IF it is at the exchange. But if the server dies EXACTLY at the right moment, then no, the stop is not in place yet. Because the entry order was sent, but Ninja diedd before getting the execution. Plus, you also may have targets in place, in which case - unless you run that at a broker that does broker side OCO (not sure ninja can do that) - you loose the OCO part even if the target + stop are in place, so you may end up getting hit at both, resulting in an unprotected market condition again.

The ONLY sensible solution is a dead man switch - a second server ,separate data center, taht gets regularly pinged by the Ninja instance (dummy strategy). If the ping is not received, then it connects to the broker, evaluates all orders and positions and flattens the account. Having 2 of them can be seen as sensible baseline security for any larger account, but even one is easy to do and QUITE cheap. I would put one home, one at amazon and one at Azure to be safe - tehy do not need a LOT of code, so the instances can be small.

This is a timing issue, but 10 years designing server software has teached me to look for worst case scenarios.

 
 
liquidcci's Avatar
 liquidcci 
Austin, TX
 
Experience: Master
Platform: ninjatrader, r-trader
Trading: NQ, CL
Posts: 866 since Jun 2011
Thanks Given: 610
Thanks Received: 1,091


NetTecture View Post
No, you do not have a hard stop at the exchange - not under ALL conditions. This is the classical distributed transaction problem most people can not solve. Yes, you ahve the hard stop - IF it is at the exchange. But if the server dies EXACTLY at the right moment, then no, the stop is not in place yet. Because the entry order was sent, but Ninja diedd before getting the execution. Plus, you also may have targets in place, in which case - unless you run that at a broker that does broker side OCO (not sure ninja can do that) - you loose the OCO part even if the target + stop are in place, so you may end up getting hit at both, resulting in an unprotected market condition again.

The ONLY sensible solution is a dead man switch - a second server ,separate data center, taht gets regularly pinged by the Ninja instance (dummy strategy). If the ping is not received, then it connects to the broker, evaluates all orders and positions and flattens the account. Having 2 of them can be seen as sensible baseline security for any larger account, but even one is easy to do and QUITE cheap. I would put one home, one at amazon and one at Azure to be safe - tehy do not need a LOT of code, so the instances can be small.

This is a timing issue, but 10 years designing server software has teached me to look for worst case scenarios.

Interesting solution to a potential problem I never considered. Thanks

"The day I became a winning trader was the day it became boring. Daily losses no longer bother me and daily wins no longer excited me. Took years of pain and busting a few accounts before finally got my mind right. I survived the darkness within and now just chillax and let my black box do the work."
 
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


NetTecture View Post
No, you do not have a hard stop at the exchange - not under ALL conditions. This is the classical distributed transaction problem most people can not solve. Yes, you ahve the hard stop - IF it is at the exchange. But if the server dies EXACTLY at the right moment, then no, the stop is not in place yet. Because the entry order was sent, but Ninja diedd before getting the execution. Plus, you also may have targets in place, in which case - unless you run that at a broker that does broker side OCO (not sure ninja can do that) - you loose the OCO part even if the target + stop are in place, so you may end up getting hit at both, resulting in an unprotected market condition again.

@NetTecture: Thank you for your answer. I understand that there is a low probability scenario that NinjaTrader or the internet connection stalls just when you send the stop order, such that the position has been entered and the hard stop is not being sent. But if this is to happen, Ninjatrader must break down exactly during the few milliseconds that elapse between sending the entry order and sending the stop order.

Very unlikely. There are other higher probability scenarios (failure of the broker, failure of the connection exchange broker, etc.) which will induce a higher risk.

NinjaTrader does broker side OCO, depending on whether the broker API offers it. With NinjaTrader/Interactive Brokers the OCO functionality is not managed by NinjaTrader, but by Interactive Brokers. In case that NinjaTrader or the internet connection to the broker fails, the OCO will still be correctly executed. However, if the broker fails, it will not work, as OCO is not supported by most of the exchanges (there are exceptions, but then the broker will need to implement the interface with the exchange to transfer the OCO orders).



NetTecture View Post
The ONLY sensible solution is a dead man switch - a second server ,separate data center, taht gets regularly pinged by the Ninja instance (dummy strategy). If the ping is not received, then it connects to the broker, evaluates all orders and positions and flattens the account. Having 2 of them can be seen as sensible baseline security for any larger account, but even one is easy to do and QUITE cheap. I would put one home, one at amazon and one at Azure to be safe - tehy do not need a LOT of code, so the instances can be small.

This is a timing issue, but 10 years designing server software has teached me to look for worst case scenarios.

I would evaluate the probability that NinjaTrader fails during the few milliseconds when an entry order and a stop order is placed as negligable compared to other risks that can not be altered - such as a failure of the broker or the exchange. The protection in such a case can be

-> limited position sizing
-> a long options position

Operational risk can be reduced to a reasonable level, but it can never be excluded.

Thanked by:

 



Last Updated on September 18, 2012


© 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