![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
I'm a beginner so be gentle. I'm having a problem with the SampleMACrossover strategy that comes with the software. When I backtest this strategy it works fine. It takes a position and closes the previous position everytime the moving average lines cross. When I try this strategy with live data it doesn't seem to work the same. It closes the previous position and doesn't open a new position (it waits until the MA lines cross again to take a new position). Do I have a setting wrong? I'd like to be able to understand the problem before I code my own algorithm. thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
When you apply a new strategy, what are your order handling settings? Can you provide a screen shot of the chart with the executions and MA's on it?
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Ben,
Here are the setting. The executions seem to be happening correctly, however I'm not taking positions (as previously explained). |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
The screen shot is very small so I can hardly make out what is going on, however the executions look right on: previous order closes and a new order in the opposite direction every time the MA's cross.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Sorry, screenshot is too small to see anything. Is this by chance the YM on TWS/IB? If so, then there is a bug which will be addressing with next release (~2 weeks) from now.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Ben,
Here's a better look at the settings. Again the executions look fine. However positions are not being taken everytime the MAs cross. If I'm long/short it'll close that position and then wait until the MA cross again to take a new position. Looking at the executions, a position should be closed everytime the lines cross and a new one should be taken. Correct? |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
As a matter of fact it is the YM on IB. So if I run the code on the S&P emini it should work correctly? I guess I'll fine out tomorrow morning.
Cheers |
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Or try it on an equity like MSFT or AAPL.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
I ran the SampleMAcrossover stragety against the MSFT and I received the same results. If i check the MAIN executions tab it seems to be perfect. However when I check the executions and trades tabs under the Account Performance tab it shows that positions are not being taken consistently.
|
|
|
|
|
|
#10 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Please post some screenshots of where you think there are discrepancies. The Account Performance tab just reports whatever has happened. If it is seen in executions it is there. You may be applying filters to your account tab. Please don't use filters like account or date.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
If you compare the chart to the trades tab you'll see that a LONG position was taken @ 27.41 and closed at 27.47. A short position didn't get taken @ 27.47. Why is that?
|
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
After a second look at this, it seems there could be two things causing confusion for you here: -The MA cross strategy is an always in strategy. NT also tries to pair trades in the trades tab. Because the reporting is started mid signal NT pairs the close of the pre-existing signal with the close of the next signal and the next long signal with the sell short signal. That is why you see this odd pairing. -Also the trades tab only shows trades. An execution that is still open as a position, like what is shown in your screen shot, would be shown in your executions tab.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
That doesn't explain things as I see it.
Please correct me if I'm wrong. The SampleMACrossover it supposed to do the following: 1. When the fast SMA crosses over the slow SMA a LONG position is taken. 2. This position remains open until the slow SMA crosses over the fast SMA. 3. At this point the position is closed ans a new SHORT position is taken. This position will not close until the fast SMA crosses over the slow SMA. The result should be a list of trades that alternate between LONG and SHORT (or vice versa) as shown be back testing the strategy. As you can see be the list of trades only LONG position are being taken. Thus a trade is being skipped. By watching the Position Tab I can confirm that a position is being taken every other crossover. How do you explain that? |
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
Please generate a report that starts on the same day that you started the strategy (or earlier) and you will see what you want to see. Starting your report while a trade is open, is causing Closes to be paired with Closes and Buys the be paired with Sells. Please look at the Entry and Exit columns in your screen shot and compare them with a report that is generated before your strategy has an open position.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
That doesn't answer my question at all. I realize the ENTRY NAME and EXIT NAME aren't correct. The trades however are. I went long at $27.41 and exited that position at $27.47. I went long again at $27.53 and exited at $27.49. I'm missing a SHORT trade in between. I ran a back test for todays day using the same strategy. The trades are SHORT, LONG, SHORT, LONG etc... With the live data the trades are LONG, LONG, LONG etc...
Try as I might there isn't SHORT trade to be found in the live data. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can i connect to Forex.com (live account) and connected to Esignal as historical data | Greenmoney21 | Connecting | 14 | 06-09-2009 06:17 PM |
| Simulator data not the same as live data on charts | dewurster | ATM Strategies (Discretionary Trading) | 1 | 08-11-2008 11:43 AM |
| Converting replay data to historical data | kenzo | Miscellaneous Support | 1 | 07-09-2008 11:03 AM |
| Using historical data for a live strategy | tony900hwk | Strategy Development | 5 | 06-26-2008 11:27 AM |
| Live but no historical data | Rollins | Connecting | 2 | 02-15-2008 11:06 AM |