Thanks.
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
Highest and Lowest Values in Last X Bars
Collapse
X
-
Highest and Lowest Values in Last X Bars
I am new here and have a very basic question. For my new indicator I want to find the values of the highest High and the lowest Low over the past 20 bars. It seems that MIN and MAX give you the number of bars back that the highs and lows occurred but don't give the values of the high and low. What is the correct way to calculate these values?
Thanks.Last edited by LarryRay; 12-20-2017, 06:54 PM.Tags: None
-
Hello LarryRay,
Thanks for your post and welcome to the NinjaTrader forums!
The MAX and MIN method will return the value of the bar that has the MAX or MIN value in the lookback period.
For example:
Print ("Max: "+MAX(High, 20)[0]+" Low:"+MIN(Low, 20)[0]);
Would print to the output window the Highest high within the 20 bar lookback period and the lowest low in the 20 bar lookback.
References:
If you are seeing something different, please post your code section.Paul H.NinjaTrader Customer Service
- Likes 1
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Kaledus, Today, 01:29 PM
|
1 response
6 views
0 likes
|
Last Post Today, 01:53 PM | ||
Started by frankthearm, Yesterday, 09:08 AM
|
13 responses
45 views
0 likes
|
Last Post
by frankthearm
Today, 01:52 PM
|
||
Started by PaulMohn, Today, 12:36 PM
|
2 responses
16 views
0 likes
|
Last Post
by PaulMohn
Today, 01:48 PM
|
||
Started by Conceptzx, 10-11-2022, 06:38 AM
|
2 responses
55 views
0 likes
|
Last Post
by PhillT
Today, 01:47 PM
|
||
Started by yertle, Yesterday, 08:38 AM
|
8 responses
37 views
0 likes
|
Last Post
by ryjoga
Today, 01:22 PM
|
Comment