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

arrows

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

    arrows

    i want to write a group of indicators of which the first will color the entry bar blue following an arrow up on the prior bar once the next bar (entry bar ) has moved up 5 ticks so i know i'm probably too late and that recolors to its normal bar color if it drops back under +5.
    i know how to set the distance variable to 5 but is it possible to say if arrow up then barcolor....
    or do i need to list all the terms that set the arrow on the prior bar?
    i've been trying with writing all the criteria needed to get the arrow but it's cumbersome.
    Also i've had some luck getting it to color blue but it stays blue even if the bar goes back under 5.

    #2
    Hello,

    Thank you for the post.

    I wanted to gather some more details on what you are trying to do. From what I understand it sounds like you want to create multiple indicators that would be applied and then use each other as signals. Is this correct?

    It also sounds like you are already placing an arrow but are not seeing the result you want, is that correct?

    Could you provide a sample of the logic you are currently using and what your goal is? That would be helpful in providing an answer.

    I look forward to being of further assitance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      i have a long indicator with arrow up and a short arrow down which work fine.
      Also, my down bars are violet and up are lime green.
      What i need are 2 new indicators one long one short that for the bar following the arrow bar which is the proposed 'entry' bar i want it to color red for the short and blue for the long once price moves 5 or more ticks from the bar open in the proper direction and to revert to violet or lime green if it drops under 5. I want to tell at a glance if i'm probably too late to enter.
      I have another pair of long and short signals that give dots and i was able to make those work
      and wrote a matching red/blue indicator for the next bar but can't make these work.
      The conditions are more complex for the arrow ones and i can't make it color red/blue so i was hoping a new indicator referencing an arrow in a previous bar's indicator as the start point might be easier.
      It would still be one indicator for the arrow on its candle and a second indicator coloring the bar after that and one for red and one for blue.

      Comment


        #4
        arrows

        this is the short arrow.
        Code:
                protected override void Initialize()
                {
        CalculateOnBarClose = true;
        	Overlay	= true;		
                }
        
                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
               protected override void OnBarUpdate()
                {
                   if (CurrentBar < 1) return; // do not process until first 2 bars loaded.
        		
        			// Condition set 1  SHORT type #2
                 
        		if ( Close[0]< Open[0] && Close[0]<Low[1] && CurrentBar- saveBar > 2) //>1 removes 2nd arrow, >2removes next 2 repeat arrows >0 removes none
        {
        DrawArrowDown(" down" + CurrentBar, false, 0, High[0]+ (TickSize*dist), Color.White); 
        saveBar = CurrentBar; // save the current bar number
        if (alertBool)PlaySound(@"C:\mysounds\Corkpop.wav");   
        }
        
        
        
        		}

        Comment


          #5
          arrows

          this is the red paintbar for the short signal that was a dot.
          The terms in condition 1 that =true are what gets a dot in the related indicator except these here are all 1 bar later since the red paint is 1 bar after the dot bar.
          It doesn't remove the red if it drops back under 5. Still working on that but at least it colors red.
          Code:
          #region Variables
                     private int dist = 5; //5 ticks
          		private bool alertBool= false;//??????????????????????????????/
          	
          		#endregion
          
                  /// <summary>
                  /// This method is used to configure the indicator and is called once before any bar data is loaded.
                  /// </summary>
                  protected override void Initialize()
                  {
          CalculateOnBarClose = false;
          		Overlay=true;
                  }
          
                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                 protected override void OnBarUpdate()
                  {
                      
          			// Condition set 1
                      if ( (Close[1] < Open[1] && Close[1]< Open[2]  && Close[2]>Open[2]   ==true)  &&  (Open[0]-Close[0]>=(TickSize*dist)==true ) )
          			BarColor = Color.Red;   
          			
          		 	if ( (Close[1] < Open[1] && Close[1] < Open[2] && Close[2]>Open[2]==true)  &&  (Open[0]-Close[0] <(TickSize*dist) ) && Close[0]<Open[0] )
          				BarColor = Color.Violet;
          			if ( (Close[1] < Open[1] && Close[1] < Open[2] && Close[2]>Open[2]==true)  &&  (Open[0]-Close[0] <(TickSize*dist) ) && Close[0]>Open[0] )
          				BarColor = Color.LimeGreen;

          Comment


            #6
            Hello,

            Thank you for the reply.

            I reviewed the posts and do see that the conditions you have provided are fairly different which would likely result in different outcomes:

            From the BarColor script:

            Code:
              if ( (Close[1] < Open[1] && Close[1]< Open[2]  && Close[2]>Open[2]   ==true)  &&  (Open[0]-Close[0]>=(TickSize*dist)==true ) )

            From the Arrow script:

            Code:
            if ( Close[0]< Open[0] && Close[0]<Low[1] && CurrentBar- saveBar > 2)
            These conditions seem to be very different and I am unsure how to compare these two posts to provide an answer. If the BarColor script is working as you expect, I could suggest to further model the nonworking scripts to more closely match the working scripts. I see that the BarColor script has 4 conditions where you have 3, it is also checking different data than you are currently.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              The arrow appears on a short signal if the bar closes lower than the prior bar low. The prior bar can be violet or green.
              I didn't give you the code for painting the next bar red as long as it stays 5 or more ticks under the open price because I cant make it work.
              The other code you call barcolor is for a similar indicator that gives a dot if the current bar close under the prior bar open which by definition would require the prior be green.
              (Keep in mind I use violet and green for normal candles).
              I only gave you the painting code for the bar that follows a dot not the condition for the dot (although here it is...
              if (Close[0] < Open[0] && Close[0]< Open[1] && Close[1]>Open[1] ))
              just so you can see how paint is supposed to happen and come off as needed. That code works--it's the code for paint after arrows that doesn't.
              Last edited by simpletrades; 02-14-2017, 04:22 PM.

              Comment


                #8
                See, the dot only happens when a violet bar closes lower than a green bar open which means it cant happen successively. The arrows, however, can happen on multiple bars in a row so I have the code in there to give it a 2 bar lookback to not keep printing arrows,
                Since I only want the bar immediately after the arrow to test for 5 ticks and paint and not paint later bars following bars that met the same condition of closing lower than the prior bar low that would plot an arrow if I didn't have that lookback I'm having a problem. The paint after dots is easy to make do as I want because I didn't have to tell it I only want the first bar painted not later bars since there can never be multiple dots generating multiple painted bars all in a row.
                Last edited by simpletrades; 02-14-2017, 04:40 PM.

                Comment


                  #9
                  oddly enough the paintbar following a dot--the one you called barcolor --stopped working this morning. why?
                  It works on my volume charts but not my 5 min. I was having that problem on the actual dot and arrow coding and a support person said to add

                  protected override void OnBarUpdate()
                  {
                  if (CurrentBar < 1) return; // do not process until first 2 bars loaded.
                  which worked.

                  For the paintbar just now I made its code read <2 since the bar to paint involves an extra bar to check and that got the volume paintbar working but not the 5 min.
                  Last edited by simpletrades; 02-15-2017, 07:32 AM.

                  Comment


                    #10
                    Hello,

                    It seems this thread is getting fairly confusing, I believe we should try focusing on getting one of the items you have mentioned working, and then worry about the other separate items.

                    It appears that the file we were comparing against that was working is now no longer working. I would suggest this file as the starting place for you to begin debugging to find the reason it is not working as it seems this is related to getting the other items working as well. I couldn't say why the script is now not working, this would be an item you could research, though.

                    We have some steps on debugging NinjaScript files here: http://ninjatrader.com/support/forum...ead.php?t=3418

                    I could suggest using Prints in the script to verify the conditions and when they are happening, this would help you track down why the conditions are not happening as expected when running on different bar types.

                    If you would like to attach the 1 file that is now not working, we could review it together to see if anything sticks out but you would likely be the best resource to find the problem by using Print statements and further debugging the logic you have created.

                    Please let me know if I may be of additional assistance.
                    JesseNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by gravdigaz6, Yesterday, 11:40 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by MarianApalaghiei, Yesterday, 10:49 PM
                    3 responses
                    10 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by XXtrader, Yesterday, 11:30 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post XXtrader  
                    Started by love2code2trade, 04-17-2024, 01:45 PM
                    4 responses
                    28 views
                    0 likes
                    Last Post love2code2trade  
                    Started by funk10101, Yesterday, 09:43 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post funk10101  
                    Working...
                    X