The following script will search for 50% retracements (+/- 2%) up from the previous downswing, often seen as an important resistance level. The swings have been based on daily 3 bar Gann Swings, but all the settings (eg retracement levels, tolerance, swing parameters) can be adjusted as needed. The timeframe can be set in the Scanning Manager window.
//Set Swing properties and get swing start/end values GS1 = GANNSWING(SWINGCOUNT=3,METHOD=USE NEXT BAR); SS1 = SWINGSTART(GS1); SE1 = SWINGEND(GS1); //Calculate previous swing range V1=SS1[1] - SE1[1]; //Set 2% tolerance either side V2 = SS1 + (V1 * 0.48); V3 = SS1 + (V1 * 0.52); //Is current SwingEnd within the tolerance? SE1 > V2 and SE1 < V3 and CLOSE() > 0
In this example, BXP has retraced 48.41% of the previous swing, so might be worth keeping an eye on to see if it breaks through or bounces off:
Of course, downward retracements are just as important. He’s an example of a retracement from a high of 36 - 40% - ie close to the Fibonacci 38.2% level. Note the changes to variables V2 and V3:
//Set Swing properties GS1 = GANNSWING(SWINGCOUNT=3,METHOD=USE NEXT BAR); SS1 = SWINGSTART(GS1); SE1 = SWINGEND(GS1); //Calculate previous swing range V1=SE1[1] - SS1[1]; //Set 2% tolerance either side V2 = SS1 - (V1 * 0.36); V3 = SS1 - (V1 * 0.4); //Is current SwingEnd within the tolerance? SE1 < V2 and SE1 > V3 and CLOSE() > 0