I have modified the zig zag indicator to find a certain calculation based on the swing differences.
Now i want to call the result from my modified ZigZag (now name ZIigZagBU)and use it in another indicator and or strategy.
Below is the code i am using to return the variable to the new indicator, it all compiles fine. However the value is always 0 despite each of the 4 varibles below having values when i add the indicator to the chart..... Am i missing something? Should the indicator automatically be up to the same CurrentBar as the indicator i am calling it from or do i have to add more code to find the same point in time or something?
Thanks in advance for any help/guidance. :-)
UpCxn1 = ZigZagBU(DeviationType.Points, zZDeviation1, 10, 1, false, true).Level(true, true);
Here is the Level function in the "ZigZagBU"
public double Level (bool UpOrDown, bool CxnOrDD)
{
if (UpOrDown == true)
{
if (CxnOrDD == true) return UpCxnLinePrice; // return Upward CXN price
if (CxnOrDD == false) return UpDDLinePrice; // return Upward DD price
}
if (UpOrDown == false)
{
if (CxnOrDD == true) return DownCxnLinePrice; // return Downward CXN price
if (CxnOrDD == false) return DownDDLinePrice; // return Downward DD price
}
return -1;
}
Comment