Identifying Gaps on Gann Swing Charts

Optuma Forums Optuma Scripting Identifying Gaps on Gann Swing Charts

  • This topic has 3 replies, 3 voices, and was last updated 6 months ago by Ian.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #61997
    • Topics: 6
    • Replies: 7
    • Posts: 13


    On a Gann Swing Chart, I’d like to be able identify gaps in the swing, such as the one pictured below. These sort of gaps often, but not always, indicate a change of trend or strengthening of a trend.

    In the first example attached, there was an initial slow and steady uptrend (a few higher swing highs and higher swing lows), then after the gap, the uptrend accelerated. The gap can be an early clue that sentiment has shifted. The swing down that created the gap was < 50%, which can be another clue as to strength.
    A second example is also attached.

    I’ve looked at the GANNSWING() function and the inbuilt scripts, Gann Swing Bull Gap Greater and Gann Swing Bull Gap Less but they don’t seem to be written to identify gaps.
    Not sure where to start with this but hopefully someone can help.


    • Topics: 40
    • Replies: 1,965
    • Posts: 2,005

    Hi Ian,

    The first thing I always do with Swings is draw out the pattern I am interested in and then number the swings. Remember that it is not until the last swing turns up that we will have our signal, so that is where we expect to see the arrow.  In the image below I have my numbers just to the left of each line.

    Also, remember that we can reference previous swings by using square brackets. If there are no square brackets, I am working with the last swing line (0). I use the variables “g1” to make the script easier to read.

    Given that, the code will be

    Hope that helps


    • Topics: 10
    • Replies: 16
    • Posts: 26

    Hi Ian, below is a script, if you tell me what your after I can give you a bit of a hand even though my scripting skills are poor


    c1 = SWINGUP(GS1);
    c3 = SWINGSTART(GS1, 1) > SWINGSTART(GS1, 3);
    c4 = SWINGSTART(gs1) > SWINGSTART(gs1,3);

    s1 = SWINGEND(GS1[1]);
    U1 = SWINGUP(GS1);
    V1 = IF(S1 < SWINGEND(GS1[2]),SWINGEND(GS1[2]),S1) ;

    c7 = high() CrossesAbove V1 and U1 == 1;

    c1 and c2 and c3 and c4 and c7

    • Topics: 6
    • Replies: 7
    • Posts: 13

    Thanks for your replies.

    Mathew, your tip on numbering the swings seems obvious when you point it out!

    I tested the script on a small workbook in which there were 4 known Swing gaps, and this identified all 4. Results varied depending on whether SWINGCOUNT = 1 or SWINGCOUNT = 2 was used.

    Tim, your script identified 2 of the 4 gaps, but I haven’t yet delved into it to see what might need changing.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest