![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Right so...
CurrentBar + "EMA" or something along those lines.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jul 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks ever so much...this works a treat!
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |