- Topics: 66
- Replies: 590
- Posts: 656
To calculate the ratio of the current swing to the previous use this for a 3 bar swing (NOTE: this is slightly different from the script above in that inside bars are included in the swing counts).
//Set Swing properties and get swing start/end values - USING INSIDE BARS
GS1 = GANNSWING(SWINGCOUNT=3,METHOD=USE NEXT BAR, USEINSIDE=True);
SS1 = SWINGSTART(GS1);
SE1 = SWINGEND(GS1);
//Calculate previous swing $ range
V1=SS1 - SE1;
//Calulate current swing $ value
V2 = SE1-SS1;
//Calculate current swing as % of previous
Note however that it calculates the last confirmed swing end value, which will be different from the current close. For example AAPL’s most recent swing end value of $212.14 occurred 3 bars ago, which is 67.94% of the previous swing. The next swing hasn’t been confirmed yet, so the last close of $206.50 is only 48.35% of the previous swing.
To calculate the retracement to the most recent close instead change variable V2 above (line 10) to the following:
V2 = CLOSE()-SS1;
Save the workbook attached.
You must be logged in to access attached files.