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

When I add this NT Crashes

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

    When I add this NT Crashes

    I am trying to add an alert to an indicator I developed so that when a value crosses above or below an avg, I get an up arrow or down arrow. Everything else in the code works fine, and the code compiles just fine with the following statements enabled:

    Code:
    			if(CrossAbove(EMAProgressionAvg(14, 5).Progression, EMAProgressionAvg(14, 5).Progression_Avg, 1)) 
    			{
    			DrawArrowUp("EMAPUp" + CurrentBar, true, 0, Low[0] - TickSize , Color.Cyan);			
    			}
    			
    			if(CrossBelow(EMAProgressionAvg(14, 5).Progression, EMAProgressionAvg(14, 5).Progression_Avg, 1)) 
    			{
    			DrawArrowDown("EMAPDn" + CurrentBar, true, 0, High[0] + TickSize , Color.Red);			
    			}
    However, when I put this compiled indicator on a live chart, BAM!, NT crashes. Also, there is nothing at all in my log, not sure why since usually there is a lot of information in it. Perhaps the crash also blew up the log file.
    is is possible that there is a mismatch between where the indicator is placed (I have overlay = false) and where the code itself is trying to place the arrow. My assumption is the arrow should go in the same panel as the indicator but perhaps that isn't the case?

    #2
    Hello Daven,

    Thank you for your post.

    Please describe what happens when NinjaTrader crashes. Does the platform list as 'Not Responding' on the top the windows in NinjaTrader?

    Try commenting out the DrawArrowUp and DrawArrowDown, and then place Print statements to test if the conditions themselves are the cause of the crash. You can comment out lines using '//' and the Print statements will show in the Output window (Tools > Output window).
    Code:
    			if(CrossAbove(EMAProgressionAvg(14, 5).Progression, EMAProgressionAvg(14, 5).Progression_Avg, 1)) 
    			{
    			//DrawArrowUp("EMAPUp" + CurrentBar, true, 0, Low[0] - TickSize , Color.Cyan);
                            Print("Cross Above.");		
    			}
    Please let me know if NinjaTrader crashes after commenting out the DrawArrowUp and DrawArrowDown.

    Comment


      #3
      I've already commented out the draw statements and the indicator compiles and runs just fine. I'm pretty sure it is the draw statements that are causing the problem. Is there something wrong with the syntax or the fact that the indicator is in a panel other than the price panel? Do I need to direct the draw statements to the price panel? If so, how is that done?
      Thanks
      DaveN

      Comment


        #4
        Also, when it crashes everything goes grey. I'm sorry I can't recall the message but here is the trace file, since the log file is empty.
        Last edited by daven; 04-03-2013, 06:15 AM.

        Comment


          #5
          I'd like to send the trace file to you by e-mail. Is that possible?

          Comment


            #6
            Ran it with the draw statements active and the error message I get is "NinjaTrader has stopped working..."

            Comment


              #7
              Hello Daven,

              Thank you for that information.

              I do not see any issues with the syntax. This should not be effected by the Overlay property. If you wish to place the drawing objects in the price panel use DrawOnPricePanel = true: http://www.ninjatrader.com/support/h...pricepanel.htm

              Please send me your log and trace files for today so that I may look into what occurred.

              You can do this by going to the Control Center-> Help-> Mail to Support.

              Please put 'ATTN: Patrick - 820140' in the subject line and reference this thread in the body of the email: http://www.ninjatrader.com/support/f...ad.php?t=56936

              I look forward to your response.

              Comment


                #8
                Hello Daven,

                Thank you for your patience.

                The item here is that you call the indicator within itself, this is creating a loop that is taxing your PC resources resulting in NinjaTrader going into a 'Not Responding' mode.

                To resolve this matter change the Indicator calls to just the Plots you have created, much like you have down with the 'if (Progression_Avg[0] > Progression_Avg[1])' condition.

                Below is the code to resolve this matter:
                Code:
                if(CrossAbove(Progression, Progression_Avg, 1))
                {
                DrawArrowUp("EMAPUp" + CurrentBar, true, 0, Low[0] - TickSize , Color.Cyan);
                }
                if(CrossBelow(Progression, Progression_Avg, 1))
                {
                DrawArrowDown("EMAPDn" + CurrentBar, true, 0, High[0] + TickSize , Color.Red);
                }
                Please let me know if I may be of further assistance.

                Comment


                  #9
                  That fixed it Patrick. I have been testing it the last few days and it seems to be working fine now. thanks so much for your help. I now know something else to look out for when I am coding, recursive embedded loops. It even sounds painful.
                  Thanks again.
                  DaveN

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jaybedreamin, Today, 05:56 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post jaybedreamin  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  6 responses
                  18 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by Jon17, Today, 04:33 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post Jon17
                  by Jon17
                   
                  Started by Javierw.ok, Today, 04:12 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post Javierw.ok  
                  Started by timmbbo, Today, 08:59 AM
                  2 responses
                  10 views
                  0 likes
                  Last Post bltdavid  
                  Working...
                  X