Tagged: gann swings
January 18, 2019 at 2:51 am #50815
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.1234567891011121314151617//Set Swing properties and get swing start/end valuesGS1 = GANNSWING(SWINGCOUNT=3,METHOD=USE NEXT BAR);SS1 = SWINGSTART(GS1);SE1 = SWINGEND(GS1);//Calculate previous swing rangeV1=SS1 - SE1;//Set 2% tolerance either sideV2 = SS1 + (V1 * 0.48);V3 = SS1 + (V1 * 0.52);//Is current SwingEnd within the tolerance?SE1 > V2 andSE1 < 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:1234567891011121314151617//Set Swing propertiesGS1 = GANNSWING(SWINGCOUNT=3,METHOD=USE NEXT BAR);SS1 = SWINGSTART(GS1);SE1 = SWINGEND(GS1);//Calculate previous swing rangeV1=SE1 - SS1;//Set 2% tolerance either sideV2 = SS1 - (V1 * 0.36);V3 = SS1 - (V1 * 0.4);//Is current SwingEnd within the tolerance?SE1 < V2 andSE1 > V3 and CLOSE() > 0August 18, 2019 at 11:11 am #54341Miguel
- Topics: 0
- Replies: 1
- Posts: 1
Please, help!. What’s the code for the watchlist to show Retracement% in a numeric form?
MiguelAugust 19, 2019 at 10:15 pm #54353
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).12345678910111213//Set Swing properties and get swing start/end values - USING INSIDE BARSGS1 = GANNSWING(SWINGCOUNT=3,METHOD=USE NEXT BAR, USEINSIDE=True);SS1 = SWINGSTART(GS1);SE1 = SWINGEND(GS1);//Calculate previous swing $ rangeV1=SS1 - SE1;//Calulate current swing $ valueV2 = SE1-SS1;//Calculate current swing as % of previousV2/V1
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.May 25, 2020 at 9:56 pm #58259Tim
- Topics: 9
- Replies: 13
- Posts: 22
Hi Darren, a query please, when I use showbar for the script with modifications of percentage retrace(btw 50% and 90% as example) and no use of close position, it does not identify all times, it only finds the examples where for example in a bear trend it turns back down from a retrace and makes a new swing in the same bear direction, how do I modify it so that it identifies the occasion when the confirmed retracement swing reaches or is in the range of between 50 and 90% irrespective of whether it turns back down or ends up taking out the swing top etc.
thanksMay 26, 2020 at 9:28 pm #58289
The first post above has 2 scripts – the first calculates the retracement from a low, and the other from a swing high. Is that what you are referring to? If not, please provide the script you are using, along with a screenshot showing what you wish to achieve.
- You must be logged in to reply to this topic.