Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 BarzTrading, Today, 07:25 AM
          2 responses
          13 views
          1 like
          Last Post BarzTrading  
          Started by devatechnologies, 04-14-2024, 02:58 PM
          3 responses
          19 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by tkaboris, Today, 08:01 AM
          0 responses
          3 views
          0 likes
          Last Post tkaboris  
          Started by EB Worx, 04-04-2023, 02:34 AM
          7 responses
          162 views
          0 likes
          Last Post VFI26
          by VFI26
           
          Started by Mizzouman1, Today, 07:35 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X