Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Feedback on PVP indicator...

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

    Feedback on PVP indicator...

    Hi,

    I tried both of the scripts below. Neither of them worked unfortunately. The scripts produced a blank screen. Any suggestions... I want the indicator to give me the closing price for the bar that is 20 bars before / ahead of the Maximum volume bar for that session. Thanks...

    if (CurrentBar < 20)return;
    double MaxVolume = 0;
    double MaxPrice = 0.0;
    for (int x = 0; x <= Bars.BarsSinceSession; x++)
    {
    if (Volume[x] > MaxVolume)
    {
    MaxVolume = Volume[x];
    MaxPrice = Close[x + 20];
    }}
    Plot0.Set(MaxPrice);


    double MaxVolume = 0;
    double MaxPrice = 0.0;
    for (int x = 0; x <= Bars.BarsSinceSession; x++)
    {
    if (Volume[x] > MaxVolume)
    {
    MaxVolume = Volume[x];
    MaxPrice = Close[x + 20];
    }}
    Plot0.Set(MaxPrice);

    #2
    Shawn, any errors in the log tab as you apply those indicators? The CurrentBar check may not be high enough as your x can easily be higher later in the session...
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand...

      THanks Bertrand,

      I do have an error report... It says the following:
      Error on calling "onbarupdate" for indicator on bar 0 (and 20). Index was out of range.. Must be non-negative and less than the size of the collection. Parameter Name index.
      Exactly what should I do about this?

      Comment


        #4
        Shawn, this is likely the too low CurrentBar check I mentioned, as your BarsSinceSession count can easily be higher than 20...

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Reply

          Bertrand,

          Thanks for your feedback..

          Is it possible to fix this problem? I looked at the link that you sent me.. I'm not sure how to proceed.

          From what I understand, the later bars in the session after the volume count are interfering with the results.. Maybe it's not possible to accomplish what I want then based on your feedback?

          Comment


            #6
            More feedback...

            I changed the following code as follows:

            if (CurrentBar < 480) return;

            So far the indicator appears to be working now for (x +20) ... OK.. Thanks...

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            59 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            22 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            10 views
            0 likes
            Last Post cre8able  
            Working...
            X