Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Previous Swing Highs and Lows
Collapse
X
-
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? ThanksTags: None
-
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:
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);
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Hello jimmy_NT,
Swing is the swing indicator, the 4 is the strength parameter the swing takes: https://ninjatrader.com/support/help...lightsub=swingJesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by goodknight777, Today, 08:43 AM
|
1 response
5 views
0 likes
|
Last Post Today, 09:25 AM | ||
Started by kramnor2001, Yesterday, 02:30 PM
|
3 responses
21 views
0 likes
|
Last Post
by kramnor2001
Today, 09:20 AM
|
||
Started by ninza33, Today, 09:10 AM
|
0 responses
6 views
0 likes
|
Last Post
by ninza33
Today, 09:10 AM
|
||
Started by Padan, Today, 02:02 AM
|
3 responses
11 views
0 likes
|
Last Post Today, 08:54 AM | ||
Started by Tim-c, Today, 08:36 AM
|
1 response
3 views
0 likes
|
Last Post Today, 08:45 AM |
Comment