Percent Swing – Script to Show Highs and Lows on Chart

Optuma Forums Optuma Scripting Percent Swing – Script to Show Highs and Lows on Chart

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #66855
    Jonathan
    • Topics: 1
    • Replies: 2
    • Posts: 3

    Hi All,

    I’m trying to work out how to script to show the extreme highs and lows for each swing using this tool.

    For clarity, I’ve manually added to the chart what I’d like to see.

    Any help on this is much appreciated.

    Regards,

    Jon

    #66859
    Darren
    • Topics: 74
    • Replies: 967
    • Posts: 1,041

    Thanks Jon – are you looking to get the values of the swings? Use the PERCENTWING() function, set to your preference, eg 5%.

    Then use the SWINGEND() function to get the value of the last swing:

    Use the square bracket offsets for the previous swings, eg the previous swing value:

    Note that the offset values will depend on the direction of the current swing, so if the swing is down (as in your example of XAO) then the odd numbered offsets will be high swings, and even numbered will be the lows. If the current swing is down, then it will be the opposite.

    I’m planning on doing some blog posts over the next few weeks on swing scripts because it can get quite tricky. Sign up here if you haven’t already, and you’ll be notified on the weekend when they are published (see the last article on identifying swing trends):

    http://www.optuma.com/blog

    #66869
    Jonathan
    • Topics: 1
    • Replies: 2
    • Posts: 3

    Hi Darren,
    The value of the swings are not what I’m after at this stage… this particular query relates to time studies.
    Therefore I’m most interested in the date of the swing high or low in order to correlate to other time indicators – it needs to show up in the time clusters tool.
    I’d also like to be able to export to excel to manipulate the data if needed.

    The formula you provided works well – it puts the showbar on the chart but doesn’t register on the time clusters tool.
    It also doesn’t easily export to excel with some type of indication that the high or low date has been flagged.

    Is there something else that can be added to the script to help with this?

    Cheers,

    Jon

    #66871
    Darren
    • Topics: 74
    • Replies: 967
    • Posts: 1,041

    OK thanks. Rather than create a script open a Percent Swing Chart (not the overlay tool) and select Copy Data to Clipboard from under Actions, and then paste in Excel for all the swing data (including start, end, and confirmation dates):

    Capture

    Capture

    #66883
    Jonathan
    • Topics: 1
    • Replies: 2
    • Posts: 3

    Hi Darren,
    Thankyou, this all worked perfectly.

    One final question:  Is there a way to change the basis of calculation for the Percent Swing Highs vs Lows?

    A typical Percent Swing Chart (set at 10%) will use 10% of the low price for the minimum swing up, and 10% of the high price for the minimum swing down.  In this normal scenario, for swings that are equal in terms of %, the dollar values of those swings is less for the Swing Down than Swing Up.

    Is it possible to have the Swing Down calculated based on 10% of the lowest price in the swing (rather than starting high price)?  That way the swing up and swing down would be using the same basis for calculation (in terms of actual dollar movements).

    Cheers,

    Jon

    #66891
    Darren
    • Topics: 74
    • Replies: 967
    • Posts: 1,041

    Hi John,

    It’s not possible to change the percent swing that way. We do have a Point Swing based on dollars, but a $10 move today could be a very difference swing (in terms of %) than a few years ago.

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

Pin It on Pinterest