• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Expose Properties of Indicator

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

    #16
    Originally posted by JMont1 View Post
    @NinjaTrader_Jesse, I am not trying to format to price. I am trying to format to a whole number like an int.

    so it would be some calculation that comes out to 20 or 23 or 25 but it prints depending on the instrument:


    23.0 for GC
    23.00 for ES
    23.000 for DX
    23.0000 for 6S
    23.000000 for 6J

    So I am trying to format it to just plain 23.

    Thanks for your prompt response.
    The solution that you have been given should do that. Have you tried using it at all?

    Otherwise, use a custom format string.

    refL https://docs.microsoft.com/en-us/dot...format-strings

    Comment


      #17
      Ihave tried this for hours now and cannot determine how to get an INT - which is the required format of the Strategy Builder to access the value to a whole number format based on the "double" that I seem to be getting advised to use.

      Even the custom format string is using a double.

      I have an INT that equals 23 and is being printed with the additional format of the price:

      private int rangeTicks = 0;


      rangeTicks = Convert.ToInt32((MAX(High, rangeBars)[0] - MIN(Low, rangeBars)[0]) / TickSize); // Get number of ticks in last rangeBars range

      Value[0] = rangeTicks;

      Prints in Market Analyzer column as:


      23.0 for GC
      23.00 for ES
      23.000 for DX
      23.0000 for 6S
      23.000000 for 6J

      I am certain that it is a simple line of code I am missing but cannot find the answer.

      Thank you for any further assistance.

      Comment


        #18
        Hello JMont1

        Yes in the analyzer, all values are displayed with the remainder like this because the Plot is a double. You would need to format the way the analyzer shows the data if you want to see it differently.

        The reply I had provided was in contrast to your comment that you already have an int value being assigned to the plot. If you dont, you would still see a double. To make sure you have an int, you can cast the value to an int which would still allow the strategy to read its value as well.

        Here is one test you could do:
        Code:
        protected override void OnBarUpdate()
        {
        	Value[0] = Close[0];
        } 
        	
        public override string FormatPriceMarker(double price)
        {
        	return price.ToString();
        }


        Now cast the value:

        Code:
        protected override void OnBarUpdate()
        {
        	Value[0] = (int)Close[0];
        } 
        		
        public override string FormatPriceMarker(double price)
        {
        	return price.ToString();
        }


        A strategy that calls this indicator and reads its plot would see the real value depending on the cast:

        2823.75
        2823.5
        2823.5
        or

        2823
        2822
        2823




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

        Comment


          #19
          SInce I am not using price as the value I assumed I just needed to replace "price" with the "int" rangeTicks but I am still getting errors.

          I am going to give up and just accept the poor formatting.

          Thank you for trying.
          Last edited by JMont1; 08-16-2018, 07:43 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by superg3, Today, 12:33 AM
          0 responses
          1 view
          0 likes
          Last Post superg3
          by superg3
           
          Started by vppzepuq, Yesterday, 11:28 PM
          0 responses
          1 view
          0 likes
          Last Post vppzepuq  
          Started by Steve L, 05-25-2019, 10:04 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by mestril, 05-25-2019, 10:22 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by hir04068, 05-25-2019, 09:29 PM
          7 responses
          21 views
          0 likes
          Last Post hir04068  
          Working...
          X