Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Finding the beginning of a swing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Finding the beginning of a swing

    Greetings,
    I am developing a strategy using the builtin swing indicator..
    I want to use information regarding the last two swings, the last low and the last high. I want to know the date of the leftmost dot in either case.

    How do I find it?

    Thanks

    Morris

    #2
    Welcome to the forums!

    The Swing indicator supports two methods that return the BarsAgo index of the bar where the swing occurred.

    Try using the SwingHighBar/SwingLowBar methods.
    The return value could then be used to access the Time series, something like this,

    Code:
    int SwingHighBarsAgo = Swing(strength).SwingHighBar(0, [COLOR=#FF0000]1[/COLOR], CurrentBar);
    int SwingLowBarsAgo = Swing(strength).SwingLowBar(0, [COLOR=#FF0000]1[/COLOR], CurrentBar);
    
    if (SwingHighBarsAgo != -1 && SwingLowBarsAgo != -1)
    {
        DateTime SwingHighDateTime = Time[SwingHighBarsAgo];
        DateTime SwingLowDateTime = Time[SwingLowBarsAgo];
        ....
    }
    This should get you what you want.

    EDIT:
    Changed the code to better reflect OP's original question.
    Last edited by bltdavid; 03-22-2020, 03:58 PM.

    Comment


      #3
      Hi morrnel, thanks for your post.

      I agree with bltdavid's answer here. Thanks for sharing bltdavid

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      50 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X