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

Draw Object

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

    Draw Object

    Hi i am using this high volume indicator
    I want to draw an Arrow after 5 minutes when volume of 1000 size comes
    regards

    HTML Code:
        public class HighVolAlert : Indicator
        {
            #region Variables
            // Wizard generated variables
               private int highVolume = 1000; // Default setting for HighVolume
    		  
    		private Color highAlert = Color.Black;
    		
            // User defined variables (add any user defined variables below)
            #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()
            {
               
               // Add(new Plot(new Pen(Color.Blue, 2), PlotStyle.Bar, "Volume"));
    			//Add(new Line(Color.DarkGray, 0, "Zero line"));
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                Value.Set(Volume[0]);
    		
                if (Volume[0] >= HighVolume)
    				
    			{
    				
    				DrawDiamond("VolDiamond" + CurrentBar,true, 0, High[0] + 40*TickSize, highAlert);
    				
    			}
    			
    			
            }
    
         

    #2
    Hello SLASH,

    Thank you for your post.

    Apply the indicator to a 5 Minute chart and replace the DrawDiamond() method with either the DrawArrowUp() or DrawArrowDown() method.

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello SLASH,

      Thank you for your post.

      Apply the indicator to a 5 Minute chart and replace the DrawDiamond() method with either the DrawArrowUp() or DrawArrowDown() method.
      but how to draw arrow after 5 or say after 15 minutes?

      Comment


        #4
        Hello SLASH,

        Thank you for your response.

        So you are saying no matter the chart period and interval you apply the indicator to?

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Hello SLASH,

          Thank you for your response.

          So you are saying no matter the chart period and interval you apply the indicator to?
          ya it has nothing to do with chart period I can use 1 min chart and want to draw arrow after 15 minutes of the bar which has high vol
          regards

          Comment


            #6
            Hello SLASH,

            Thank you for your response.

            I believe you are asking how to wait a set number of minutes after your highVolume is reached before drawing the arrow. If this is the case we would use Time[0] and the DateTime.AddMinutes() method, please refer to the code below:
            Code:
                    #region Variables
                    // Wizard generated variables
                    private int highVolume = 1000; // Default setting for HighVolume
            		private DateTime timeHVol;
            		private int timeToWait = 15; // Default setting for timeToWait
            		  
            		private Color highAlert = Color.Black;
            		
                    // User defined variables (add any user defined variables below)
                    #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()
                    {
                       
                       // Add(new Plot(new Pen(Color.Blue, 2), PlotStyle.Bar, "Volume"));
            			//Add(new Line(Color.DarkGray, 0, "Zero line"));
                    }
            
                    /// <summary>
                    /// Called on each bar update event (incoming tick)
                    /// </summary>
                    protected override void OnBarUpdate()
                    {
                        Value.Set(Volume[0]);
            		
                        if (Volume[0] >= highVolume)
            				
            			{
            				DrawDiamond("VolDiamond" + CurrentBar,true, 0, High[0] + 40*TickSize, highAlert);
            				timeHVol = Time[0];
            			}
            			
            			if(timeHVol.AddMinutes(timeToWait) <= Time[0])
            			{
            				// draw your arrow.
            			}
                    }
            
                    #region Properties
            		[Description("Number of minute to wait since HighVolume reached")]
            		[GridCategory("Parameters")]
            		public int TimeToWait
            		{
            			get { return timeToWait; }
            			set { timeToWait = Math.Max(1, value); }
            		}
                    #endregion
            For information on Time please visit the following link: http://www.ninjatrader.com/support/h...s/nt7/time.htm

            For information on .AddMinutes() please visit the following link: http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            148 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Started by mattbsea, Today, 05:44 PM
            0 responses
            5 views
            0 likes
            Last Post mattbsea  
            Started by RideMe, 04-07-2024, 04:54 PM
            6 responses
            33 views
            0 likes
            Last Post RideMe
            by RideMe
             
            Started by tkaboris, Today, 05:13 PM
            0 responses
            5 views
            0 likes
            Last Post tkaboris  
            Started by GussJ, 03-04-2020, 03:11 PM
            16 responses
            3,282 views
            0 likes
            Last Post Leafcutter  
            Working...
            X