Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Debugging Strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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 P.NinjaTrader Customer Service

    Comment


      #3
      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.

      Comment


        #4
        Right so...

        CurrentBar + "EMA"

        or something along those lines.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks ever so much...this works a treat!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by demarcog, Today, 05:40 PM
          5 responses
          19 views
          0 likes
          Last Post demarcog  
          Started by cincai, Today, 08:16 PM
          0 responses
          5 views
          0 likes
          Last Post cincai
          by cincai
           
          Started by cincai, Today, 08:04 PM
          0 responses
          1 view
          0 likes
          Last Post cincai
          by cincai
           
          Started by demarcog, Today, 06:23 PM
          0 responses
          5 views
          0 likes
          Last Post demarcog  
          Started by canliyayin, Today, 05:56 PM
          0 responses
          4 views
          0 likes
          Last Post canliyayin  
          Working...
          X