View Full Version : Error - sell order on session beginning
Kowal
11-18-2008, 09:17 AM
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
NinjaTrader_Ben
11-18-2008, 09:31 AM
Hello,
This has do with strategy vs. account position. This link will help:
http://www.ninjatrader-support2.com/vb/showthread.php?t=4033
Also, go to Tools>Options>Strategies tab>NinjaScript tab, and check Wait until flat before executing live.
Kowal
11-18-2008, 01:18 PM
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?
NinjaTrader_Josh
11-18-2008, 01:25 PM
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.
Kowal
11-18-2008, 02:19 PM
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.
NinjaTrader_Josh
11-18-2008, 02:23 PM
Let us take a step back. How are you starting your strategy?
Kowal
11-18-2008, 02:35 PM
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
NinjaTrader_Josh
11-18-2008, 03:10 PM
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.
Kowal
11-18-2008, 08:09 PM
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.
NinjaTrader_Ben
11-19-2008, 07:28 AM
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.
Kowal
11-19-2008, 09:17 AM
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
11-19-2008, 09:22 AM
Ups, she did that again.
SampleMACrossOver strategy
Sessions begins (local time): 10:30AM
NinjaTrader_Ben
11-19-2008, 09:39 AM
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_Josh
11-19-2008, 10:18 AM
Kowal,
We have not received your mail yet. If you don't mind could you try resending? Thank you.
NinjaTrader_Josh
11-24-2008, 09:05 AM
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/vb/showthread.php?t=3226
Kowal
11-28-2008, 04:35 PM
Hello Josh,
You were right about different data set. That was a reason of my problems. I can see that clearly now.
Time filter solve it - everything works like it should.
Thanks a lot