Problem : would anyone be able to spot and tell us what is causing the issue below ? from the quick description below :
A public list is created in a copy of the ZigZag indicator like so :
public List<MyList> myList = new List<MyList>(); protected override void OnBarUpdate() { // some code adding things to MyList } public class MyList { private double myDouble; private int myInt; public myList(double myDouble, int myInt) {this.myDouble = myDouble; this.myInt = myInt} public double MyDouble { get { return myDouble; } set { myDouble = value; } } public int MyInt { get { return myInt; } set { myInt = value; } } }
When we try to print MyList values from a strategy, we find troubling results :
// zzW2 is the ZigZag copy containing the list // case A : Print(""); Print("BarsInProgress is : " + BarsInProgress); Print("CurrentBars[BarsInProgress] is : " + CurrentBars[BarsInProgress]); //Print("zzW2.HighBar(1,1,100) is : " + zzW2.HighBar(1,1,100)); // note this is commented on purpose, we will uncomment it next case Print("zzW2.MyList.Count() is : " + zzW2.MyList.Count()); // above code outputs : // BarsInProgress is : 1 // CurrentBars[BarsInProgress] is : 53234 // zzW2.MyList.Count() is : 0 // case B : Print(""); Print("BarsInProgress is : " + BarsInProgress); Print("CurrentBars[BarsInProgress] is : " + CurrentBars[BarsInProgress]); Print("zzW2.HighBar(1,1,100) is : " + zzW2.HighBar(1,1,100)); // note this is uncommented Print("zzW2.MyList.Count() is : " + zzW2.MyList.Count()); // above code outputs : // BarsInProgress is : 1 // CurrentBars[BarsInProgress] is : 53234 // zzW2.HighBar(1,1,100) is : 5 // zzW2.MyList.Count() is : 7718
Why would they both appear to work great if we call zzW2.HighBar() in case B ? and not in case A.
Should the indicator not add things by itself without HighBar() beeing called ?
Comment