NinjaTrader Support Forum  

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-10-2012, 04:43 AM   #1
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default Only few orders.

Hi! Can anybody help me? I have some problem with my strategy.
When I run it on the market replay it works well (100-150 orders per day). But if I start it on the sim account there are only few very rare orders during the day. I use GetCurrentAsk and GetCurrentBid into my algorithm.
No matter if I use:
- calculate on close bar or false.
- time frame: ticks or range.
- delays: from 0 to 150.
- slippage: from 0 to 10
- market or limit orders.
For example, if I run my strategy on market replay with slippage 5 and using market or limit orders it works well. But if I run it on sim account with slippage 0, delays 0 (perfect conditions) It generates only few orders.
How to improve the strategy? I think that the using ask=bid for calculating signals can help (look like market replay). Can I code it?
Please turn me in the right direction into my searches.
Best regards, Alex
Last edited by Alexpl; 08-10-2012 at 04:49 AM.
Alexpl is offline  
Reply With Quote
Old 08-10-2012, 04:52 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Alexpl,
Welcome to the forum and I am happy to assist you.

You can use slippage in backtest only. Not while running your strategy live or in market replay.

Quote:
Sets the amount of slippage in ticks used in performance calculations during backtests.
http://www.ninjatrader.com/support/h...l?slippage.htm

To assist you further may I know are you trying to backtest it or running the strategy in market replay or live.

I look forward to assisting you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-10-2012, 05:00 AM   #3
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default

Thanks for reply.
Slippage it's not a problem.
I run strategy on market replay (get 100-150 orders per day) and live sim account (get 0-5 orders per day)
Why is so big difference in the number of the orders and how to improve it? This is make a big influence to results.
Last edited by Alexpl; 08-10-2012 at 05:06 AM.
Alexpl is offline  
Reply With Quote
Old 08-10-2012, 05:10 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Alexpl,
If there is data discrepancy then your straegy can work differently. Can you please make sure the live data and the replay data matches with each other.

Also please append the code TraceOrders = true in the initialize section of the strategy and see if you are witnessing any cancelled/rejected orders.
http://www.ninjatrader.com/support/h...raceorders.htm

Also is the strategy a multi-series strategy?

I look forward to assisting you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-21-2012, 09:56 AM   #5
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default

Hi! My data feed is Kinetick. I am not sure that then I uses range bars they builds identicaly. There are not mutch enought orders in the trace log then I uses real sim account. Some orders are rejected but it's Ok.(Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties')
Strategy is not a multi-series.
For example: I had 6 trades on live account today. Then I tested the same period on market replay I had 12 trades.
4 range; GC 12-12;
On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=10 in 5 minutes
Last edited by Alexpl; 08-21-2012 at 10:54 AM.
Alexpl is offline  
Reply With Quote
Old 08-21-2012, 10:14 AM   #6
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default

Maybe it can help
http://imageshack.us/photo/my-images...ge8212012.jpg/
The smooth part of the chart - on the starting "new chart" .When new data coming it displayed more accurately (from 14:05).
But this does not affect the strategy.
Maybe my strategy still use incorrect data (like the first part of picture)
Last edited by Alexpl; 08-21-2012 at 10:52 AM.
Alexpl is offline  
Reply With Quote
Old 08-21-2012, 11:08 AM   #7
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Alexpl,
The orders are getting rejected due the entry handling rules. Please make sure the strategy parameters are the same.

Also please make sure the rollover date for GC 12-12 is set to July 30.
  • In Control Center menu bar goto Tools>Instrument Manager
  • In the Instrument Manager dialog type in GC in the Name text box and click on the Search button
  • Select GC from the data grid below and click on Edit button
  • In the Instrument Editor dialog click on Misc Tab
  • Scroll Down and click on the [...] button in the Contract Rollover field
  • In the new dialog set the Rollover month for 12-12 Contract to July 30.
Please restart NinjaTrader after you have made the changes.


Please let me know if I can assist you any further.
Attached Images
File Type: png GC Rollover date.png (115.0 KB, 4 views)
NinjaTrader_Joydeep is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Joydeep for this post:
Old 08-21-2012, 11:26 AM   #8
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default

Thanks, NinjaTrader_Joydeep! I have corrected rollover date and run strategy again. Charts are correct now.
Last edited by Alexpl; 08-21-2012 at 01:50 PM.
Alexpl is offline  
Reply With Quote
The following user says thank you to Alexpl for this post:
Old 08-21-2012, 11:28 AM   #9
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Alexpl,
Thanks for your note.

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-22-2012, 01:50 PM   #10
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default

Hi, NinjaTrader_Joydeep! I have tested my strategy with the same conditions on real sim and market replay today. Results are absolutly different. I can provide you with reports.
Different entries in different time. Please, help me. I am searching for reason during last few months.
Alexpl is offline  
Reply With Quote
Old 08-23-2012, 04:24 AM   #11
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Alexpl,
Can you confirm the data while trading live and in the market replay matches with each other.

If you test the SampleMACrossover strategy that comes with NinjaTrader then can you get the same results?

I look forward to assisting you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-23-2012, 04:59 AM   #12
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default

These screens are from my NT:
Live and replay at the same time. They are identical. May I use another way to compare?
I am also starting SampleMACrossover strategy for comparison.
Thanks.
Attached Images
File Type: png GC 12-12 (4 Range) 23_08_2012_live.png (64.1 KB, 6 views)
File Type: png GC 12-12 (4 Range) 23_08_2012_replay.png (65.2 KB, 5 views)
Last edited by Alexpl; 08-23-2012 at 05:03 AM.
Alexpl is offline  
Reply With Quote
Old 08-23-2012, 05:39 AM   #13
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Alexpl,
Please append the below code in the initialze section of your code and see if any orders are getting rejected or not.
Code:
TraceOrders = true;
http://www.ninjatrader.com/support/h...raceorders.htm
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-30-2012, 01:58 PM   #14
Alexpl
Junior Member
 
Join Date: Aug 2012
Posts: 29
Thanks: 8
Thanked 1 time in 1 post
Default

Hello, NinjaTrader Joydeep

When I have tested SampleMACrossover I got identical results. Only one trade was closed 2 ticks above than the same in replay. (18 orders were compared). I think It's Ok.

And another question: does the orders can be rejected before they will filled without tracing into logs? (for example: condition is valid during only one tick)

Thanks, NinjaTrader Joydeep, for all answers, they are very helpful !
Last edited by Alexpl; 08-30-2012 at 02:05 PM.
Alexpl is offline  
Reply With Quote
Old 08-30-2012, 03:13 PM   #15
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,860
Thanks: 162
Thanked 579 times in 570 posts
Default

Alexpl,

Any rejections should be logged.
NinjaTrader_Matthew is online now  
Reply With Quote
Reply

Tags
getcurrentask, getcurrentbid, oredrs

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
Why cannot reverse Entry orders execute on the same bar as exit orders? koganam Miscellaneous Support 10 04-11-2011 02:48 PM
Unmanaged Sell Limit orders not appearing in Orders window AlgoNaute Automated Trading 9 04-05-2011 06:53 AM
Holding orders in strategy somehow when waiting for fills & cancels (managed orders) adamus General Programming 5 10-12-2010 05:02 AM
Control Panel Orders shows no Order when an Orders must have occurred? mtthwbrnd Strategy Analyzer 4 02-10-2010 09:10 AM
Limit orders - book position kept when new orders are generated Fabrice Automated Trading 6 10-13-2007 03:16 PM


All times are GMT -6. The time now is 11:13 AM.