Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

no text

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

    no text

    Edit - Ah I think I have found the error myself.
    Is there no way to delete posts?


    Can anyone explain what is incorrect here?
    Code:
        public class VolText : Indicator
        {
            #region Variables
            // Wizard generated variables
                private int myInput0 = 1; // Default setting for MyInput0
    			private	System.Drawing.Font		txtFont;
    			private int	fontSize        = 10;
    			private double Offset = 2;
    			private DataSeries myv;
    		
    		
            // 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()
            {
                CalculateOnBarClose	= true;
                Overlay				= false;
                PriceTypeSupported	= false;
    			txtFont		= new Font("Verdana Ref", fontSize);
    			new DataSeries (this);
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
    			 myv[0] = Volume[0];
    			
    			if(Close[0] >= Open[0])
    			{
              	DrawText("HighText", false,  myv[0].ToString(), 0, High[0]+ (TickSize * Math.Abs( Offset)) ,Color.ForestGreen, txtFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 50);
    			}
    			else
    			{
    			DrawText("LowText", false, VOL()[0].ToString(), 0,Low[0] - (TickSize*Math.Abs( Offset)),Color.Red,  txtFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 50);
    			}
            }
    It compiles but no text is produced.
    Last edited by Mindset; 11-28-2008, 02:03 PM. Reason: error

    #2
    Glad you figured it out. To delete a post there should be an option when you press Edit to delete post.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      deletion

      No - can't see any option to delete Josh
      As it turns out I haven't quite sorted it.
      I now have some text which seems to produce the correct figures but I am looking to keep all historical text which it doesn't do.
      Eventually I will sort out conditions for the volume display I want but this is just the beginning.
      Attached Files

      Comment


        #4
        Revised indicator

        Ok I now have text with volume on each bar - position defined by close vs open.
        can someone assist - I want to summate all the volume as the close > open and vice versa and just print that volume rather than every bar as it is at the moment. So I end up with say 3 up close bars but one summated volume on the final up close bar.
        Attached Files

        Comment


          #5
          Mindset,

          To do this what you want to do is just run a variable that sums up the volume for you based on your conditions. Then when you do DrawText(), instead of using a unique tag each time with "AskText" + CurrentBar, drop the CurrentBar part. If the tag is already in use what happens is it will just overwrite the old one. That way you end up with 1 DrawText().
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            I have tried the following

            double bv = Volume[0];
            do
            bv = bv + Volume[0];
            while (Open[0] > Close[0]);

            but that just crashes the computer (twice) so where am I going wrong?

            Comment


              #7
              For sure NT will freeze/crash. You have coded an infinite loop that will never break.
              RayNinjaTrader Customer Service

              Comment


                #8
                The open is not always > close so how can that be infinite?

                Comment


                  #9
                  When you run that logic it is only taking one check on the current Open[0] and the current Close[0]. It doesn't cycle through the various [1] or [2]. On one OnBarUpdate() there is only one set of Open[0] > Close[0] and those values never change so that is why you have an infinite loop.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by cmoran13, 04-16-2026, 01:02 PM
                  0 responses
                  43 views
                  0 likes
                  Last Post cmoran13  
                  Started by PaulMohn, 04-10-2026, 11:11 AM
                  0 responses
                  25 views
                  0 likes
                  Last Post PaulMohn  
                  Started by CarlTrading, 03-31-2026, 09:41 PM
                  1 response
                  163 views
                  1 like
                  Last Post NinjaTrader_ChelseaB  
                  Started by CarlTrading, 04-01-2026, 02:41 AM
                  0 responses
                  98 views
                  1 like
                  Last Post CarlTrading  
                  Started by CaptainJack, 03-31-2026, 11:44 PM
                  0 responses
                  158 views
                  2 likes
                  Last Post CaptainJack  
                  Working...
                  X