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

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 RookieTrader, Today, 07:41 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by kujista, Today, 05:44 AM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by elderan, Yesterday, 08:03 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by samish18, Yesterday, 08:57 AM
                  8 responses
                  25 views
                  0 likes
                  Last Post samish18  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  3 responses
                  10 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Working...
                  X