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

The Breakpoint will not currently be hit source code is different...

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

    #16
    Hello Borgen,

    I wanted to add that I've tested on a Renko chart and the breakpoints are working without issue.

    Below is a link to a video demonstration.


    Write in to scripting support and I will be happy to schedule a call with you so that I can observe you going through the steps in this video and confirm the issue.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Borgen,

      I wanted to add that I've tested on a Renko chart and the breakpoints are working without issue.

      Below is a link to a video demonstration.
      https://drive.google.com/file/d/1PeH...w?usp=drivesdk

      Write in to scripting support and I will be happy to schedule a call with you so that I can observe you going through the steps in this video and confirm the issue.
      So you are telling me you made a test with a different sample code than the one I supplied in my post and it worked?
      Could you try the code with the problem in it?

      Code:
          public class TestRenko : Indicator
          {
              private double firstBar;
              private DateTime beginTime, endTime;
      
              protected override void OnStateChange()
              {
                  if (State == State.SetDefaults)
                  {
                      Description                                    = @"";
                      Name                                        = "TestRenko";
                      Calculate                                    = Calculate.OnBarClose;
                      IsOverlay                                    = true;
                      DisplayInDataBox                            = true;
                      DrawOnPricePanel                            = false;
                      DrawHorizontalGridLines                        = false;
                      DrawVerticalGridLines                        = false;
                      PaintPriceMarkers                            = false;
                      ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                      Lookback = 5;
                      //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                      //See Help Guide for additional information.
                      IsSuspendedWhileInactive                    = true;
                  }
                  else if (State == State.Configure)
                  {
                      AddDataSeries(Data.BarsPeriodType.Day, 1);
                  }
              }
      
              protected override void OnBarUpdate()
              {
                  if(CurrentBars[0] < Lookback || CurrentBars[1] < Lookback) return;
      
      
                  if(BarsInProgress == 0)
                  {
                      if (Bars.IsFirstBarOfSession)
                      {
                          firstBar = Open[0];
                      }
      
                      beginTime = Times[1][0];
                      endTime = Time[0];
                      Draw.Line(this, "Daily Open", false, beginTime, firstBar, endTime, firstBar, Brushes.Orange, DashStyleHelper.Dash, 5);
                  }
                  else if (BarsInProgress == 1)
                  {
      
                  }
              }
      
              [NinjaScriptProperty]
              [Range(1, int.MaxValue)]
              [Display(Name="Lookback", Order=1, GroupName= "Settings")]
              public int Lookback
              { get; set; }
          }​
      Last edited by Borgen; 11-14-2023, 01:46 AM.

      Comment


        #18
        Hello Borgen,

        It is working with Chelsea's sample script, so this would likely indicate the logic conditions in your custom indicator did not evaluate as true to allow the script to reach your breakpoint. I tested out your script as requested, adding a breakpoint on the Draw method and the breakpoint was never hit on a renko chart nor a minute chart.

        I added some print statements to your script, and it looks like your first return statement is causing the script to never run past that statement regardless if the chart is using renko or minute bars.

        In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating.

        Below is a link to a forum post that demonstrates using prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

        https://ninjatrader.com/support/foru...121#post791121

        Print the time of the bar and all values used in the conditions. I suggest adding prints outside of all conditions. Include labels for all values and comparison operators.

        Let me know if you need any assistance creating a print.

        Save the output from the output window to a text file and provide this with your reply.

        I'll be happy to assist with analyzing the output.
        Last edited by NinjaTrader_Gaby; 11-14-2023, 07:11 AM.
        Gaby V.NinjaTrader Customer Service

        Comment


          #19
          Print statements... You don't think I already tried that? It goes into OnBarUpdate and then stops when checking CurrentBars[0] and CurrentBars[1]. Why?

          Why do you think I gave you a super simple code sample to test it out with? It doesn't get any simpler that those lines within OnBarUpdate.

          This is an API from your company that I'm using, an API that you are supposed to be familiar with. That is why I'm asking you. So in giving you a sample to look closer at, the purpose was to see if you understood why your API isn't working like it should.

          Answers like "use print statements" is why I said earlier I'm not going to get any help resolving it from this forum. Your co-worker tested with a different sample code than the actual problem code and you're telling me to use print. It's not helpful at all.

          I'm just going to repeat my earlier statement to just drop this and forget about it. I'll just tell my client your API is buggy with renkos (It's been buggy for years) and not to use the indicator with them. I can use Global settings and paint the lines from minute charts to all charts instead.​

          Comment


            #20
            Hello Borgen,

            The issue is not likely with the error message about the source being different, and you may have some confusion about what the actual issue is.

            Your condition requires CurrentBars[1] to be greater than 5, meaning 5 days of data has to be processed, before the script will start evaluating.

            You have not added print statements for the first condition. These print statements would show you why this condition is evaluating as true, and returning before reaching the code below.

            The API is not NinjaScript.
            Below is a link to a forum post about the API.


            Further, this is most likely a logical error with your custom coding and not an issue with the platform.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Hi Borgen,

              try removing the files within the NT tmp directory. See my post here:
              Hi, I just updated the software with the current version. Now I am having trouble debugging the program. It is always showing 'The breakpoiint will not be currently be hit. The breakpoint is different from the original version' even though I just recompiled the program. When I open the visual studio using NinjaScript editor


              HTH,
              Frank

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,404 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by Shai Samuel, 07-02-2022, 02:46 PM
              4 responses
              95 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by DJ888, Yesterday, 10:57 PM
              0 responses
              8 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by MacDad, 02-25-2024, 11:48 PM
              7 responses
              159 views
              0 likes
              Last Post loganjarosz123  
              Started by Belfortbucks, Yesterday, 09:29 PM
              0 responses
              8 views
              0 likes
              Last Post Belfortbucks  
              Working...
              X