• 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

can someone suggest what I'm doing wrong?

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

    can someone suggest what I'm doing wrong?

    Hello,

    Below is the code for an indicator which plots the volume histogram with a dot that projects end of bar volume. It compiles ok, but when I add it to a chart all I get is the pane. No volume and no indicator. I used the NT help file tutorial as a guide, I'm very new at this. Any ideas?

    ///<summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    ///</summary>
    protectedoverridevoid Initialize()
    {

    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Dot, "PRV"));
    CalculateOnBarClose = false;
    Overlay = false;
    PriceTypeSupported = false;
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.


    double perCom = Bars.PercentComplete;
    double volPRV = (1/perCom)*(Volume[0]);
    PRV.Set(volPRV);
    }

    #2
    Please check the Log tab, likely an error on this indicator at runtime.
    RayNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ray View Post
      Please check the Log tab, likely an error on this indicator at runtime.
      Nothing on Log tab, just the usual connection messages. Thank your for your help.

      Comment


        #4
        I just noticed that in the data window, the Volume field says "InfinityM".

        ????

        Comment


          #5
          Then your indicator values are infinite values. You will need to recheck your math.
          RayNinjaTrader Customer Service

          Comment


            #6
            OK, I started the whole thing over from scratch and played aroung with commenting out various portions to see what works and what doesn't.

            Every clue I get suggests I'm using Bars.PercentComplete in an incorrect manner.

            I assume, for example, on a 5 min chart that Bars.PercentComplete will return a value of 0.2 one minute into the bar, etc. Even if I just get rid of all my math and try and plot Bars.PercentComplete I get a nonsensical display.

            Comment


              #7
              I think the issue is that Bars.PercentComplete is returning a value of zero on historical bars. Might screw up your math? It should return a value of 1 on a historical bar. Either way, you should ensure that you are handling any potential divide by zero issues.
              RayNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Ray View Post
                I think the issue is that Bars.PercentComplete is returning a value of zero on historical bars. Might screw up your math? It should return a value of 1 on a historical bar. Either way, you should ensure that you are handling any potential divide by zero issues.
                Ray,

                I think I figured it out, but won't know until market opens tomorrow so I can run it live. It seems as the Bars.PercentComplete does NOT return the % completed, but rather the % remaining. I'll post again if this turns out to be true. If not, than I'm really baffled, because once I made the adjustment for this, everything looked correct.

                Thank you very much for your help.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GTBrooks, Today, 02:44 PM
                0 responses
                4 views
                0 likes
                Last Post GTBrooks  
                Started by GLFX005, Today, 12:22 PM
                3 responses
                39 views
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                Started by AspenHiker, Today, 08:37 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_Kate  
                Started by MartinT, Yesterday, 01:12 PM
                3 responses
                16 views
                0 likes
                Last Post MartinT
                by MartinT
                 
                Started by caveat_lector, Today, 11:58 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Heath  
                Working...
                X