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 > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 03-04-2009, 07:22 PM   #1
5iver
Senior Member
 
Join Date: Sep 2008
Posts: 127
Thanks: 0
Thanked 0 times in 0 posts
Default 101 entry question

I'm experimenting with the Strategy Wizard — working through the tutorial vids etc — I've built the basic SMA crossover strategy, but all the entries that are generated seem to be happening two or three bars AFTER the actual cross... I've tried deselecting the "execute on bar close" option, but to no avail.

For my purposes — to understand how to build a scalping strategy on fast timeframes (144 tick etc) with very conservative targets — I want it to enter at market the moment the SMAs cross. Is this possible using the wizard?

Many thanks in advance.
5iver is offline  
Reply With Quote
Old 03-04-2009, 07:39 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

If you check the SMA values using the DataBox on the 2nd bar before your entry marker, you will see that your fast MA did not cross the slow MA although it may visually look that way. Then, the next bar would then be the 1st bar where there was a true crossing of values. On this bar, your condition is true and then the entry occurs on the next bar.

In a backtest, values are evaluated by by bar which is the same as on the close of the bar since this is when the values are known.

If you run in real-time, you can choose to set the Calculate on bar close value to false and an entry would occur the second their was a true cross of SMA values.
NinjaTrader_Ray is offline  
Reply With Quote
Old 03-04-2009, 08:12 PM   #3
5iver
Senior Member
 
Join Date: Sep 2008
Posts: 127
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you Ray,

So, live data is the only way to truly know if this particular approach is working.

Hmmmm....
5iver is offline  
Reply With Quote
Old 03-05-2009, 06:09 AM   #4
mrlogik
Certified NinjaScript Consultant
 
mrlogik's Avatar
 
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
Default

Trevor,

You shouldn't see the execution 2 / 3 bars after the actual cross.

From my experience, you should see the entry at the open price of the bar following the cross. Since you are executing end of bar, the moment the SMAs cross is when the bar closes, which the very next second (or tick) will create the open of the following bar, which should execute your entry.

I believe for backtesting purposes, you can currently only execute end of bar computations.

hope this is informative.
"You look closely enough, you can find everything has a ... weak spot where it can break, sooner or later"

PureLogikTrading
mrlogik is offline  
Reply With Quote
Old 03-05-2009, 06:37 AM   #5
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

Thanks for adding mrlogik, you could use the ideas of this reference sample - http://www.ninjatrader-support2.com/...ead.php?t=6652

But this would only possible outside of the wizard.

You could test the wizard strategy in realtime with CalculateOnBarClose set to false, this will allow you to enter on the SMA cross. But of course there's a tradeoff involved as you can get more intrabar whipsaws with this kind of entry then...
NinjaTrader_Bertrand 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
Entry Price Question Mike Winfrey Automated Trading 6 12-04-2008 02:51 PM
Strategy Order Entry Question iplaygames Miscellaneous Support 1 05-11-2008 05:21 PM
Order entry question Bubss Strategy Development 2 01-14-2008 07:19 AM
Sim 101 / Basic / Window Problem ? Alfred Historical NinjaTrader 6.5 Beta Threads 1 12-18-2007 10:42 AM
SIM 101 underground Miscellaneous Support 6 09-26-2005 03:47 PM


All times are GMT -6. The time now is 06:27 AM.