Hi,
I’m trying to create a AVWAP Pinch script and am having some issues.
The AVWAP’s are calculated from last 3 months high and low.
The three conditions are;
- The high and low AVWAP's are within 10% of each other with the high AVWAP above the low AVWAP (first signal).
- The high and low AVWAP's converge for the next 5 bars from the first signal (second signal).
- The CLOSE() is still within the high and low AVWAP's after the second signal
//Set the look back period from the last bar eg 63 bars for 3 months V1 = BARINDEX()==LAST(BARINDEX())-63; //Find high and low signal dates in the look back period S1 = HIGH() == HIGHESTSINCE(V1); S2 = LOW() == LOWESTSINCE(V1); //Remove non trading days, non zero results, showing most recent result as latest value V2 = BarDate(NonZero(S1)); V3 = BarDate(NonZero(S2)); //Calculate AVWAP's from signal dates C1 = AVWAP(BACKTYPE=Fixed, DATE=V2); C2 = AVWAP(BACKTYPE=Fixed, DATE=V3); //Calculate $ difference between high and low AVWAP C3 = C1-C2; //Calculate the % difference between high and low AVWAP C4 = C3/C1; //Is the differece between high and low AVWAP's less than 10% and greater than 0% S3 = C4 >= 10 and C4 <= 0; // Bar Date of S3 signal V4 = BARDATE(S3); //AVWAP's converging for next 5 days from S3 signal S4 = VERGENCE(C1,C2,, LOOKBACK=5) //Close withing high and low AVWAPS S5 = CLOSE() <C1 and >C2;S3 and S4 and S5