Posted 9/16/2009 07:40:37
|
|
|
|
Actually, I just double checked the spreadsheet and it does not contain calcs for Zig Zag, but the book does. Let me know if you're having problems with the formula on Zig Zag and I'll be happy to help.
vitor dantas (9/15/2009) Thank´s a lot !!
|
|
Posted 9/16/2009 15:19:33
|
|
|
|
| Bilb, thanx alot your help !!! i have this book and saw the description on page 372 but it doesn´t show the formula. What i´m trying to change is veru simple, instead of marking the close price, use - if relative high - use the High value and if relative low use the low value. I believe that with the code it´s a piece of cake to change that, if you could help me i would be very very gratefull !! Thanx Vitor
|
|
Posted 9/17/2009 08:20:40
|
|
|
|
I cleared it with the boss to give you this snippet. Our ZigZag calculation.
public override void AppendBar(BarData bar)
{
pBars.Add(bar);
int pBarIndex = pBars.Count - 1;
if (pBarIndex == 0)
{
startPrice = BarUtils.GetValueForBarElement(bar, barElement);
startIndex = pBarIndex;
_values.Add(startPrice);
}
else
{
double priceChange = percent / 100.0;
double todaysPrice = BarUtils.GetValueForBarElement(bar, barElement);
if (todaysPrice > (startPrice + (startPrice * priceChange)) || todaysPrice < (startPrice - (startPrice * priceChange)))
{
double endPrice = todaysPrice;
int endIndex = pBarIndex;
double slope = (endPrice - startPrice) / (double)(endIndex - startIndex);
double currentPrice = startPrice;
for (int i = startIndex + 1; i < endIndex; i++)
{
currentPrice += slope;
_values.SetValue(_values.Count - i - 1, currentPrice);
}
_values.Add(endPrice);
startPrice = endPrice;
startIndex = endIndex;
}
else
{
_values.Add(double.NaN);
}
}
}
|
|
Posted 9/17/2009 10:58:44
|
|
|
|
| Thank´s a lot Billb !!!! Very gratefull !!!! Really you are the best in market , thank´s again !!!
|
|
|
|