Announcement

Collapse
No announcement yet.

Volume Profile - System.InvalidOperationException - Collection was modified

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

  • Volume Profile - System.InvalidOperationException - Collection was modified

    Hello community friends,

    I have a problem with my Volume Profile Indicator that I use to hand over the POC, high VA and low Va to my signal.

    The following exception is thrown and I don't know how to solve the problem.

    System.InvalidOperationException: Collection was modified;
    enumeration operation may not execute.
    at System.ThrowHelper.ThrowInvalidOperationException( ExceptionResource resource)
    at System.Collections.Generic.List`1.Enumerator.MoveN extRare()..........

    I would appreciate it if someone could please help me in this case.

    Thank you very much in advance and many greetings from Germany!!
    Abdel
    Click image for larger version

Name:	InvalidOperationException.png
Views:	234
Size:	21.6 KB
ID:	6993

    Click image for larger version

Name:	FormatOfIndicator.png
Views:	124
Size:	18.5 KB
ID:	6994


    This is the coding:

    PHP Code:
    using System;
    using System.Drawing;
    using System.Linq;
    using PowerLanguage.Function;
    using PowerLanguage.VolumeProfile;

    //Indicator
    namespace PowerLanguage.Indicator{
        public class 
    Beispiel IndicatorObject {
            public 
    Beispiel(object _ctx):base(_ctx){}

            private 
    IPlotObject vPOCplot;
            private 
    IPlotObject high_VA;
            private 
    IPlotObject low_VA;

            
    //the following variables will be taken over to my signal
            
    public double vHANDOVER_highVA;
            public 
    double vHANDOVER_POC;    
            public 
    double vHANDOVER_lowVA;

            protected 
    override void Create() {
                
    // create variable objects, function objects, plot objects etc.
                
    high_VA AddPlot(new PlotAttributes("MaxVA"EPlotShapes.Line,Color.BlueColor.Blue20true));
                
    vPOCplot AddPlot(new PlotAttributes("vPOC"EPlotShapes.Line,Color.GreenColor.Green20true));
                
    low_VA AddPlot(new PlotAttributes("MinVA"EPlotShapes.Line,Color.BlueColor.Blue20true));
            }

            private 
    void VolumeProfileOnEChanged(bool full)
            {
            
    //Recalculate if the profile has been completely changed.
                
    if (full){ 
                    
    this.ExecControl.Recalculate();            
                }
            }

            protected 
    override void StartCalc() {
                
    //subscribing for profile changes
                
    VolumeProfile.EChanged += VolumeProfileOnEChanged;
            }

            protected 
    override void CalcBar(){

                
    int bn Bars.FullSymbolData.Current 1;            
                var 
    vp VolumeProfile.ItemForBar(bn);            

                    if (
    vp != null)
                    {    
                        
    vHANDOVER_highVA = (double)vp.HighVAForBar(bn);
                        
    vHANDOVER_POC = (double)vp.POCForBar(bn);
                        
    vHANDOVER_lowVA = (double)vp.LowVAForBar(bn);
                    }

                
    //Plot    
                
    high_VA.Set(vHANDOVER_highVA);    
                
    vPOCplot.Set(vHANDOVER_POC);
                
    low_VA.Set(vHANDOVER_lowVA);    


            }
        }


  • #2
    please contact [email protected] we will create a ticket to send to our MC support and get this sorted out for you.

    Comment


    • #3
      Thank you very much! I will contact the mentioned email address for the ticket and keep you updated here.
      Last edited by elma368; 02-09-2019, 06:14 AM.

      Comment

      Disclaimer: There is a risk of loss in trading futures, forex and options. Futures, forex and options trading are not appropriate for all investors. Only risk capital should be used when trading futures. All information is for educational use only and is not investment advice. Past performance is not indicative of future results.

      This website is hosted and operated by AMP Global Clearing, LLC ("AMP"), which provides brokerage services to traders of futures and foreign exchange products. This website is intended for customer support, educational and informational purposes only and should NOT be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by AMP and the information made available on this Web site is NOT an offer or solicitation of any kind. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of AMP.

      All Users and Contributors along with their websites, products and services, are independent persons or companies that are in no manner affiliated with AMP. AMP is not responsible for, do not approve, recommend or endorse any User and/or Contributor Content referenced on this website and it’s your sole responsibility to evaluate All Content. Please be aware that any performance information provided by a user and/or contributor should be considered hypothetical.

      HYPOTHETICAL PERFORMANCE RESULTS HAVE MANY INHERENT LIMITATIONS, SOME OF WHICH ARE DESCRIBED BELOW. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN. IN FACT, THERE ARE FREQUENTLY SHARP DIFFERENCES BETWEEN HYPOTHETICAL PERFORMANCE RESULTS AND THE ACTUAL RESULTS SUBSEQUENTLY ACHIEVED BY ANY PARTICULAR TRADING PROGRAM.

      ONE OF THE LIMITATIONS OF HYPOTHETICAL PERFORMANCE RESULTS IS THAT THEY ARE GENERALLY PREPARED WITH THE BENEFIT OF HINDSIGHT. IN ADDITION, HYPOTHETICAL TRADING DOES NOT INVOLVE FINANCIAL RISK, AND NO HYPOTHETICAL TRADING RECORD CAN COMPLETELY ACCOUNT FOR THE IMPACT OF FINANCIAL RISK IN ACTUAL TRADING. FOR EXAMPLE, THE ABILITY TO WITHSTAND LOSSES OR TO ADHERE TO A PARTICULAR TRADING PROGRAM IN SPITE OF TRADING LOSSES ARE MATERIAL POINTS WHICH CAN ALSO ADVERSELY AFFECT ACTUAL TRADING RESULTS. THERE ARE NUMEROUS OTHER FACTORS RELATED TO THE MARKETS IN GENERAL OR TO THE IMPLEMENTATION OF ANY SPECIFIC TRADING PROGRAM WHICH CANNOT BE FULLY ACCOUNTED FOR IN THE PREPARATION OF HYPOTHETICAL PERFORMANCE RESULTS AND ALL OF WHICH CAN ADVERSELY AFFECT ACTUAL TRADING RESULTS.

      AMP has NOT endorsed or recommended the use any product, services offered by any 3rd party User or Contributor on this forum. No person employed by, or associated with, AMP is authorized to provide any information about any 3rd party User or Contributor content. All specific brokerage related questions should be directed towards AMP.

      Copyright © 2017. All rights reserved.

      Working...
      X