![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Sep 2008
Posts: 127
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Sep 2008
Posts: 127
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you Ray,
So, live data is the only way to truly know if this particular approach is working. Hmmmm.... |
|
|
|
|
|
#4 |
|
Certified NinjaScript Consultant
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
|
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 |
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
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...
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |