• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Previous Swing Highs and Lows

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

    Previous Swing Highs and Lows

    Hello, I'm using the Swing indicator in my strategy and I'm having trouble finding information on how to access previous highs and lows. For example, using Swing(5).SwingHigh[0] will give me the most recent Swing High with a strength of 5, but I would like to know where the last x number of highs were so I can plot higher highs and lower lows. Can someone provide a simple example? Thanks

    #2
    Hello KNalley,

    The SwingHigh series will just return the value at the number of BarsAgo you requested. For working with the instances of the swings you would need to use SwingHighBar:
    https://ninjatrader.com/support/help...lightsub=swing

    Here is an example of gathering the last two instances of high swings and then getting their values:


    Code:
    int BarsAgo = Swing(4).SwingHighBar(0, 1, Bars.BarsSinceNewTradingDay); 
    if(BarsAgo < 0 || CurrentBar <= BarsAgo) return;
    
    double swingHigh = Swing(4).SwingHigh[BarsAgo];
    Print(swingHigh);
    
    int BarsAgo2 = Swing(4).SwingHighBar(0, 2, Bars.BarsSinceNewTradingDay); 
    
    if(BarsAgo2 < 0 || CurrentBar <= BarsAgo2) return;
    
    double swingHigh2 = Swing(4).SwingHigh[BarsAgo2];
    Print(swingHigh2);
    you can also use the High series as shown in the help guide sample.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you, I can work with that example

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by KeenEdge, Today, 04:08 PM
      0 responses
      1 view
      0 likes
      Last Post KeenEdge  
      Started by aipjcnow, Yesterday, 12:56 PM
      2 responses
      11 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Nice-Spread, Yesterday, 02:02 AM
      2 responses
      14 views
      0 likes
      Last Post Nice-Spread  
      Started by jaysinclair, Today, 01:04 PM
      0 responses
      2 views
      0 likes
      Last Post jaysinclair  
      Started by markbb10, Today, 12:48 PM
      0 responses
      7 views
      0 likes
      Last Post markbb10  
      Working...
      X