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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      51 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X