Here is the offending block of code:
public void Leg3_Find_Leg3_Top(bool leg3_Bottom_Found, int leg3_Top_BarNumber, IDataSeries price_Peak, double leg4_High_Value) { if(leg3_Bottom_Found){ for(int x = leg3_Top_BarNumber; x < 10 + leg3_Top_BarNumber; x++){ if(price_Peak[x] != 0 && price_Peak[x] > leg4_High_Value){ Leg3_Top_Found = true; Leg3_Top_BarNumber = x; Leg3_Top_HighValue = price_Peak[x]; } } } }
leg3_Top_BarNumber = Bar number the previous high was found on. Starting point for new loop.
price_Peak = My method that finds "Price Peaks". Returns 0 if bar is not a peak.
leg4_High_Value = High of wave 4.
Essentially I'm trying map the 5 wave moves of the Elliot Wave pattern. I'm working backwards using loops to map each wave/leg. Finding waves 5 and 4 are simple. When I try to get the top of wave 3 for some reason the loop is missing what should have been the beginning of 3 and going to the beginning of 1. It's doing this consistently across the chart. I made an image of what I want it to do and what it is actually doing. Blue line is what I want. Red line is what it is doing.
Any help would be appreciated.
Comment