CobusSteyn0105: I have no idea where is the memory leak,
p = new CPivot(); if ( GetTypicalFracPivot(i,p)==PT_TYPICALFRACHIGH) { if (p.m_price >= High[0]) HighPivotList.Add(p); }
You create a pointer in p. If those two if statements are not both true, you loose the pointer. LEAK.
William Roeder:
You create a pointer in p. If those two if statements are not both true, you loose the pointer. LEAK.
Thank you very much William!
Do you think the fact that the list isn't sorted properly has something to do with the leak?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all
Apologies for the long post but here is my problem:
I'm writing an indicator to continuously (ie on every OnCalculate call), plot the last few fractals, and draw support and resistance lines on those closest to High[0] and Low[0].The high fractals are those higher than High[0], and the low ones lower than Low[0].
I actually have 2 issues:
1.the leaked memory thing...runtime error that says there are x amount of CPivot objects still left.
2. the fact that the list doesn't get sorted and hence the lines getting drawn on the wrong pivot.
If someone can please please help me and point the errors out.
I use objects of custom class CPivot for the fractals that gets added to a CList.
The function to look for the fractals:
Init and deinit code:
I will try to explain the code in green comments for OnCalculate:
To plot the pivots:
Now to draw the closest resistance line:
To clear the chart:
Almost forgot:
The Compare method for CPivot:
Well that is about it.
I have no idea where is the memory leak, and why the list doesn't get sorted...