Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using PNF as secondary series

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

    Using PNF as secondary series

    Hello and good day,

    I'm trying to develop a indicator that can access some indicator values that are based on a PNF dataseries but using it in a minute chart.

    Code:
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Alert"));
                Overlay				= false;
    //			AddPointAndFigure("$EURUSD", pType, baseperiod, box, reversal, PointAndFigurePriceType.Close, MarketDataType.Last); 
    			AddPointAndFigure("$EURUSD", pType, baseperiod, box, reversal, PointAndFigurePriceType.Close, MarketDataType.Last); 
    
            }
    
      protected override void OnBarUpdate()
            {
    			Alert.Set(0);
    			if (CurrentBar < 2)
    				return;
    			if
    			    (
    				d9ParticleOscillator_V2(BarsInProgress [1],d9period,0).RawTrend[0]>0
    				)
    					{
    		    Alert.Set(1);
    			BackColorAll = Color.PaleGreen;
    					}
    			if
    			    (
    				d9ParticleOscillator_V2(BarsInProgress [1],d9period,0).RawTrend[0]<0
    				)
    				{
    		    Alert.Set(-1);
    			BackColorAll = Color.Coral;
    				}		
            }
    Im getting this error:

    24-11-2014 11:00:43 Default Error on calling 'OnBarUpdate' method for indicator 'Signal1' on bar 2: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.


    Could you help me?


    Thank You

    #2
    hliboi, first thing I would suggest doing is including a CurrentBars check for all your series (not just primary one).



    Next, to calcuate your indicator using the first added series data, just use BarsArray[1] for the IDataSeries parameter field in your method call (you currently point to BarsInProgress here).

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    580 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    336 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X