Gann Swing Retracement Scan

Optuma Forums Optuma Scripting Gann Swing Retracement Scan

This topic contains 4 replies, has 4 voices, and was last updated by  Ciro 3 months, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #47551
    • Topics: 28
    • Replies: 152
    • Posts: 180

    The following formula will calculate when the current Gann Swing is at 50% of the previous swing (with a 2.5% tolerance either side). Because it will depend if the current swing is pointing up or down we will need a script for both conditions.

    50% retracement up from previous swing low:

    50% retracement down from a previous swing high:

    When executed as a scan (both criteria can be added in the scan setup using ‘Or’) the results can be exported as a watchlist, and custom columns added. In this example only two stocks in my universe have retraced down from a high (DIN & SHAK) whilst the others are 50% above the low:


    To change the retracement levels adjust the values in R1 and R2 variables, so for 38.2% retracements you would change the tolerance to something like 0.588 and 0.648 (this is calculated by 1 – 0.382, + and – 3%).


    • Topics: 0
    • Replies: 1
    • Posts: 1

    Great Tool

    Awesome Job i was thinking how this could be done a few weeks ago and wow you have come up with this really cool…


    • Topics: 0
    • Replies: 2
    • Posts: 2

    Problem with down retracement

    Thanks for that code, however I have been unable to get the retracement down code to show any result.

    The retracement up works exactly s expected.

    Can you think of any reason for that result?

    Image attached.






    • Topics: 0
    • Replies: 2
    • Posts: 2


    The code for the down swing should be:
    // Define the Gann Swing criteria GS1 = GANNSWING(SWINGCOUNT=3,METHOD=USE NEXT BAR);
    // Get Previous Up Swing Length and 2.5% tolerance levels
    R1 = SWINGEND(GS1,OFFSET=1) – ((SWINGend(GS1,OFFSET=1) – SWINGstart(GS1,OFFSET=1)) * 0.475);
    R2 = SWINGEND(GS1,OFFSET=1) – ((SWINGend(GS1,OFFSET=1) – SWINGstart(GS1,OFFSET=1)) * 0.525);
    //Is the current swing between the tolerance levels? SWINGEND(GS1) < R1 AND SWINGEND(GS1) > R2

    That then gives the result attached.


    cheers Michael

    • This reply was modified 3 months, 2 weeks ago by  Michael.

    • Topics: 1
    • Replies: 1
    • Posts: 2

    2-3 days max retracement

    Hi All, 

    I’m completely new to Optuma and honestly probably I know just the 3% of the software capability.  By the way this topic is awesome and it will be one the next thing I will try to apply. 

    In the meantime I want to ask if do you have already developed a script that help user to find stock that are in a trend (up or down not matter) and they are having a rest of few days, Gann usualy refer to a 2-3 days rest at maximum. 


    Thank you helping me to be a better Optuma user. 



Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.