NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 08-30-2011, 02:31 PM   #1
rmt81
Member
 
Join Date: Mar 2011
Posts: 48
Thanks: 4
Thanked 2 times in 1 post
Default Missing trades with multiple strategy instances in Market Replay

I am having difficulty running multiple strategies in Market Replay mode. Each strategy instance is identical except that it is run on a different (and only one) instrument. Each strategy runs on one minute bars.

My strategies do not hit the entry and exit conditions consistently. It seems that (rerunning the same day over and over again), some strategies place entry and exit orders when run alone, but fail to do so when running simultaneously with as few as three other strategy instances (instruments).

It appears that when I run multiple strategies, perhaps some of the ticks in the data stream do not get processed by OnBarUpdate(). Does that sound plausible? Is there a way to find out whether that is happening in real time?

I initially suspected that it might be a matter of the ticks arriving faster than the computer could process them, so that some of them are just ignored. But, I ran a set of four stocks (strategy instances) for a day of Market Replay data at both 500X and 50X speed and I got exactly the same results at both speeds. However, both of those times, the results were missing entries and exits for two of the stocks. If I run those two stocks together (without the other two) at 500X speed, the previously missing entries and exits are executed correctly.

Is this likely to happen in real-time trading? If so, how many strategies could I likely run simultaneously?

Do you have any suggestions?

I would greatly appreciate any help you can give me.
rmt81 is offline  
Reply With Quote
Old 08-30-2011, 02:45 PM   #2
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

rmt81,

In could likely be an issue with BarsInProgress. By default, the primary data series will be called OnBarUpdate unless you specify to check that the BarsInProgress are another data series. Using BarsInProgress = 0 would specify to check the primary series, BIP = 1 would be the 2nd data series and so on.

Please review our Help Guide article on 'True Event Driven OnBarUpdate() Method' for more information:

http://www.ninjatrader.com/support/h...nstruments.htm
NinjaTrader_Matthew is offline  
Reply With Quote
Old 08-30-2011, 03:25 PM   #3
rmt81
Member
 
Join Date: Mar 2011
Posts: 48
Thanks: 4
Thanked 2 times in 1 post
Default Missing trades with multiple strategy instances in Market Replay

I must not have explained the situation clearly enough.

There is only one instrument per strategy instance. This is not a multi-instrument strategy. As I understand it, each of these strategy instances is independent, so BarsInProgress should not be an issue. I am getting executions of up to three different instruments, each running in a different strategy instance.

I have read the help on multi-instrument strategies multiple times. That approach has it’s own set of complicating factors. NT makes it unnecessarily complicated to load an instrument list. Perhaps changing to a multi-instrument strategy would solve my problem, but my suspicion is that if I am having trouble with this simpler implementation, the multi-instrument strategy will just be a nightmare.

Quote:
Originally Posted by NinjaTrader_Matthew View Post
rmt81,

In could likely be an issue with BarsInProgress. By default, the primary data series will be called OnBarUpdate unless you specify to check that the BarsInProgress are another data series. Using BarsInProgress = 0 would specify to check the primary series, BIP = 1 would be the 2nd data series and so on.

Please review our Help Guide article on 'True Event Driven OnBarUpdate() Method' for more information:

http://www.ninjatrader.com/support/h...nstruments.htm
rmt81 is offline  
Reply With Quote
Old 08-30-2011, 03:40 PM   #4
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Hello,

Thanks for the clarification - you're correct that BIP wouldn't count here.

Just so we're on the same page, you are saying you can run Strategy A against symbol Y and it works as expected, however if you run Strategy A against symbol X, Y and Z at the same time, it doesn't behave the same?

Was this replay data recorded from a live connection or downloaded from our replay servers?
NinjaTrader_Matthew is offline  
Reply With Quote
Old 08-30-2011, 05:37 PM   #5
rmt81
Member
 
Join Date: Mar 2011
Posts: 48
Thanks: 4
Thanked 2 times in 1 post
Default Missing trades with multiple strategy instances in Market Replay

Matthew:

You are correct. The more strategy instances I have running simultaneously, the lower the percentage of trades that are executed. If I run 500 simultaneously, I enter positions, but never exit them (perhaps because only of low percentage of the total data is processed).

The replay data was recorded from a live connection to TDA.


Quote:
Originally Posted by NinjaTrader_Matthew View Post
Hello,

Thanks for the clarification - you're correct that BIP wouldn't count here.

Just so we're on the same page, you are saying you can run Strategy A against symbol Y and it works as expected, however if you run Strategy A against symbol X, Y and Z at the same time, it doesn't behave the same?

Was this replay data recorded from a live connection or downloaded from our replay servers?
rmt81 is offline  
Reply With Quote
Old 08-31-2011, 07:23 AM   #6
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

rmt81,

If you're running 500 instruments, it may be due to perfromance issues. This is a lot of information to be pulled from your hard drive at one time. This would be in line with your original question on whether or not it was not processing all the ticks. I'm not sure exactly where the bottle neck would be in regards to replay, but you may want to try exponentially reducing the number of instruments at a time to see if you can gauge a benchmark for your PC.

Have you tried running these live? In a live enviornment, the ticks are going to come in from your internet connection and processed by your CPU only for the strategies. There would be no direct reading from the disk and I wouldn't suspect you would see the same issues.
NinjaTrader_Matthew is offline  
Reply With Quote
Reply

Tags
market replay, missing data, multiple strategies

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
market replay buttons missing adam6540 Connecting 2 12-07-2012 03:43 PM
Multiple Instances of Strategy bbucha_stk Strategy Development 8 01-13-2011 09:01 AM
No trades during Market Replay Trankuility Automated Trading 3 12-17-2010 03:34 AM
Saving multiple instances of a strategy BenHeaton Miscellaneous Support 14 12-17-2007 02:21 AM
Multiple instances of same position strategy in one DOM rossitercapital Miscellaneous Support 7 01-21-2007 05:25 AM


All times are GMT -6. The time now is 08:34 AM.