View Full Version : Strategy Analyzer Chart does not display Trades
04-21-2007, 08:40 AM
This is a continuation of a question posed in anther section (http://ninjatrader.mywowbb.com/view_topic.php?id=1963&forum_id=16&jump_to=9199), but I think it rather belongs here.
I have a simple Multitimeframe strategy that generates (in current settings) about 40 trades (on a 50 tick Forex chart). The Chart Tab of the StrategyAnalyzer doesn't - most of the time - display the trades (entry, exit, text -correspoinding to the'TextAndMarker'setting in the Chart Properties/PlotExecutions field- I triple checked).
When I have the Chart Tab selected, and run the historical backtest, the tradesARE displayed correctly as expected. When I then click any other tab (say 'Summary') and then go back to the 'Chart' tab, the trades are gone, never to reappear again.
When I have the 'Summary' tab selected during Backtest, the trades never show up in the 'Chart' tab.
I didn't experience this before, with another version of this strategy. (Maybe I should mention, that for this particularstrategy I get the error message as cited in the disscussion link above). I just don't understand why the trades show up first and then disappear when I go back to the 'Chart' tab.
Bug or Feature?
04-21-2007, 06:41 PM
a) The key to strategy backtesting in NT is that you try to implement a strategy which does not exhibit any error. I suggest trying to achieve that in the first place.
b) In order to analyze potential bugs in NT SA I suggest using either one of the provided sample strategies or starting with a simple as possible startegy.
Please let us know detailed steps in order to reproduce as you have this issue in scenario (a) or (b).
04-21-2007, 09:38 PM
Script andjpgs are attached in zip.
ad a): Script is now error free.
ad b): Script is assimple as possible.
1) Run attached script with settings as in Settings001.JPG and the Chart Tab open.
2) Chart shows trades (8 trades for the selected period) as in "$EURUSD 4_20_2007 (1 Tick)_A.jpg".
3) Select Summary Tab (or any other tab) and
4) select Chart Tab again ===> Trades are gone (as in "$EURUSD 4_20_2007 (1 Tick)_B.jpg", showing approximately the same region.
5) Run same script with 5 Tick time resolution instead of 1 Tick ==> same behavior - no Trades at second look at the chart.
6) Run same script with 1 (or 5) Minute resolution instead of 1 (or 5 Tick) ==> everything is OK, Trades are always there.
7) Run SampleMACrossOver on same data with 1 Tick for primary Time scale ==> everthing is OK.
04-21-2007, 09:55 PM
Sorry, I can not reproduce.
I went through 1-4: no issue
I even run an additional backtest at (3) and then continued to (4): no issue.
04-21-2007, 09:55 PM
Is there some funny stuff on your logs which would indicate that something is goign wrong?
04-21-2007, 10:17 PM
There are tons of errormessages in the Log - but all from earlier runs. I re-ran that particular scipt and watched for any new log-messages, but there are none and the mysterioiusly disappearing trades persist.
If it is just a *my machine only* feature, then ignore this until someone else has similar issues. It's not a biggie... (just harder to study and debug a tick based trading system on *my* machine, which is, BTW,a 64-bit WinXP AthlonProcessor /Nvidia Graphics card/ dual monitormachine). I did have some issues with other software regarding some graphics behaving strangely on my-machine-only, and we traced it back - after much trial anderror- to the very peculiar Nvidia Desktop software that comes with this graphics card.
Thanks, Dierk, for your time, testing, and concern,
04-22-2007, 05:35 PM
Should not be related to your PC's HW. We'll keep an eye on that issue...
I also have seen this behavior. I didn't report it because I assumed that my application was causing it by running out of memory or some other error I created.
I just got in the habit of saving any info I wanted to look at to an Excel spreadsheet.
I really like that NinjaTrader lets us do this, as I find Excel format much easier to work with, as I can then edit the entries, add columns for computations, add notes, etc. and save to disk for later reference so I can see if my changes really have made a difference.
04-23-2007, 07:02 AM
The issue is not hardware nor RAM related, likely a NT coding bug which is hard reproduce.
a) it always is a good idea to check the logs to eliminate any potential strategy error
b) we would be happy to have to "simple-to-reproduce" scenario in order to isolate this issue
04-25-2007, 05:19 AM
Since it's now not only my observation (or halluzination - Thanks KBJ, for verifying my sanity!) I feed back one more additional tidbid of info I made lately:
I am doing steps 1)-4) again (still in NT6beta11, havent upgraded yet, but if you didn't change any related code in NT6final the behavior should be same, and I usedsame instrument, same time resolution - 1 Tick, same period as below. GAIN connected or disconnected makes no difference).
1) I select $EURUSD on the left side paneof the Strategy Analyzer (which I have in my Default Symbol list) and right click -> BackTest ... (or hit Ctrl-B while $EURUSD is highlighed in gray). I have the Chart Tab selected in the right pane. I edit all settings in the Backtest dialog and run the strategy.
2) All trades display as usual in the Chart. (No script errors, no messages in the Log)
3) Hit summary (or any other tab different from Chart Tab). Notice, the $EURUSD symbol in the left symbol list paneremained highlighted through the whole backtesting and is now sitll highlighted.
4) Hit Chart Tab----->now Chart appears to be'recalculated' again (it takes a few seconds) and now all trades DISAPPEARED only from the Chart (but are still in the Summary,Executions, Trades Orders , etc tabs!!)
1) + 2) as above
3) beforeI select another Tab, I select a non-Instrument item in the left pane, e.g the Strategy Collapsable Itemlist Line, or any Strategy underneath (e.g. I left click K2DonchainTest004 so that it isnow highlighted in gray and$EURUSD is unselcted).
3a) THEN I hit Summary or any other Tab
4) Hit Chart Tab again ----> now Chart appears to be NOT recalculated (it shows up immediately) and all Trades show up as before.
5) It gets even weirder, when I highlight not one of the Strategies at 3) but anohter Instrument such as $GBPJPY. Then at step 4) the Chart is recalculated for $GBPJPY (that is I now have a completely new chart corresponding to thehighlighted symbol) - BUT all the other tabs (Summary, Executions, Trades,...) are still showing the $EURUSD trades (and dont appear to be recalculated).
Summary: it appears that at the selection of the Chart Tab,the Chart of the highlighted symbol on the left pane is recalculated (but not a fully backtested with trades etc ). If the userhighlighted anothersymbol while browsing the various tabs, the wrong (last highlighted one)Chart gets displayed, without trades, andthat chart doesn't necessary correspond to the trades, orders in the other tabs.
I'll verifiy this behavior in NT6final, once I have it installed.
04-25-2007, 05:42 AM
Sorry, I can not reproduce.
Scenario A) Step 4, no (!) recalculation takes place. Chart and trades appear right away.
Scenario B) Step 5: strategy is not (!) recalculated (there are no trades on the chart) as I switch to $GBPJPY. I just takes a while to load the 1 tick (or 1 minute) series for $GBPJPY.
Sorry I'm on a loss.
04-25-2007, 05:45 AM
- this is NT6R1
- I have tick data and 1 minute data for $EURUSD and $GBPJPY on my DB
- I'm not connected to any feed/broker as I retested
04-26-2007, 01:52 AM
OK, Dierk, I guess I *was* halluzinating after all?
I installed NT6.0.1000.1 and now I can't reproduce it either.The trades nowappear on the chartinA4 as supposed and I don't see the chart getting recalculated either.
Looks to me it was an issue only forNT6beta11.
Case closed. Thanks for your time.
04-26-2007, 01:54 AM
Thanks for feedback.
Sorry to be the bearer of bad tidings, but the problem described by Peter does still exist in NT 6.0.1000.1.
I use a slightly different scenario from Peter's, because I'm trading Commodities instead of Forex.
Here's what I do:1. From Control Center, Click on File, New, Strategy Analyzer...
2. Click "Open Output Window" icon
3. Click on ER2 05-07
4. Click on B for backtest
5. Select strategy, and set time frame "From" & "To" for just one day (to limit output) and click on OK. It runs though my data and outputs Print statements to the output window.
6. Right-click and select Clear on the "Output" window.
7. Click on any of the tabs other than "Summary" or "Settings" (e.g., Chart, Graphs, Orders, etc).
When this is done, it outputs more Print statements to the output window, so you can tell the strategy is being run all over again.
This happens the first time any tab (other than Summary or Settings) is selected after running a backtest from the Strategy Analyzer. I notice everything is also recalculated if the performance units selection at the top of the Strategy Analyzer is changed between Currency, Percent and Points.
When doing a lengthly backtest, this creates a sizeable, time-wasting annoyance that happens over and over again while trying to test.
P.S. The application I used was SampleMACrossOver.cs changed as follows:
protected override void Initialize()
SMA(Fast).Plots.Pen.Color = Color.Orange;
SMA(Slow).Plots.Pen.Color = Color.Green;
CalculateOnBarClose = true;
Print( "Initialize for instrument " + Instrument.FullName + " Complete at " + DateTime.Now.TimeOfDay.ToString() );
public override void Dispose()
Print( "Dispose called for instrument " + Instrument.FullName
+ " at " + DateTime.Now.TimeOfDay.ToString() );
base.Dispose(); // Tell Ninja to do its cleanup.
protected override void OnBarUpdate()
if (CrossAbove(SMA(Fast), SMA(Slow), 1))
else if (CrossBelow(SMA(Fast), SMA(Slow), 1))
Print( "BarObject=" + BarsInProgress.ToString()
+ " Bar#=" + CurrentBar.ToString()
+ " Count(of bars)=" + Count.ToString()
04-26-2007, 05:27 PM
Your observation is correct.
The strategy is re-run as you click on any sub-tab apart from Summary. Reason: NT internal memry considerations. We likely will change that with the next major update. Unfortunately no ETA yet.