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
Shift of the maximum value over a specific number of bars
Collapse
X
-
Hi Stan, thanks for posting.
To find the highest high price over a certain period, use the MAX method. This example gives the highest high price over 20 bars:
double value = MAX(High, 20)[0];
The reason you would use this kind of method is to evaluate what the highest high price is over x amount of bars. If you only need to evaluate one bar, the prices can be accessed in the OHLC price arrays. The lowest period you can pass to MAX is 1 e.g. MAX(High, 1)[0] will return either the last bar or the most recent bar high price. This can also be written Math.Max(High[1], High[0]);
Kind regards,
-ChrisL
Leave a comment:
-
Shift of the maximum value over a specific number of bars
Hello!
I am sorry to bring a Metatrader’s term to this forum. I am struggling since one week already with this topic, but I am failing to solve the problem. I hope you could help me understanding this term.
I have this function from Metatrader4:
HTML Code:for (int i = 0; i <= 10; i++) { double a = iHighest(NULL, 0, MODE_LOW, Period, i); }
HTML Code:double b = iHighest(NULL, 0, MODE_HIGH, Period, i);
In Google, I found the definition of iHighest as followed: Returns the shift of the maximum value over a specific number of bars depending on type.
But I want there my specific number of bars to be 1.
In Ninjatrader documentation, I also found this:
int highestBarsAgo = HighestBar(High, Bars.BarsSinceNewTradingDay);
double highestPrice = High[highestBarsAgo];
With this, I would already be out of range in my loop.
Could someone advise me what could the the equivalent of double a = iHighest(NULL, 0, MODE_LOW, Period, i) in Ninjatrader?
Any help would be very appreciate.
Thanks!
Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by GussJ, 03-04-2020, 03:11 PM
|
11 responses
3,227 views
0 likes
|
Last Post Today, 08:07 PM | ||
Started by andrewtrades, Today, 04:57 PM
|
1 response
13 views
0 likes
|
Last Post Today, 05:02 PM | ||
Started by chbruno, Today, 04:10 PM
|
0 responses
7 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
440 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
11 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
Leave a comment: