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 11-18-2008, 09:17 AM   #1
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default Error - sell order on session beginning

Hi,

Today I cought Ninja when triggering on session beginning - I set "session begins" on 9:55AM, in that minute "out of nowhere" order was submited (see attachment). Others orders are fine but the first one.
Simple strategy was used: buy/sell on SMA(3) and SMA(14) crossovers.


So, the question is:
why does it happen and how to avoid it in future?

I am on NT 6.5.1000.7, XP Sp3.

Best Regards
Attached Images
File Type: jpg NQ 12-08 11_18_2008 (1 Min).jpg (45.5 KB, 8 views)
Kowal is offline  
Reply With Quote
Old 11-18-2008, 09:31 AM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

This has do with strategy vs. account position. This link will help:
http://www.ninjatrader-support2.com/...ead.php?t=4033

Also, go to Tools>Options>Strategies tab>NinjaScript tab, and check Wait until flat before executing live.
NinjaTrader_Ben is offline  
Reply With Quote
Old 11-18-2008, 01:18 PM   #3
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default

Hi Ben,

Thanks for quick reply.

"Wait until flat before executing live" was checked. It always is.

As I understood, every time I set "session begins" later than 9:30 and in the meantime condition was done (say simple Sma(3) crossbelow Sma(14), like it happend today), strategy position would be Long or Short (Short in my todays case). For me it should not trigger no matter what strategy position is, am I right?
Kowal is offline  
Reply With Quote
Old 11-18-2008, 01:25 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

The way it works is as follows Kowal.

You start your strategy at 9:30. Say you have a strategy position of 100 long. With "Wait until flat" you will continue to maintain this virtual position of 100L. Your account position should be flat. As data comes in and your strategy evaluates its trade conditions, when it finally reaches an exit order that brings you flat then you will make a live trade after that.

These are the scenarios you may find yourself in:
1. ExitLong() triggered. Next trade = live
2. EnterShort() triggered. The close position part will be virtual, the obtaining of a short position will be live

If you are experiencing differently please clarify.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-18-2008, 02:19 PM   #5
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default

Hi Josh,

thanks for reply - now I know a little bit more.
Ok, so lets take a look at an attached chart from my first post. At 9:51 there is a crossover (Sma(3) below Sma(14)) - now, strategy position is short, profit trigger was set to 12 ticks so at 9:55 -when I want my strategy to start working - strategy position should be flat. There is no reason to trigger at that time. Or I am missing sth.
Kowal is offline  
Reply With Quote
Old 11-18-2008, 02:23 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Let us take a step back. How are you starting your strategy?
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-18-2008, 02:35 PM   #7
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default

Control Center/ Strategies/ New Strategy/
NQ, 1 Minute
Session begins - 9:55AM
Calculate on bar close - true
Entries per directon - 1
Entry handling - AllEntries
Stop&Target submission - PerEntryExecution
Kowal is offline  
Reply With Quote
Old 11-18-2008, 03:10 PM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Please try the SampleMACrossOver strategy with "Wait until flat" selected in the same manner you are right now. If the SampleMACrossOver does not submit an order like the one you observed than we will need to dive into your strategy to see what is happening from that end.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-18-2008, 08:09 PM   #9
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default

Hi Josh,

I did few tests on Market Replay Data using SampleMACrossOver strategy with "Wait until flat" checked.
Some "days" everything works like it should. Just beautifull. Some "days"...well, it doesnt. I attach some charts to illustrate what I mean.
Attached Images
File Type: jpg ES 12-08 11_10_2008 (1 Min)_9_40.JPG (74.0 KB, 9 views)
File Type: jpg ES 12-08 11_13_2008 (1 Min)_10_20.JPG (77.2 KB, 8 views)
File Type: jpg ES 12-08 11_10_2008 (1 Min)_9_30.JPG (73.4 KB, 5 views)
Kowal is offline  
Reply With Quote
Old 11-19-2008, 07:28 AM   #10
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

What are the MA settings for the strategy? Are they the same as the SMA's you have on the chart in the screen shots?

Can you provide the exact steps you are taking to produce this?

Also, please post your replay data file.
NinjaTrader_Ben is offline  
Reply With Quote
Old 11-19-2008, 09:17 AM   #11
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default

Hi,

I used SampleMACrossOver strategy to "produce" these charts, SMAs settings are 10 and 25 (default) and yes, they are the same as SMAs in attached screen shots.
I am not sure what You mean writing about exact steps. Strategy settings? Control Center/ Strategies tab/ New Strategy - here they are:
(I would sent a screen shot, but I couldnt do that on PC, sorry)

Strategy: SampleMACrossOver
Parameters
Fast: 10
Slow: 25
Data Series
Instrument: ES 12-08
Type: Minute
Value: 1
Time Frame
Exclude weekend: False
Session begins (local time): is on every screen shot
Session ends (local time): 3:00PM
General
Account Sim101
Calculate on bar close: true
Label: SampleMACrossOver
Min. bars required: 20
HistoricalFillProcessing
Fill type: Default
Slippage: 0
Order Handling
Entries per direction: 1
Entry handling: AllEntries
Exit on close: True
Exit on close seconds: 30
Stop & target submission: PerEntryExecution
Order Properties
Set order quantity: by strategy
Time in force: Gtc

I sent an email to subscriber-support at ninjatrader dot com, subject "data replay file - att BEN".
Kowal is offline  
Reply With Quote
Old 11-19-2008, 09:22 AM   #12
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default

Ups, she did that again.

SampleMACrossOver strategy
Sessions begins (local time): 10:30AM
Attached Images
File Type: jpg ES 12-08 11_19_2008 (1 Min).jpg (55.2 KB, 6 views)
Kowal is offline  
Reply With Quote
Old 11-19-2008, 09:39 AM   #13
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

I will take a look at this when your email comes in with your data and get back to you with more information.
NinjaTrader_Ben is offline  
Reply With Quote
Old 11-19-2008, 10:18 AM   #14
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Kowal,

We have not received your mail yet. If you don't mind could you try resending? Thank you.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-24-2008, 09:05 AM   #15
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Kowal,

I know what is happening here. I suspect you are running on a 24hr chart. This means your indicators are running based off of the 24hr data set. When you change your strategy to start at 9:55AM you are now using a different data set. To see your trades you want to go to your chart properties and change the session begin/end time to correspond with your strategy's start/end time. In this manner you will be able to see correct data set and then match up your trades.

If you are trying to use a time filter to limit trading instead you want to see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=3226
NinjaTrader_Josh is offline  
Reply With Quote
Reply

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
Strange trades at the beginning of the session... John833 Charting 19 12-01-2009 04:14 AM
Place Buy order and Sell order at same time. robotics General Programming 38 08-07-2009 02:10 PM
How To Trigger A Sell Order From A Higher Price b-rock ATM Strategies (Discretionary Trading) 2 07-24-2008 08:35 AM
sell order hanging - not getting closed RK_trader Miscellaneous Support 8 07-19-2008 07:14 AM
feature request: set end and beginning of session for strategy as default scriabinop23 General Programming 1 02-01-2008 05:34 AM


All times are GMT -6. The time now is 02:13 PM.