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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-20-2009, 02:11 PM   #1
Socrato
Junior Member
 
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default Debugging Strategy

Hi I downloaded Visual Studio 2008 there is free trial for 90 days - in order to try to debug my ninjascript more easily. Im no expert programmer - have never touched c# before NT...but I wonder if someone might be able to help.

I was able to at least look at some variables whilst running VS (rather than using the more awkward output window /print functions in the local editor - and it all looked fine as I stepped through it. However, I would like to see things graphically as well, as I think that some instances are not being correctly picked up. So I want to draw a series of dots on the chart to indicate when various condition are met.

This would use the DawDot() function - which I have the details for. My problem is that I cant seem to invoke it for all the historical bars in the chart. I suppose this has something to do with the OnBarUpdate() method that I have put it in.

What I basically want is for it to run across all historical bars and plot values below the lows or above the highs of all historical bars in a series.

So something on the lines of

For each Bar in Historical Data

If (EMA(20) > EMA (200)) ;
{DrawDot(I understand all these parameters - and will offset each by 2 ticks, 4 ticks, 6 ticks etc from the lows or highs so the dots from differeing conditions will not overlap on each bar)}

If (MACD > 0));

DrawDot () etc

and so on until I graphically illustrate all instances of conditions being true on a chart. I can then look at the autogenerated buy or sell signals to see if they tally.

I know this seems a bit long winded but I think it may be useful for others as well in determining suitability of conditions - especially as I have had some problems on deciphering exactly which values are being used from the dataseries as on VS it says that the values might be stale (i presume this meant it might be some update problem....but after manually reading and storing the values out to double variables i found it was updating correctly - though for safety i kept using the variables in my conditional statements rather than the data series directly as they were continuously updating in debugging - whilst im still not sure about the series values directly.

Im sorry this post is so long - esp being my first. But I would like to thank all here as I have learnt a great deal from going through messages here.

Thsnks in advance.
Socrato is offline  
Reply With Quote
Old 07-20-2009, 02:19 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Socrato,

If you want it to draw a dot on a bar all you need to do is use DrawDot(). When your conditions are true, a dot will be drawn provided you use unique signal names for each dot. This means every single bar needs a new signal name to represent a new dot.
NinjaTrader_Josh is offline  
Reply With Quote
Old 07-20-2009, 02:42 PM   #3
Socrato
Junior Member
 
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

OK great - so I could use the bar reference number (I think I saw that in one example) convert that to string say TO automatically give a unique ref per bar- plus concatenate by condition eg +"EMA20>EMA200") .

My only issue is that it only seems to do it for the current bar - but I will implement the bar reference thing as see how it goes.

Thanks very much for your help.
Socrato is offline  
Reply With Quote
Old 07-20-2009, 02:44 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Right so...

CurrentBar + "EMA"

or something along those lines.
NinjaTrader_Josh is offline  
Reply With Quote
Old 07-20-2009, 03:40 PM   #5
Socrato
Junior Member
 
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks ever so much...this works a treat!
Socrato 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
Debugging & Backtesting Sienna General Programming 9 11-23-2008 09:34 AM
Debugging with VS .net 2005 SystemTrading General Programming 2 10-20-2008 04:24 PM
JIT debugging issue SamuelHiggins Miscellaneous Support 5 01-15-2008 01:12 AM
Debugging your NinjaScript Code NinjaTrader_Josh Tips 0 09-24-2007 08:51 PM
Debugging using Visual Studio guym Indicator Development 2 11-28-2006 12:41 AM


All times are GMT -6. The time now is 05:21 PM.